aboutsummaryrefslogtreecommitdiff
path: root/src/serverenvironment.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/serverenvironment.h')
-rw-r--r--src/serverenvironment.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/serverenvironment.h b/src/serverenvironment.h
index 99110542a..f6c2f17fc 100644
--- a/src/serverenvironment.h
+++ b/src/serverenvironment.h
@@ -27,10 +27,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class IGameDef;
class ServerMap;
+struct GameParams;
class RemotePlayer;
+class PlayerDatabase;
class PlayerSAO;
class ServerEnvironment;
class ActiveBlockModifier;
+struct StaticObject;
class ServerActiveObject;
class Server;
class ServerScripting;
@@ -49,11 +52,10 @@ public:
virtual ~ActiveBlockModifier(){};
// Set of contents to trigger on
- virtual std::set<std::string> getTriggerContents()=0;
+ virtual const std::set<std::string> &getTriggerContents() const = 0;
// Set of required neighbors (trigger doesn't happen if none are found)
// Empty = do not check neighbors
- virtual std::set<std::string> getRequiredNeighbors()
- { return std::set<std::string>(); }
+ virtual const std::set<std::string> &getRequiredNeighbors() const = 0;
// Trigger interval in seconds
virtual float getTriggerInterval() = 0;
// Random chance of (1 / return value), 0 is disallowed
@@ -217,9 +219,11 @@ public:
// Save players
void saveLoadedPlayers();
void savePlayer(RemotePlayer *player);
- RemotePlayer *loadPlayer(const std::string &playername, PlayerSAO *sao);
+ PlayerSAO *loadPlayer(RemotePlayer *player, bool *new_player, u16 peer_id,
+ bool is_singleplayer);
void addPlayer(RemotePlayer *player);
void removePlayer(RemotePlayer *player);
+ bool removePlayerFromDatabase(const std::string &name);
/*
Save and load time of day and game timer
@@ -334,8 +338,13 @@ public:
RemotePlayer *getPlayer(const u16 peer_id);
RemotePlayer *getPlayer(const char* name);
+
+ static bool migratePlayersDatabase(const GameParams &game_params,
+ const Settings &cmd_args);
private:
+ static PlayerDatabase *openPlayerDatabase(const std::string &name,
+ const std::string &savedir, const Settings &conf);
/*
Internal ActiveObject interface
-------------------------------------------
@@ -354,7 +363,7 @@ private:
u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
/*
- Remove all objects that satisfy (m_removed && m_known_by_count==0)
+ Remove all objects that satisfy (isGone() && m_known_by_count==0)
*/
void removeRemovedObjects();
@@ -375,6 +384,14 @@ private:
void deactivateFarObjects(bool force_delete);
/*
+ A few helpers used by the three above methods
+ */
+ void deleteStaticFromBlock(
+ ServerActiveObject *obj, u16 id, u32 mod_reason, bool no_emerge);
+ bool saveStaticToBlock(v3s16 blockpos, u16 store_id,
+ ServerActiveObject *obj, const StaticObject &s_obj, u32 mod_reason);
+
+ /*
Member variables
*/
@@ -419,6 +436,8 @@ private:
// peer_ids in here should be unique, except that there may be many 0s
std::vector<RemotePlayer*> m_players;
+ PlayerDatabase *m_player_database;
+
// Particles
IntervalLimiter m_particle_management_interval;
UNORDERED_MAP<u32, float> m_particle_spawners;