1
0
forked from 0ad/0ad

Adds missing attributes when using autostart-random (caused undefined variable warning in saved games list).

This was SVN commit r10869.
This commit is contained in:
historic_bruno 2012-01-04 22:48:32 +00:00
parent 10527b4551
commit 29a8f01254

View File

@ -1050,7 +1050,8 @@ bool Autostart(const CmdLineArgs& args)
}
// Random map definition will be loaded from JSON file, so we need to parse it
std::wstring scriptPath = L"maps/random/" + autoStartName.FromUTF8() + L".json";
std::wstring mapPath = L"maps/random/";
std::wstring scriptPath = mapPath + autoStartName.FromUTF8() + L".json";
CScriptValRooted scriptData = scriptInterface.ReadJSONFile(scriptPath);
if (!scriptData.undefined() && scriptInterface.GetProperty(scriptData.get(), "settings", settings))
{
@ -1074,6 +1075,8 @@ bool Autostart(const CmdLineArgs& args)
mapSize = size.ToUInt();
}
scriptInterface.SetProperty(attrs.get(), "map", std::string(autoStartName));
scriptInterface.SetProperty(attrs.get(), "mapPath", mapPath);
scriptInterface.SetProperty(attrs.get(), "mapType", std::string("random"));
scriptInterface.SetProperty(settings.get(), "Seed", seed); // Random seed
scriptInterface.SetProperty(settings.get(), "Size", mapSize); // Random map size (in patches)