Small technology code cleanup
Extract the if (cmpTechMan) conditional and code into a global helper function.
Also, make the whole tech engine take arguments in this order: entity/player, tech type, current value
function ApplyTechModificationsToEntity(entity, tech_type, current_value) {
var cmpTechMan = QueryOwnerInterface(entity, IID_TechnologyManager);
if (!cmpTechMan)
return current_value;
return cmpTechMan.ApplyModifications(entity, tech_type, current_value);
}
function ApplyTechModificationsToPlayer(player_entity, tech_type, current_value) {
var cmpTechMan = Engine.QueryInterface(player_entity, IID_TechnologyManager);
if (!cmpTechMan)
return current_value;
return cmpTechMan.ApplyModifications(player_entity, tech_type, current_value);
}
ApplyTechModificationsToEntity(this.entity, "Health/Max", +this.template.Max);
ApplyTechModificationsToPlayer(this.entity, "Player/MaxPopulation", +this.template.MaxPopulation);
Change History
(10)
Component: |
Core engine → UI & Simulation
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Milestone: |
Alpha 12 → Backlog
|
Milestone: |
Backlog → Alpha 13
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
In 13056: