﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,phab_field
1692,Small technology code cleanup,Kieran P,Jonathan Waller,"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

{{{#!js
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);
}}}",enhancement,new,Should Have,Alpha 12,UI & Simulation,,,,
