1
0
forked from 0ad/0ad

Some range-based for loops.

This was SVN commit r16926.
This commit is contained in:
Nicolas Auvray 2015-08-20 12:58:41 +00:00
parent b2e8a241d2
commit ba82743777

View File

@ -159,12 +159,12 @@ public:
std::vector<SimulationCommand> newCommands;
newCommands.reserve(commands.size());
for (size_t i = 0; i < commands.size(); ++i)
for (const SimulationCommand& command : commands)
{
JSContext* cxNew = newScript.GetContext();
JSAutoRequest rqNew(cxNew);
JS::RootedValue tmpCommand(cxNew, newScript.CloneValueFromOtherContext(oldScript, commands[i].data));
SimulationCommand cmd(commands[i].player, cxNew, tmpCommand);
JS::RootedValue tmpCommand(cxNew, newScript.CloneValueFromOtherContext(oldScript, command.data));
SimulationCommand cmd(command.player, cxNew, tmpCommand);
newCommands.emplace_back(std::move(cmd));
}
return newCommands;
@ -205,9 +205,9 @@ bool CSimulation2Impl::LoadTriggerScripts(CComponentManager& componentManager, J
{
std::vector<std::string> scriptNames;
componentManager.GetScriptInterface().GetProperty(mapSettings, "TriggerScripts", scriptNames);
for (u32 i = 0; i < scriptNames.size(); ++i)
for (const std::string& triggerScript : scriptNames)
{
std::string scriptName = "maps/" + scriptNames[i];
std::string scriptName = "maps/" + triggerScript;
if (loadedScripts)
{
if (loadedScripts->find(scriptName) != loadedScripts->end())