Changeset View
Standalone View
source/ps/GameSetup/GameSetup.cpp
Show First 20 Lines • Show All 1,149 Lines • ▼ Show 20 Lines | |||||
* -autostart-aiseed=AISEED sets the seed used for the AI random | * -autostart-aiseed=AISEED sets the seed used for the AI random | ||||
* generator (default 0, use -1 for random) | * generator (default 0, use -1 for random) | ||||
* -autostart-civ=PLAYER:CIV sets PLAYER's civilisation to CIV | * -autostart-civ=PLAYER:CIV sets PLAYER's civilisation to CIV | ||||
* (skirmish and random maps only) | * (skirmish and random maps only) | ||||
* -autostart-team=PLAYER:TEAM sets the team for PLAYER (e.g. 2:2). | * -autostart-team=PLAYER:TEAM sets the team for PLAYER (e.g. 2:2). | ||||
* -autostart-nonvisual disable any graphics and sounds | * -autostart-nonvisual disable any graphics and sounds | ||||
* -autostart-victory=SCRIPTNAME sets the victory conditions with SCRIPTNAME | * -autostart-victory=SCRIPTNAME sets the victory conditions with SCRIPTNAME | ||||
* located in simulation/data/settings/victory_conditions/ | * located in simulation/data/settings/victory_conditions/ | ||||
* (default conquest) | * (default none) | ||||
elexis: Wasn't this recently changed to conquest because endless as default was reported as a bug? | |||||
Not Done Inline Actionshmmm yes, but I don't see an alternative without hardcoding defaults and still allowing endless games, we could update the trac page though bb: hmmm yes, but I don't see an alternative without hardcoding defaults and still allowing endless… | |||||
Done Inline ActionsSo rP21108 gets a concern raised because it removed endless game support, this patch leaves the conquest default in order not to revert the default which was the intention of that commit and someone adds few lines testing for "endless" explicitly here? Or convince everyone that the ticket was a won't-fix to begin with? elexis: So rP21108 gets a concern raised because it removed endless game support, this patch leaves the… | |||||
Not Done Inline Actions(I consider that hardcoding defaults, but ok) bb: (I consider that hardcoding defaults, but ok) | |||||
* -autostart-wonderduration=NUM sets the victory duration NUM for wonder victory conditions | * -autostart-wonderduration=NUM sets the victory duration NUM for wonder victory conditions | ||||
* (default 10 minutes) | * (default 10 minutes) | ||||
* -autostart-relicduration=NUM sets the victory duration NUM for relic victory conditions | * -autostart-relicduration=NUM sets the victory duration NUM for relic victory conditions | ||||
* (default 10 minutes) | * (default 10 minutes) | ||||
* | * | ||||
* Multiplayer: | * Multiplayer: | ||||
* -autostart-playername=NAME sets local player NAME (default 'anonymous') | * -autostart-playername=NAME sets local player NAME (default 'anonymous') | ||||
* -autostart-host sets multiplayer host mode | * -autostart-host sets multiplayer host mode | ||||
▲ Show 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | bool Autostart(const CmdLineArgs& args) | ||||
} | } | ||||
if (nonVisual) | if (nonVisual) | ||||
{ | { | ||||
CStr nonVisualScript = "scripts/NonVisualTrigger.js"; | CStr nonVisualScript = "scripts/NonVisualTrigger.js"; | ||||
triggerScriptsVector.push_back(nonVisualScript.FromUTF8()); | triggerScriptsVector.push_back(nonVisualScript.FromUTF8()); | ||||
} | } | ||||
CStr victory = "conquest"; | std::vector<CStr> victoryConditions; | ||||
if (args.Has("autostart-victory")) | if (args.Has("autostart-victory")) | ||||
victory = args.Get("autostart-victory"); | victoryConditions = args.GetMultiple("autostart-victory"); | ||||
scriptInterface.SetProperty(settings, "GameType", std::string(victory)); | scriptInterface.SetProperty(settings, "VictoryConditions", victoryConditions); | ||||
CStrW scriptPath = L"simulation/data/settings/victory_conditions/" + victory.FromUTF8() + L".json"; | for (CStr victory : victoryConditions) | ||||
{ | |||||
JS::RootedValue scriptData(cx); | JS::RootedValue scriptData(cx); | ||||
JS::RootedValue data(cx); | JS::RootedValue data(cx); | ||||
JS::RootedValue victoryScripts(cx); | JS::RootedValue victoryScripts(cx); | ||||
CStrW scriptPath = L"simulation/data/settings/victory_conditions/" + victory.FromUTF8() + L".json"; | |||||
Not Done Inline Actions(wstring_from_utf8 is more common IIRC, but no problem to use the OOP way) elexis: (`wstring_from_utf8` is more common IIRC, but no problem to use the OOP way) | |||||
Not Done Inline Actions(92 matches for FromUTF8 in source/, 64 wstring_from_utf8. elexis: (92 matches for `FromUTF8` in `source/`, 64 `wstring_from_utf8`.
68 ToUtf8, 160… | |||||
scriptInterface.ReadJSONFile(scriptPath, &scriptData); | scriptInterface.ReadJSONFile(scriptPath, &scriptData); | ||||
if (!scriptData.isUndefined() && scriptInterface.GetProperty(scriptData, "Data", &data) && !data.isUndefined() | if (!scriptData.isUndefined() && scriptInterface.GetProperty(scriptData, "Data", &data) && !data.isUndefined() | ||||
&& scriptInterface.GetProperty(data, "Scripts", &victoryScripts) && !victoryScripts.isUndefined()) | && scriptInterface.GetProperty(data, "Scripts", &victoryScripts) && !victoryScripts.isUndefined()) | ||||
{ | { | ||||
std::vector<CStrW> victoryScriptsVector; | std::vector<CStrW> victoryScriptsVector; | ||||
FromJSVal_vector(cx, victoryScripts, victoryScriptsVector); | FromJSVal_vector(cx, victoryScripts, victoryScriptsVector); | ||||
triggerScriptsVector.insert(triggerScriptsVector.end(), victoryScriptsVector.begin(), victoryScriptsVector.end()); | triggerScriptsVector.insert(triggerScriptsVector.end(), victoryScriptsVector.begin(), victoryScriptsVector.end()); | ||||
} | } | ||||
Done Inline Actionsrange based loop afaics elexis: range based loop afaics | |||||
Not Done Inline ActionsSome more loops in this file could use that bb: Some more loops in this file could use that | |||||
Done Inline Actionsconst ref elexis: const ref | |||||
Done Inline Actions& elexis: & | |||||
} | |||||
ToJSVal_vector(cx, &triggerScripts, triggerScriptsVector); | ToJSVal_vector(cx, &triggerScripts, triggerScriptsVector); | ||||
scriptInterface.SetProperty(settings, "TriggerScripts", triggerScripts); | scriptInterface.SetProperty(settings, "TriggerScripts", triggerScripts); | ||||
int wonderDuration = 10; | int wonderDuration = 10; | ||||
if (args.Has("autostart-wonderduration")) | if (args.Has("autostart-wonderduration")) | ||||
wonderDuration = args.Get("autostart-wonderduration").ToInt(); | wonderDuration = args.Get("autostart-wonderduration").ToInt(); | ||||
scriptInterface.SetProperty(settings, "WonderDuration", wonderDuration); | scriptInterface.SetProperty(settings, "WonderDuration", wonderDuration); | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
Wasn't this recently changed to conquest because endless as default was reported as a bug?