inline void CSelectedUnitsAI::AddUnitSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // sets the wanted speed of this unit to its max speed CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c(CMD_SET_WANTED_MAX_SPEED, options); c.AddParam(unit->moveType->GetMaxSpeed()); cai->GiveCommand(c, false); } }
inline void CSelectedUnitsAI::AddUnitSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // sets the wanted speed of this unit to its max speed CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c; c.id = CMD_SET_WANTED_MAX_SPEED; c.options = options; c.params.push_back(unit->maxSpeed); cai->GiveCommand(c, false); } }
inline void CSelectedUnitsAI::AddGroupSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // sets the wanted speed of this unit to the group minimum // (note: was being divided by GAME_SPEED, but minMaxSpeed // is already in units per frame) CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c(CMD_SET_WANTED_MAX_SPEED, options); c.AddParam(minMaxSpeed); cai->GiveCommand(c, false); } }
inline void CSelectedUnitsAI::AddGroupSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // sets the wanted speed of this unit to the group minimum CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c; c.id = CMD_SET_WANTED_MAX_SPEED; c.options = options; c.params.push_back(minMaxSpeed / 30.0f); cai->GiveCommand(c); } }
inline void CSelectedUnitsHandlerAI::AddGroupSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // sets the wanted speed of this unit to that of // the group's current-slowest member (minMaxSpeed // is derived from GetMaxSpeed, not GetMaxSpeedDef) CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c(CMD_SET_WANTED_MAX_SPEED, options, minMaxSpeed); cai->GiveCommand(c, false); } }
inline void CSelectedUnitsHandlerAI::AddUnitSetMaxSpeedCommand(CUnit* unit, unsigned char options) { // this sets the WANTED maximum speed of <unit> // (via the CommandAI --> MoveType chain) to be // equal to its current ACTUAL maximum (not the // UnitDef maximum, which can be overridden by // scripts) CCommandAI* cai = unit->commandAI; if (cai->CanSetMaxSpeed()) { Command c(CMD_SET_WANTED_MAX_SPEED, options, unit->moveType->GetMaxSpeed()); cai->GiveCommand(c, false); } }