1
0
forked from mirrors/0ad

Savegame cleanup.

Remove the player assignments altogether (506350d6fa) as the C++ part
already saves the playerID.
Grab the playerID directly from the game instead of passing it around
needlessly.

This was SVN commit r18357.
This commit is contained in:
elexis
2016-06-10 19:04:57 +00:00
parent 6ba90a2555
commit c94cd66a57
5 changed files with 12 additions and 17 deletions
+3 -3
View File
@@ -304,7 +304,7 @@ JS::Value StartSavedGame(ScriptInterface::CxPrivate* pCxPrivate, const std::wstr
sim->GetScriptInterface().GetProperty(gameContextMetadata, "initAttributes", &gameInitAttributes);
int playerID;
sim->GetScriptInterface().GetProperty(gameContextMetadata, "player", playerID);
sim->GetScriptInterface().GetProperty(gameContextMetadata, "playerID", playerID);
// Start the game
g_Game->SetPlayerID(playerID);
@@ -317,14 +317,14 @@ JS::Value StartSavedGame(ScriptInterface::CxPrivate* pCxPrivate, const std::wstr
void SaveGame(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& filename, const std::wstring& description, JS::HandleValue GUIMetadata)
{
shared_ptr<ScriptInterface::StructuredClone> GUIMetadataClone = pCxPrivate->pScriptInterface->WriteStructuredClone(GUIMetadata);
if (SavedGames::Save(filename, description, *g_Game->GetSimulation2(), GUIMetadataClone, g_Game->GetPlayerID()) < 0)
if (SavedGames::Save(filename, description, *g_Game->GetSimulation2(), GUIMetadataClone) < 0)
LOGERROR("Failed to save game");
}
void SaveGamePrefix(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& prefix, const std::wstring& description, JS::HandleValue GUIMetadata)
{
shared_ptr<ScriptInterface::StructuredClone> GUIMetadataClone = pCxPrivate->pScriptInterface->WriteStructuredClone(GUIMetadata);
if (SavedGames::SavePrefix(prefix, description, *g_Game->GetSimulation2(), GUIMetadataClone, g_Game->GetPlayerID()) < 0)
if (SavedGames::SavePrefix(prefix, description, *g_Game->GetSimulation2(), GUIMetadataClone) < 0)
LOGERROR("Failed to save game");
}