Code: Select all
float power; //indicate the relative power of the unit, used for experience calulations etc
void CUnitDefHandler::ParseTAUnit(std::string file, int id)
Code: Select all
ud.power = (ud.metalCost + ud.energyCost/60.0f);
if(ud.power<1e-3f){
...
ud.power=1e-3f;
}
Should be easy to do and very similar to the adition of mass to features (wouldn't also change anything in the inner works of Spring):
How about something like this? (it compiles)
P.S. I haven't actually checked if the max() safety is requiredCode: Select all
const string massStr = wreckParser.SGetValueDef("", name + "\\Mass"); if (massStr.empty()) { // generate the mass from the metal and health values fd->mass = (fd->metal * 0.4f) + (fd->maxHealth * 0.1f); } else { fd->mass = (float)atof(massStr.c_str()); } fd->mass = max(0.001f, fd->mass);