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:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user