1
0
forked from 0ad/0ad

Fix unload-all hotkey for allied buildings

Reviewed by: causative
Differential Revision: https://code.wildfiregames.com/D648
This was SVN commit r19878.
This commit is contained in:
Imarok 2017-07-06 20:51:22 +00:00
parent 9aad0137ba
commit f876eb86fa
2 changed files with 7 additions and 14 deletions

View File

@ -1755,24 +1755,17 @@ function unloadSelection()
Engine.PostNetworkCommand({ "type": "unload", "entities": ents, "garrisonHolder": parent });
}
function unloadAllByOwner()
{
var garrisonHolders = g_Selection.toList().filter(e => {
var state = GetEntityState(e);
return state && state.garrisonHolder;
});
Engine.PostNetworkCommand({ "type": "unload-all-by-owner", "garrisonHolders": garrisonHolders });
}
function unloadAll()
{
// Filter out all entities that aren't garrisonable.
var garrisonHolders = g_Selection.toList().filter(e => {
var state = GetEntityState(e);
let garrisonHolders = g_Selection.toList().filter(e => {
let state = GetEntityState(e);
return state && state.garrisonHolder;
});
Engine.PostNetworkCommand({ "type": "unload-all", "garrisonHolders": garrisonHolders });
Engine.PostNetworkCommand({
"type": controlsPlayer(GetEntityState(garrisonHolders[0]).player) ? "unload-all" : "unload-all-by-owner",
"garrisonHolders": garrisonHolders
});
}
function backToWork()

View File

@ -1372,7 +1372,7 @@ var g_AllyEntityCommands =
},
"execute": function(entState)
{
unloadAllByOwner();
unloadAll();
},
},