Multiplayer saved games

Enables to save multiplayer games.
When the savegame is loaded, the settings are frozen (except the non-AI-player assignment settings).
This commit is contained in:
phosit
2024-08-31 10:54:56 +02:00
committed by phosit
parent 20b4937ffd
commit b90280855f
42 changed files with 542 additions and 199 deletions
+11
View File
@@ -237,6 +237,8 @@ public:
void SendStartGameMessage(const CStr& initAttribs);
void SendStartSavedGameMessage(const CStr& initAttribs, const CStr& savedState);
/**
* Call when the client (player or observer) has sent a flare.
*/
@@ -283,6 +285,7 @@ private:
static bool OnPlayerAssignment(CNetClient* client, CFsmEvent* event);
static bool OnInGame(CNetClient* client, CFsmEvent* event);
static bool OnGameStart(CNetClient* client, CFsmEvent* event);
static bool OnSavedGameStart(CNetClient* client, CFsmEvent* event);
static bool OnJoinSyncStart(CNetClient* client, CFsmEvent* event);
static bool OnJoinSyncEndCommandBatch(CNetClient* client, CFsmEvent* event);
static bool OnFlare(CNetClient* client, CFsmEvent* event);
@@ -299,6 +302,12 @@ private:
*/
void SetAndOwnSession(CNetClientSession* session);
/**
* Starts a game with the specified init attributes and saved state. Called
* by the start game and start saved game callbacks.
*/
void StartGame(const JS::MutableHandleValue initAttributes, const std::string& savedState);
/**
* Push a message onto the GUI queue listing the current player assignments.
*/
@@ -349,6 +358,8 @@ private:
/// Serialized game state received when joining an in-progress game
std::string m_JoinSyncBuffer;
std::string m_SavedState;
/// Time when the server was last checked for timeouts and bad latency
std::time_t m_LastConnectionCheck;
};