mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 05:32:53 +00:00
Small commands.js cleanup
Differential Revision: https://code.wildfiregames.com/D1504 This was SVN commit r22311.
This commit is contained in:
@@ -530,20 +530,20 @@ var g_Commands = {
|
|||||||
|
|
||||||
"unload-template": function(player, cmd, data)
|
"unload-template": function(player, cmd, data)
|
||||||
{
|
{
|
||||||
var entities = FilterEntityListWithAllies(cmd.garrisonHolders, player, data.controlAllUnits);
|
let entities = FilterEntityListWithAllies(cmd.garrisonHolders, player, data.controlAllUnits);
|
||||||
for (let garrisonHolder of entities)
|
for (let garrisonHolder of entities)
|
||||||
{
|
{
|
||||||
var cmpGarrisonHolder = Engine.QueryInterface(garrisonHolder, IID_GarrisonHolder);
|
let cmpGarrisonHolder = Engine.QueryInterface(garrisonHolder, IID_GarrisonHolder);
|
||||||
if (cmpGarrisonHolder)
|
if (!cmpGarrisonHolder)
|
||||||
{
|
continue;
|
||||||
// Only the owner of the garrisonHolder may unload entities from any owners
|
|
||||||
if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
|
|
||||||
&& player != +cmd.owner)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|
// The owner of the garrison holder can unload entities from any players,
|
||||||
notifyUnloadFailure(player, garrisonHolder);
|
// other players can only ungarrison theirs.
|
||||||
}
|
if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits && player != +cmd.owner)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|
||||||
|
notifyUnloadFailure(player, garrisonHolder);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1479,7 +1479,7 @@ function GetFormationUnitAIs(ents, player, formationTemplate)
|
|||||||
var fid = formationIds[0];
|
var fid = formationIds[0];
|
||||||
var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|
var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|
||||||
if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|
if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|
||||||
&& cmpFormation.GetMemberCount() == formation.entities.length)
|
&& cmpFormation.GetMemberCount() == formation.entities.length)
|
||||||
{
|
{
|
||||||
cmpFormation.DeleteTwinFormations();
|
cmpFormation.DeleteTwinFormations();
|
||||||
// The whole formation was selected, so reuse its controller for this command
|
// The whole formation was selected, so reuse its controller for this command
|
||||||
|
|||||||
Reference in New Issue
Block a user