/* virtual */ void COrder_UpgradeTo::Execute(CUnit &unit) { AnimateActionUpgradeTo(unit); if (unit.Wait) { unit.Wait--; return ; } CPlayer &player = *unit.Player; const CUnitType &newtype = *this->Type; const CUnitStats &newstats = newtype.Stats[player.Index]; this->Ticks += player.SpeedUpgrade / SPEEDUP_FACTOR; if (this->Ticks < newstats.Costs[TimeCost]) { unit.Wait = CYCLES_PER_SECOND / 6; return ; } if (unit.Anim.Unbreakable) { this->Ticks = newstats.Costs[TimeCost]; return ; } if (TransformUnitIntoType(unit, newtype) == 0) { player.Notify(NotifyYellow, unit.tilePos, _("Upgrade to %s canceled"), newtype.Name.c_str()); this->Finished = true; return ; } player.Notify(NotifyGreen, unit.tilePos, _("Upgrade to %s complete"), unit.Type->Name.c_str()); // Warn AI. if (player.AiEnabled) { AiUpgradeToComplete(unit, newtype); } this->Finished = true; }
/* virtual */ void COrder_UpgradeTo::Execute(CUnit &unit) { AnimateActionUpgradeTo(unit); if (unit.Wait) { unit.Wait--; return ; } CPlayer &player = *unit.Player; const CUnitType &newtype = *this->Type; const CUnitStats &newstats = newtype.Stats[player.Index]; //Wyrmgus start // this->Ticks += std::max(1, player.SpeedUpgrade / SPEEDUP_FACTOR); this->Ticks += std::max(1, (player.SpeedUpgrade + unit.Variable[TIMEEFFICIENCYBONUS_INDEX].Value) / SPEEDUP_FACTOR); //Wyrmgus end if (this->Ticks < newstats.Costs[TimeCost]) { unit.Wait = CYCLES_PER_SECOND / 6; return ; } if (unit.Anim.Unbreakable) { this->Ticks = newstats.Costs[TimeCost]; return ; } if (TransformUnitIntoType(unit, newtype) == 0) { //Wyrmgus start //I think it is too much to notify the player whenever an individual upgrade is cancelled // player.Notify(NotifyYellow, unit.tilePos, _("Upgrade to %s canceled"), newtype.Name.c_str()); //Wyrmgus end this->Finished = true; return ; } //Wyrmgus start //I think it is too much to notify the player whenever an individual upgrade is completed // player.Notify(NotifyGreen, unit.tilePos, _("Upgrade to %s complete"), unit.Type->Name.c_str()); //Wyrmgus end // Warn AI. if (player.AiEnabled) { AiUpgradeToComplete(unit, newtype); } this->Finished = true; }