Changeset View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 1,434 Lines • ▼ Show 20 Lines | function someCanPatrol(entities) | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Keep in sync with Commands.js. | * Keep in sync with Commands.js. | ||||
*/ | */ | ||||
function isUndeletable(entState) | function isUndeletable(entState) | ||||
{ | { | ||||
if (g_DevSettings.controlAll) | if (g_DeveloperOverlay.isControlAll()) | ||||
elexis: It's not really a state of the DeveloperOverlay, but of the simulation, but I guess one doesn't… | |||||
Done Inline ActionsWhy not to create a separate global function then, like IsControlAll()? vladislavbelov: Why not to create a separate global function then, like `IsControlAll()`? | |||||
Not Done Inline ActionsOne could rename it IsControllingAllEntities IsControllingAll Stan: One could rename it IsControllingAllEntities IsControllingAll | |||||
Not Done Inline Actions
The idea was to reduce the number of global functions if possible to use OOP. It depends on where the function would be located, either it in this file (developer overlay manager) or in the file for the simulation state (SimulationState.prototype/class or something for OOP and a global near GetSimState for procedural style). Also if introducing function calls, even if it's only one, have to consider the long-term performance impact in the gui session. (canControlAllEntities, isControlAllEntitiesModeEnabled, isControlAll, isControlAllEnabled, whatever) elexis: > Why not to create a separate global function then, like IsControlAll()?
The idea was to… | |||||
Done Inline Actions
Yes, but the overlay is mostly about UI. And it might be strange to ask the UI about the simulation state. vladislavbelov: > The idea was to reduce the number of global functions if possible to use OOP.
Yes, but the… | |||||
Not Done Inline ActionsJust leave as is with that one possibly unneeded variable and minimize when refactoring the SimState thing? elexis: Just leave as is with that one possibly unneeded variable and minimize when refactoring the… | |||||
return false; | return false; | ||||
if (entState.resourceSupply && entState.resourceSupply.killBeforeGather) | if (entState.resourceSupply && entState.resourceSupply.killBeforeGather) | ||||
return translate("The entity has to be killed before it can be gathered from"); | return translate("The entity has to be killed before it can be gathered from"); | ||||
if (entState.capturePoints && entState.capturePoints[entState.player] < entState.maxCapturePoints / 2) | if (entState.capturePoints && entState.capturePoints[entState.player] < entState.maxCapturePoints / 2) | ||||
return translate("You cannot destroy this entity as you own less than half the capture points"); | return translate("You cannot destroy this entity as you own less than half the capture points"); | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
It's not really a state of the DeveloperOverlay, but of the simulation, but I guess one doesn't have to be anal about it