X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fserver.h;h=f770fa3d44ba170e859f7a7b0690bcfe3903b6d9;hb=8ccdd3bdb43b313d729279dbbb267528fc191615;hp=d6bbe99a6baf344669458ab4081c9405ee317704;hpb=704782c95b8a4194a9383da55d93f37fd0f7278f;p=dragonfireclient.git diff --git a/src/server.h b/src/server.h index d6bbe99a6..f770fa3d4 100644 --- a/src/server.h +++ b/src/server.h @@ -3,16 +3,16 @@ Minetest-c55 Copyright (C) 2010-2011 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GNU Lesser General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "connection.h" #include "environment.h" -#include "common_irrlicht.h" +#include "irrlichttypes_bloated.h" #include #include "porting.h" #include "map.h" @@ -34,6 +34,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "inventorymanager.h" #include "subgame.h" #include "sound.h" +#include "util/thread.h" +#include "util/string.h" +#include "rollback_interface.h" // Needed for rollbackRevertActions() +#include // Needed for rollbackRevertActions() + struct LuaState; typedef struct lua_State lua_State; class IWritableItemDefManager; @@ -41,6 +46,7 @@ class IWritableNodeDefManager; class IWritableCraftDefManager; class EventManager; class PlayerSAO; +class IRollbackManager; class ServerError : public std::exception { @@ -502,6 +508,7 @@ class Server : public con::PeerHandler, public MapEventReceiver, std::set getPlayerEffectivePrivs(const std::string &name); bool checkPriv(const std::string &name, const std::string &priv); void reportPrivsModified(const std::string &name=""); // ""=all + void reportInventoryFormspecModified(const std::string &name); // Saves g_settings to configpath given at initialization void saveConfig(); @@ -534,8 +541,18 @@ class Server : public con::PeerHandler, public MapEventReceiver, void queueBlockEmerge(v3s16 blockpos, bool allow_generate); + // Creates or resets inventory + Inventory* createDetachedInventory(const std::string &name); + // Envlock and conlock should be locked when using Lua lua_State *getLua(){ return m_lua; } + + // Envlock should be locked when using the rollback manager + IRollbackManager *getRollbackManager(){ return m_rollback; } + // actions: time-reversed list + // Return value: success/failure + bool rollbackRevertActions(const std::list &actions, + std::list *log); // IGameDef interface // Under envlock @@ -546,12 +563,14 @@ class Server : public con::PeerHandler, public MapEventReceiver, virtual u16 allocateUnknownNodeId(const std::string &name); virtual ISoundManager* getSoundManager(); virtual MtEventManager* getEventManager(); + virtual IRollbackReportSink* getRollbackReportSink(); IWritableItemDefManager* getWritableItemDefManager(); IWritableNodeDefManager* getWritableNodeDefManager(); IWritableCraftDefManager* getWritableCraftDefManager(); const ModSpec* getModSpec(const std::string &modname); + void getModNames(core::list &modlist); std::string getBuiltinLuaPath(); std::string getWorldPath(){ return m_path_world; } @@ -583,7 +602,7 @@ class Server : public con::PeerHandler, public MapEventReceiver, static void SendItemDef(con::Connection &con, u16 peer_id, IItemDefManager *itemdef); static void SendNodeDef(con::Connection &con, u16 peer_id, - INodeDefManager *nodedef); + INodeDefManager *nodedef, u16 protocol_version); /* Non-static send methods. @@ -599,6 +618,7 @@ class Server : public con::PeerHandler, public MapEventReceiver, void SendPlayerHP(u16 peer_id); void SendMovePlayer(u16 peer_id); void SendPlayerPrivileges(u16 peer_id); + void SendPlayerInventoryFormspec(u16 peer_id); /* Send a node removal/addition event to all clients except ignore_id. Additionally, if far_players!=NULL, players further away than @@ -621,6 +641,10 @@ class Server : public con::PeerHandler, public MapEventReceiver, void sendMediaAnnouncement(u16 peer_id); void sendRequestedMedia(u16 peer_id, const core::list &tosend); + + void sendDetachedInventory(const std::string &name, u16 peer_id); + void sendDetachedInventoryToAll(const std::string &name); + void sendDetachedInventories(u16 peer_id); /* Something random @@ -707,6 +731,11 @@ class Server : public con::PeerHandler, public MapEventReceiver, // Bann checking BanManager m_banmanager; + // Rollback manager (behind m_env_mutex) + IRollbackManager *m_rollback; + bool m_rollback_sink_enabled; + bool m_enable_rollback_recording; // Updated once in a while + // Scripting // Envlock and conlock should be locked when using Lua lua_State *m_lua; @@ -822,6 +851,12 @@ class Server : public con::PeerHandler, public MapEventReceiver, */ std::map m_playing_sounds; s32 m_next_sound_id; + + /* + Detached inventories (behind m_env_mutex) + */ + // key = name + std::map m_detached_inventories; }; /*