forked from 0ad/0ad
Fix some whitespace and remove unneeded parenthesis and brackets in the RallyPointCommands simulation helper.
This was SVN commit r18783.
This commit is contained in:
parent
8d4af29faf
commit
2e488571de
@ -10,13 +10,9 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
|||||||
// Look and see if there is a command in the rally point data, otherwise just walk there.
|
// Look and see if there is a command in the rally point data, otherwise just walk there.
|
||||||
var command = undefined;
|
var command = undefined;
|
||||||
if (data[i] && data[i].command)
|
if (data[i] && data[i].command)
|
||||||
{
|
|
||||||
command = data[i].command;
|
command = data[i].command;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
command = "walk";
|
command = "walk";
|
||||||
}
|
|
||||||
|
|
||||||
// If a target was set and the target no longer exists, or no longer
|
// If a target was set and the target no longer exists, or no longer
|
||||||
// has a valid position, then just walk to the rally point.
|
// has a valid position, then just walk to the rally point.
|
||||||
@ -24,10 +20,8 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
|||||||
{
|
{
|
||||||
var cmpPosition = Engine.QueryInterface(data[i].target, IID_Position);
|
var cmpPosition = Engine.QueryInterface(data[i].target, IID_Position);
|
||||||
if (!cmpPosition || !cmpPosition.IsInWorld())
|
if (!cmpPosition || !cmpPosition.IsInWorld())
|
||||||
{
|
|
||||||
command = "walk";
|
command = "walk";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
@ -49,7 +43,7 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
|||||||
"entities": spawnedEnts,
|
"entities": spawnedEnts,
|
||||||
"target": data[i].target,
|
"target": data[i].target,
|
||||||
"queued": true,
|
"queued": true,
|
||||||
"autocontinue": (i == rallyPos.length-1)
|
"autocontinue": i == rallyPos.length - 1
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "garrison":
|
case "garrison":
|
||||||
@ -115,9 +109,9 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
|||||||
// (we do not modify the RallyPoint before, as we want it to be displayed with all way-points)
|
// (we do not modify the RallyPoint before, as we want it to be displayed with all way-points)
|
||||||
if (ret.length > 1 && ret[ret.length-1].type == "setup-trade-route")
|
if (ret.length > 1 && ret[ret.length-1].type == "setup-trade-route")
|
||||||
{
|
{
|
||||||
|
|
||||||
var route = [];
|
var route = [];
|
||||||
var waypoints = ret.length - 1;
|
var waypoints = ret.length - 1;
|
||||||
|
|
||||||
for (var i = 0; i < waypoints; ++i)
|
for (var i = 0; i < waypoints; ++i)
|
||||||
{
|
{
|
||||||
if (ret[i].type != "walk")
|
if (ret[i].type != "walk")
|
||||||
@ -127,6 +121,7 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
|||||||
}
|
}
|
||||||
route.push({ "x": ret[i].x, "z": ret[i].z });
|
route.push({ "x": ret[i].x, "z": ret[i].z });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (route && route.length > 0)
|
if (route && route.length > 0)
|
||||||
{
|
{
|
||||||
ret.splice(0, waypoints);
|
ret.splice(0, waypoints);
|
||||||
|
Loading…
Reference in New Issue
Block a user