____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
Go to the source code of this file.
Enumerations | |
| enum | _diplomacy_ { DiplomacyAllied, DiplomacyNeutral, DiplomacyEnemy, DiplomacyCrazy } |
Functions | |
| void | CommandQuit (int player) |
| < Prepare command quit | |
| void | CommandStopUnit (CUnit *unit) |
| Prepare command stand ground. | |
| void | CommandStandGround (CUnit *unit, int flush) |
| Prepare command follow. | |
| void | CommandFollow (CUnit *unit, CUnit *dest, int flush) |
| Prepare command move. | |
| void | CommandMove (CUnit *unit, int x, int y, int flush) |
| Prepare command repair. | |
| void | CommandRepair (CUnit *unit, int x, int y, CUnit *dest, int flush) |
| Send auto repair command. | |
| void | CommandAutoRepair (CUnit *unit, int on) |
| Prepare command attack. | |
| void | CommandAttack (CUnit *unit, int x, int y, CUnit *dest, int flush) |
| Prepare command attack ground. | |
| void | CommandAttackGround (CUnit *unit, int x, int y, int flush) |
| Prepare command patrol. | |
| void | CommandPatrolUnit (CUnit *unit, int x, int y, int flush) |
| Prepare command board. | |
| void | CommandBoard (CUnit *unit, CUnit *dest, int flush) |
| Prepare command unload. | |
| void | CommandUnload (CUnit *unit, int x, int y, CUnit *what, int flush) |
| Prepare command build. | |
| void | CommandBuildBuilding (CUnit *, int x, int y, CUnitType *, int) |
| Prepare command dismiss. | |
| void | CommandDismiss (CUnit *unit) |
| Prepare command resource. | |
| void | CommandResource (CUnit *unit, CUnit *dest, int flush) |
| Prepare command train. | |
| void | CommandTrainUnit (CUnit *unit, CUnitType *what, int flush) |
| Prepare command cancel training. | |
| void | CommandCancelTraining (CUnit *unit, int slot, const CUnitType *type) |
| Prepare command spellcast. | |
| void | CommandSpellCast (CUnit *unit, int x, int y, CUnit *dest, SpellType *spell, int flush) |
| Prepare command auto spellcast. | |
| void | CommandAutoSpellCast (CUnit *unit, int spellid, int on) |
| Prepare diplomacy command. | |
| void | CommandDiplomacy (int player, int state, int opponent) |
| Prepare shared vision command. | |
| void | CommandSharedVision (int player, bool state, int opponent) |
| Send any command. | |
| void | CommandAnyOrder (CUnit *unit, COrder *order, int flush) |
| Move an order in command queue. | |
| void | CommandMoveOrder (CUnit *unit, int src, int dst) |
| void | ActionStillGeneric (CUnit *unit, bool stand_ground) |
| < Generic still action | |
| void | HandleActionStill (CUnit *unit) |
| Handle command stand ground. | |
| void | HandleActionStandGround (CUnit *unit) |
| Handle command follow. | |
| void | HandleActionFollow (CUnit *unit) |
| Generic move action. | |
| int | DoActionMove (CUnit *unit) |
| Handle command move. | |
| void | HandleActionMove (CUnit *unit) |
| Handle command repair. | |
| void | HandleActionRepair (CUnit *unit) |
| Handle command patrol. | |
| void | HandleActionPatrol (CUnit *unit) |
| Show attack animation. | |
| void | AnimateActionAttack (CUnit *unit) |
| Handle command attack. | |
| void | HandleActionAttack (CUnit *unit) |
| Handle command board. | |
| void | HandleActionBoard (CUnit *unit) |
| Handle command unload. | |
| void | HandleActionUnload (CUnit *unit) |
| Handle command resource. | |
| void | HandleActionResource (CUnit *unit) |
| Handle command die. | |
| void | HandleActionDie (CUnit *unit) |
| Handle command build. | |
| void | HandleActionBuild (CUnit *unit) |
| Handle command built. | |
| void | HandleActionBuilt (CUnit *unit) |
| Handle command train. | |
| void | HandleActionTrain (CUnit *unit) |
| Handle command spellcast. | |
| void | HandleActionSpellCast (CUnit *unit) |
| int | UnitShowAnimationScaled (CUnit *unit, const CAnimation *anim, int scale) |
| < Handle the animation of a unit | |
| int | UnitShowAnimation (CUnit *unit, const CAnimation *anim) |
| Handle the actions of all units each game cycle. | |
| void | UnitActions (void) |
| Unload a unit. | |
| int | UnloadUnit (CUnit *unit) |
Variables | |
| unsigned | SyncHash |
| Hash calculated to find sync failures. | |
Definition in file actions.h.
| enum _diplomacy_ |
| void ActionStillGeneric | ( | CUnit * | unit, | |
| bool | stand_ground | |||
| ) |
< Generic still action
Handle command still
Unit stands still or stand ground.
| unit | Unit pointer for action. | |
| stand_ground | true if unit is standing ground. |
Definition at line 193 of file action_still.cpp.
References CUnitType::AirUnit, CUnit::Anim, AnimateActionAttack(), CUnitType::Animations, CUnitType::AttackFromTransporter, AutoAttack(), AutoCast(), AutoRepair(), CUnitType::CanTransport, MissileType::Class, CUnit::Container, CUnit::IY, MissileConfig::Missile, CUnitType::Missile, MissileClassNone, MyRand, CUnit::Removed, CUnitType::SeaUnit, CAnimations::Still, CUnit::SubAction, CUnit::Type, CUnit::_unit_anim_::Unbreakable, and UnitShowAnimation().
Referenced by HandleActionStandGround(), and HandleActionStill().
| void AnimateActionAttack | ( | CUnit * | unit | ) |
Handle command attack.
Animate unit attack!
| unit | Unit, for that the attack animation is played. |
Definition at line 74 of file action_attack.cpp.
References CUnitType::Animations, CAnimations::Attack, FireMissile(), CUnit::Type, and UnitShowAnimation().
Referenced by ActionStillGeneric(), and AttackTarget().
Move an order in command queue.
Order an already formed Order structure
| unit | pointer to unit | |
| cpyorder | pointer to valid order | |
| flush | if true, flush command queue. |
Definition at line 194 of file command.cpp.
References ClearSavedAction(), GetNextOrder(), COrder::Goal, and CUnit::RefsIncrease().
Prepare command attack ground.
Attack with unit at new position
| unit | pointer to unit. | |
| x | X map position to attack. | |
| y | Y map position to attack. | |
| attack | or unit to be attacked. | |
| flush | if true, flush command queue. |
Definition at line 418 of file command.cpp.
References COrder::Action, Assert, ATTACKRANGE_INDEX, CUnitType::CanAttack, ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, CMap::Info, COrder::Init(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CVariable::Max, CUnitType::MinAttackRange, COrder::MinRange, CUnit::NewOrder, CUnit::Orders, COrder::Range, CUnit::RefsIncrease(), ReleaseOrder(), CUnit::Removed, CUnit::Stats, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, UnitActionAttack, UnitActionDie, CUnitStats::Variables, CUnit::X, COrder::X, CUnit::Y, and COrder::Y.
Referenced by AiAttackWithForce(), AiAttackWithForceAt(), AiForceAttacks(), AutoAttack(), CclOrderUnit(), HandleActionFollow(), HandleActionPatrol(), HitUnit(), ParseCommand(), and SendCommandAttack().
| void CommandAttackGround | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Prepare command patrol.
Attack ground with unit.
| unit | pointer to unit. | |
| x | X map position to fire on. | |
| y | Y map position to fire on. | |
| flush | if true, flush command queue. |
Definition at line 470 of file command.cpp.
References COrder::Action, Assert, ATTACKRANGE_INDEX, CUnitType::Building, ClearSavedAction(), DebugPrint, GetNextOrder(), CMap::Info, COrder::Init(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CVariable::Max, CUnitType::MinAttackRange, COrder::MinRange, CUnit::NewOrder, CUnit::Orders, COrder::Range, ReleaseOrder(), CUnit::Removed, CUnit::Stats, CUnit::Type, UnitActionAttackGround, UnitActionDie, CUnitStats::Variables, COrder::X, and COrder::Y.
Referenced by ParseCommand(), and SendCommandAttackGround().
| void CommandAutoRepair | ( | CUnit * | unit, | |
| int | on | |||
| ) |
Prepare command attack.
Auto repair.
| unit | pointer to unit. | |
| on | 1 for auto repair on, 0 for off. |
Definition at line 399 of file command.cpp.
References CUnit::AutoRepair, CUnit::Orders, CUnit::Removed, and UnitActionDie.
Referenced by ParseCommand(), and SendCommandAutoRepair().
| void CommandAutoSpellCast | ( | CUnit * | unit, | |
| int | spellid, | |||
| int | on | |||
| ) |
Prepare diplomacy command.
Auto spell cast.
| unit | pointer to unit. | |
| spellid | Spell id. | |
| on | 1 for auto cast on, 0 for off. |
Definition at line 887 of file command.cpp.
References CUnit::AutoCastSpell, CUnit::Orders, CUnit::Removed, and UnitActionDie.
Referenced by ParseCommand(), and SendCommandAutoSpellCast().
Prepare command unload.
Board a transporter with unit.
| unit | pointer to unit. | |
| dest | unit to be boarded. | |
| flush | if true, flush command queue. |
Definition at line 546 of file command.cpp.
References COrder::Action, CUnitType::Building, ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, COrder::Init(), CUnit::NewOrder, CUnit::Orders, COrder::Range, CUnit::RefsIncrease(), ReleaseOrder(), CUnit::Removed, CUnit::Type, UnitActionBoard, and UnitActionDie.
Referenced by ParseCommand(), and SendCommandBoard().
Prepare command dismiss.
Send a unit building
| unit | pointer to unit. | |
| x | X map position to build. | |
| y | Y map position to build. | |
| what | Unit type to build. | |
| flush | if true, flush command queue. |
Definition at line 627 of file command.cpp.
References COrder::Action, CUnitType::BuilderOutside, CUnitType::Building, ClearSavedAction(), GetNextOrder(), COrder::Height, COrder::Init(), COrder::MinRange, CUnit::NewOrder, CUnit::Orders, COrder::Range, ReleaseOrder(), CUnit::Removed, CUnitType::RepairRange, CUnitType::ShoreBuilding, CUnitType::TileHeight, CUnitType::TileWidth, COrder::Type, CUnit::Type, UnitActionBuild, UnitActionDie, CUnitType::UnitType, UnitTypeLand, COrder::Width, COrder::X, and COrder::Y.
Referenced by AiBuildBuilding(), ParseCommand(), and SendCommandBuildBuilding().
Prepare command spellcast.
Cancel the training of a unit.
| unit | pointer to unit. | |
| slot | slot number to cancel. | |
| type | Unit-type to cancel. |
Definition at line 766 of file command.cpp.
References _C_, ClearSavedAction(), CUnit::Data, DebugPrint, CUnitType::Ident, CUnit::OrderCount, CUnit::Orders, CUnit::Player, CPlayer::RemoveFromUnitsConsumingResources(), RemoveOrder(), CUnit::Selected, SelectedUnitChanged(), ThisPlayer, CUnit::_order_data_::_order_train_::Ticks, CUnit::_order_data_::Train, and UnitActionTrain.
Referenced by ParseCommand(), and SendCommandCancelTraining().
| void CommandDiplomacy | ( | int | player, | |
| int | state, | |||
| int | opponent | |||
| ) |
Prepare shared vision command.
Diplomacy changed.
| player | Player which changes his state. | |
| state | New diplomacy state. | |
| opponent | Opponent. |
Definition at line 904 of file command.cpp.
References CPlayer::Allied, DiplomacyAllied, DiplomacyCrazy, DiplomacyEnemy, DiplomacyNeutral, CPlayer::Enemy, and Players.
Referenced by GameTypeFreeForAll(), GameTypeLeftVsRight(), GameTypeManTeamVsMachine(), GameTypeManVsMachine(), GameTypeTopVsBottom(), ParseExtendedCommand(), and SendCommandDiplomacy().
| void CommandDismiss | ( | CUnit * | unit | ) |
Prepare command resource.
Cancel the building construction, or kill a unit.
| unit | pointer to unit. |
Definition at line 672 of file command.cpp.
References CUnit::_order_data_::Built, CUnit::_order_data_::_order_built_::Cancel, ClearSavedAction(), CUnit::Data, DebugPrint, LetUnitDie(), CUnit::Orders, and UnitActionBuilt.
Referenced by ParseCommand(), and SendCommandDismiss().
Prepare command move.
Follow unit to new position
| unit | pointer to unit. | |
| dest | unit to be followed | |
| flush | if true, flush command queue. |
Definition at line 275 of file command.cpp.
References COrder::Action, CanMove(), ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, COrder::Init(), CUnit::NewOrder, CUnit::Orders, COrder::Range, CUnit::RefsIncrease(), ReleaseOrder(), CUnit::Removed, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, UnitActionDie, UnitActionFollow, CUnit::X, COrder::X, CUnit::Y, and COrder::Y.
Referenced by ParseCommand(), and SendCommandFollow().
| void CommandMove | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Prepare command repair.
Move unit to new position
| unit | pointer to unit. | |
| x | X map position to move to. | |
| y | Y map position to move to. | |
| flush | if true, flush command queue. |
Definition at line 318 of file command.cpp.
References COrder::Action, Assert, CanMove(), ClearSavedAction(), GetNextOrder(), CMap::Info, COrder::Init(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnit::NewOrder, CUnit::Orders, ReleaseOrder(), CUnit::Removed, UnitActionDie, UnitActionMove, COrder::X, and COrder::Y.
Referenced by AiAttackWithForce(), AiAttackWithForceAt(), AiForceAttacks(), AiMoveUnitInTheWay(), AiSendExplorers(), CclOrderUnit(), HitUnit(), ParseCommand(), and SendCommandMove().
| void CommandMoveOrder | ( | CUnit * | unit, | |
| int | src, | |||
| int | dst | |||
| ) |
Move an order in the order queue. ( Cannot move the order 0 ! )
| unit | pointer to unit | |
| src | the order to move | |
| dst | the new position of the order |
Definition at line 217 of file command.cpp.
References Assert, and CUnit::Orders.
| void CommandPatrolUnit | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Prepare command board.
Let a unit patrol from current to new position
FIXME: want to support patroling between units.
| unit | pointer to unit. | |
| x | X map position to patrol between. | |
| y | Y map position to patrol between. | |
| flush | if true, flush command queue. |
Definition at line 510 of file command.cpp.
References COrder::Action, COrder::Arg1, Assert, CanMove(), ClearSavedAction(), GetNextOrder(), CMap::Info, COrder::Init(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnit::NewOrder, CUnit::Orders, COrder::Patrol, ReleaseOrder(), CUnit::Removed, UnitActionDie, UnitActionPatrol, CUnit::X, COrder::X, CUnit::Y, and COrder::Y.
Referenced by CclOrderUnit(), ParseCommand(), and SendCommandPatrol().
| void CommandQuit | ( | int | player | ) |
< Prepare command quit
This function gives a unit a new command. If the command is given by the user the function with Send prefix should be used. Prepare command stop
Player quit.
| player | Player number that quit. |
Definition at line 995 of file command.cpp.
References _, CPlayer::Allied, ChangeTeamSelectedUnits(), CommandSharedVision(), CPlayer::Enemy, NumPlayers, PlayerNeutral, Players, SetMessage(), and CPlayer::Type.
Referenced by DoNextReplay(), and ParseNetworkCommand().
Send auto repair command.
Repair unit
| unit | pointer to unit. | |
| x | X map position to repair. | |
| y | Y map position to repair. | |
| dest | or unit to be repaired. FIXME: not supported | |
| flush | if true, flush command queue. |
Definition at line 353 of file command.cpp.
References COrder::Action, CUnitType::Building, ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, COrder::Init(), CUnit::NewOrder, CUnit::Orders, COrder::Range, CUnit::RefsIncrease(), ReleaseOrder(), CUnit::Removed, CUnitType::RepairRange, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, UnitActionDie, UnitActionRepair, CUnit::X, COrder::X, CUnit::Y, and COrder::Y.
Referenced by AiRepairBuilding(), AutoRepair(), ParseCommand(), and SendCommandRepair().
Prepare command train.
Send unit to harvest resources
| unit | pointer to unit. | |
| dest | destination unit. | |
| flush | if true, flush command queue. |
Definition at line 693 of file command.cpp.
References COrder::Action, CUnitType::Building, ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, CUnitType::Harvester, COrder::Init(), CUnit::NewOrder, CUnit::Orders, COrder::Range, CUnit::RefsIncrease(), ReleaseOrder(), CUnit::Removed, CUnit::Type, UnitActionDie, and UnitActionResource.
Referenced by AiAssignHarvester(), HandleActionBuilt(), ParseCommand(), and SendCommandResource().
| void CommandSharedVision | ( | int | player, | |
| bool | state, | |||
| int | opponent | |||
| ) |
Send any command.
Shared vision changed.
| player | Player which changes his state. | |
| state | New shared vision state. | |
| opponent | Opponent. |
Definition at line 934 of file command.cpp.
References CMap::Field(), CMap::Info, CPlayer::IsBothSharedVision(), Map, CMapInfo::MapHeight, MapMarkUnitSight(), MapUnmarkUnitSight(), CMapInfo::MapWidth, NumUnits, Players, CPlayer::SharedVision, Units, CMapField::Visible, and y.
Referenced by CommandQuit(), ParseExtendedCommand(), and SendCommandSharedVision().
Prepare command auto spellcast.
Cast a spell at position or unit.
| unit | Pointer to unit. | |
| x | X map position to spell cast on. | |
| y | Y map position to spell cast on. | |
| dest | Spell cast on unit (if exist). | |
| spell | Spell type pointer. | |
| flush | If true, flush command queue. |
Definition at line 830 of file command.cpp.
References _C_, COrder::Action, COrder::Arg1, Assert, CUnitType::CanCastSpell, ClearSavedAction(), DebugPrint, CUnit::Destroyed, GetNextOrder(), COrder::Goal, SpellType::Ident, CMap::Info, COrder::Init(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnit::Orders, SpellType::Range, COrder::Range, CUnit::RefsIncrease(), CUnit::Removed, SpellType::Slot, COrder::Spell, CUnit::Type, UnitActionDie, UnitActionSpellCast, UnitNumber, CUnit::X, COrder::X, CUnit::Y, and COrder::Y.
Referenced by AutoCastSpell(), ParseCommand(), and SendCommandSpellCast().
| void CommandStandGround | ( | CUnit * | unit, | |
| int | flush | |||
| ) |
Prepare command follow.
Stand ground.
| unit | pointer to unit. | |
| flush | if true, flush command queue. |
Definition at line 250 of file command.cpp.
References COrder::Action, CUnitType::Building, ClearSavedAction(), GetNextOrder(), COrder::Init(), CUnit::NewOrder, ReleaseOrder(), CUnit::Type, and UnitActionStandGround.
Referenced by ParseCommand(), and SendCommandStandGround().
| void CommandStopUnit | ( | CUnit * | unit | ) |
Prepare command stand ground.
Stop unit.
| unit | pointer to unit. |
Definition at line 171 of file command.cpp.
References COrder::Action, Assert, FlushCommands, GetNextOrder(), COrder::Init(), CUnit::NewOrder, ReleaseOrder(), CUnit::SavedOrder, and UnitActionStill.
Referenced by HitUnit(), ParseCommand(), and SendCommandStopUnit().
Prepare command cancel training.
Building starts training a unit.
| unit | pointer to unit. | |
| type | unit type to train. | |
| flush | if true, flush command queue. |
Definition at line 732 of file command.cpp.
References COrder::Action, CPlayer::CheckLimits(), ClearSavedAction(), GetNextOrder(), COrder::Init(), CUnit::Orders, CUnit::Player, CUnit::Removed, COrder::Type, UnitActionDie, and UnitActionTrain.
Referenced by AiTrainUnit(), ParseCommand(), and SendCommandTrainUnit().
Prepare command build.
Unload a transporter.
| unit | pointer to unit. | |
| x | X map position to unload. | |
| y | Y map position to unload. | |
| what | unit to be unloaded, NoUnitP all. | |
| flush | if true, flush command queue. |
Definition at line 589 of file command.cpp.
References COrder::Action, ClearSavedAction(), CUnit::Destroyed, GetNextOrder(), COrder::Goal, COrder::Init(), CUnit::Orders, CUnit::RefsIncrease(), CUnit::Removed, UnitActionDie, UnitActionUnload, COrder::X, and COrder::Y.
Referenced by ParseCommand(), and SendCommandUnload().
| int DoActionMove | ( | CUnit * | unit | ) |
Handle command move.
Unit moves! Generic function called from other actions.
| unit | Pointer to unit. |
Definition at line 84 of file action_move.cpp.
References AiCanNotMove(), CPlayer::AiEnabled, CUnit::Anim, CUnitType::Animations, Assert, CancelBuildingMode(), CanMove(), CUnitType::CanTransport, CMap::CoastOnMap(), CMapField::Cost, CUnit::_unit_anim_::CurrAnim, CUnit::Data, CUnit::Direction, CMap::Field(), CUnit::Frame, Heading2X, Heading2Y, CMap::IsFieldVisible(), CUnit::IX, CUnit::IY, CUnit::_order_data_::_order_move_::Length, Map, MarkUnitFieldFlags(), CUnit::_order_data_::Move, CAnimations::Move, CUnit::MoveToXY(), CUnit::Moving, NextDirection, NextPathElement(), NumSelected, PF_REACHED, PF_UNREACHABLE, PF_WAIT, CUnit::Player, PlayUnitSound(), ReplayRevealMap, CUnit::Selected, SelectionChanged(), CUnitType::StillFrame, ThisPlayer, TileSizeX, TileSizeY, CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitHeadingFromDeltaXY(), UnitShowAnimationScaled(), UnitUpdateHeading(), UnmarkUnitFieldFlags(), UnSelectUnit(), VoiceDocking, CUnit::Wait, CUnit::_unit_anim_::Wait, CMap::WaterOnMap(), CUnit::X, CUnit::Y, and y.
Referenced by HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), MoveToDropZone(), MoveToLocation(), MoveToResource(), MoveToTarget(), MoveToTransporter(), and SpellMoveToTarget().
| void HandleActionAttack | ( | CUnit * | unit | ) |
Handle command board.
Unit attacks!
I added a little trick, if SubAction&WEAK_TARGET is true the goal is a weak goal. This means the unit AI (little AI) could choose a new better goal.
| unit | Unit, for that the attack is handled. |
Definition at line 464 of file action_attack.cpp.
References COrder::Action, Assert, ATTACK_TARGET, ATTACKRANGE_INDEX, AttackTarget(), CanMove(), CheckForTargetInRange(), DebugPrint, COrder::Goal, MapDistanceBetweenUnits(), CUnitType::MinAttackRange, MOVE_TO_TARGET, MoveToTarget(), NewResetPath, NoUnitP, CUnit::Orders, CUnit::SavedOrder, CUnit::State, CUnit::SubAction, CUnit::Type, UnitActionAttack, UnitActionAttackGround, UnitActionStill, UnitHeadingFromDeltaXY(), CUnit::Wait, WEAK_TARGET, CUnit::X, and CUnit::Y.
| void HandleActionBoard | ( | CUnit * | unit | ) |
Handle command unload.
The unit boards a transporter.
| unit | Pointer to unit. |
Definition at line 185 of file action_board.cpp.
References CUnitType::Animations, CUnit::ClearAction(), EnterTransporter(), CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, MoveToTransporter(), NewResetPath, NoUnitP, CUnit::Orders, PF_REACHED, PF_UNREACHABLE, CUnit::RefsDecrease(), CAnimations::Still, CUnit::SubAction, CUnit::Type, UnitShowAnimation(), CUnit::Wait, and WaitForTransporter().
| void HandleActionBuild | ( | CUnit * | unit | ) |
Handle command built.
Unit builds a building.
| unit | Unit that builds a building |
Definition at line 346 of file action_build.cpp.
References CheckCanBuild(), MoveToLocation(), StartBuilding(), and CUnit::SubAction.
| void HandleActionBuilt | ( | CUnit * | unit | ) |
Handle command train.
Unit under Construction
| unit | Unit that is being built |
Definition at line 366 of file action_build.cpp.
References _, _C_, CPlayer::AiEnabled, AiWorkComplete(), CUnitType::BuilderLost, CUnitType::BuilderOutside, CUnit::_order_data_::Built, CUnit::_order_data_::_order_built_::Cancel, CUnit::ClearAction(), CommandResource(), CUnit::Constructed, CUnit::CurrentSightRange, CUnit::Data, DebugPrint, CUnit::Direction, DropOutOnSide(), EnergyCost, CUnit::Frame, GetProductionCost(), CUnitType::Harvester, HP_INDEX, IsOnlySelected, LetUnitDie(), LookingW, MagmaCost, MapMarkUnitSight(), CVariable::Max, MyRand, CUnitType::Name, CPlayer::Notify(), NotifyGreen, NoUnitP, CUnitType::NumDirections, CUnit::Player, PlayUnitSound(), CUnit::_order_data_::_order_built_::Progress, CUnitSound::Ready, CPlayer::RemoveFromUnitsConsumingResources(), SelectedUnitChanged(), SIGHTRANGE_INDEX, CUnitType::Slot, SoundConfig::Sound, CUnitType::Sound, SpeedBuild, CUnit::Stats, CUnitType::StillFrame, ThisPlayer, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CPlayer::UnitsConsumingResourcesActual, CPlayer::UnitTypesCount, UnitUpdateHeading(), UpdateConstructionFrame(), UpdateForNewUnit(), CVariable::Value, CUnit::Variable, CUnitStats::Variables, VoiceBuilding, VoiceReady, VoiceWorkCompleted, CUnit::_order_data_::_order_built_::Worker, CUnit::X, and CUnit::Y.
| void HandleActionDie | ( | CUnit * | unit | ) |
Handle command build.
Unit dies!
| unit | The unit which dies. |
Definition at line 55 of file action_die.cpp.
References CUnit::Anim, CUnitType::Animations, Assert, CUnitType::CorpseType, CUnit::CurrentSightRange, CAnimations::Death, CUnit::Frame, CPlayer::Index, MapMarkUnitSight(), MapUnmarkUnitSight(), CVariable::Max, CUnit::Orders, CUnit::Player, CUnit::Release(), CUnit::Remove(), SIGHTRANGE_INDEX, CUnitType::Stats, CUnit::SubAction, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitActionDie, UnitShowAnimation(), UnitUpdateHeading(), and CUnitStats::Variables.
| void HandleActionFollow | ( | CUnit * | unit | ) |
Generic move action.
Unit follow action:
| unit | Pointer to unit. |
Definition at line 60 of file action_follow.cpp.
References CUnit::Anim, Assert, AttackUnitsInReactRange(), CUnitType::CanAttack, CUnit::ClearAction(), CommandAttack(), DebugPrint, DoActionMove(), FlushCommands, CUnit::Frame, CMap::Info, CUnit::IsVisibleAsGoal(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, NewResetPath, NoUnitP, CUnit::OrderCount, CUnit::Orders, PF_REACHED, PF_UNREACHABLE, CUnit::Player, CUnit::RefsDecrease(), CUnit::SavedOrder, CUnit::State, CUnitType::StillFrame, CUnit::SubAction, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitActionAttack, UnitActionStill, UnitUpdateHeading(), CUnit::Wait, CUnit::X, and CUnit::Y.
| void HandleActionMove | ( | CUnit * | unit | ) |
Handle command repair.
Unit move action:
Move to a place or to a unit (can move). Tries 10x to reach the target, note this are the complete tries. If the target entered another unit, move to it's position. If the target unit is destroyed, continue to move to it's last position.
| unit | Pointer to unit. |
Definition at line 190 of file action_move.cpp.
References Assert, CanMove(), CUnit::ClearAction(), DebugPrint, CUnit::Destroyed, DoActionMove(), CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, NewResetPath, NoUnitP, CUnit::Orders, PF_REACHED, PF_UNREACHABLE, CUnit::RefsDecrease(), CUnit::State, CUnit::SubAction, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::Wait, CUnit::X, and CUnit::Y.
| void HandleActionPatrol | ( | CUnit * | unit | ) |
Show attack animation.
Unit Patrol: The unit patrols between two points. Any enemy unit in reaction range is attacked.
| unit | Patroling unit pointer. |
Definition at line 80 of file action_patrol.cpp.
References _C_, CUnit::Anim, AttackUnitsInReactRange(), AutoRepair(), CUnitType::CanAttack, CUnit::ClearAction(), CommandAttack(), DebugPrint, DoActionMove(), FlushCommands, CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, NewResetPath, NoUnitP, CUnit::Orders, PF_FAILED, PF_REACHED, PF_UNREACHABLE, PF_WAIT, CUnit::SavedOrder, CUnit::SubAction, SwapPatrolPoints(), CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitNumber, CUnit::Wait, CUnit::X, and CUnit::Y.
| void HandleActionRepair | ( | CUnit * | unit | ) |
Handle command patrol.
Unit repairs
| unit | Unit that's doing the repairing |
Definition at line 307 of file action_repair.cpp.
References MoveToLocation(), RepairUnit(), and CUnit::SubAction.
| void HandleActionResource | ( | CUnit * | unit | ) |
Handle command die.
Control the unit action: getting a resource.
This is the generic function for harvesting resources
| unit | Pointer to unit. |
Definition at line 282 of file action_resource.cpp.
References CUnit::_order_data_::_order_harvest_::CurrentProduction, CUnit::Data, GatherResource(), CUnit::_order_data_::Harvest, MoveToResource(), NewResetPath, CUnit::Orders, ResourceGiveUp(), StartGathering(), SUB_GATHER_RESOURCE, SUB_MOVE_TO_RESOURCE, SUB_START_GATHERING, SUB_START_RESOURCE, SUB_UNREACHABLE_RESOURCE, CUnit::SubAction, and CUnit::Wait.
| void HandleActionSpellCast | ( | CUnit * | unit | ) |
Unit casts a spell!
| unit | Unit, for that the spell cast is handled. |
Definition at line 146 of file action_spellcast.cpp.
References _, CPlayer::AiEnabled, CUnit::Anim, CUnitType::Animations, CAnimations::Attack, CanCastSpell(), CUnit::ClearAction(), DebugPrint, INFINITE_RANGE, MANA_INDEX, SpellType::ManaCost, SpellType::Name, CUnitType::Name, NewResetPath, CPlayer::Notify(), NotifyYellow, NoUnitP, CUnit::Orders, CUnit::Player, CUnit::ReCast, SpellCast(), SpellMoveToTarget(), CUnit::SubAction, CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitActionDie, UnitShowAnimation(), CVariable::Value, CUnit::Variable, CUnit::Wait, CUnit::X, and CUnit::Y.
| void HandleActionStandGround | ( | CUnit * | unit | ) |
Handle command follow.
Unit stands ground!
| unit | Action handled for this unit pointer. |
Definition at line 50 of file action_stand.cpp.
References ActionStillGeneric().
| void HandleActionStill | ( | CUnit * | unit | ) |
Handle command stand ground.
Unit stands still!
| unit | Unit pointer for still action. |
Definition at line 233 of file action_still.cpp.
References ActionStillGeneric().
| void HandleActionTrain | ( | CUnit * | unit | ) |
Handle command spellcast.
Unit trains unit!
| unit | Unit that trains. |
Definition at line 97 of file action_train.cpp.
References _, COrder::Action, CPlayer::AddToUnitsConsumingResources(), CPlayer::AiEnabled, AiNeedMoreSupply(), AiTrainingComplete(), CUnitType::Animations, CUserInterface::ButtonPanel, CalculateRequestedAmount(), CanHandleOrder(), CPlayer::CheckLimits(), CUnit::ClearAction(), CYCLES_PER_SECOND, CUnit::Data, DebugPrint, CUnitType::DecayRate, CUnit::Destroyed, DropOutOnSide(), EnergyCost, GameCycle, GetProductionCost(), COrder::Goal, IsOnlySelected, LookingW, MagmaCost, MakeUnit(), MaxCosts, CUnitType::Name, CUnit::NewOrder, CPlayer::Notify(), NotifyYellow, NoUnitP, NumUnits, CUnit::OrderCount, CUnit::OrderFlush, CUnit::Orders, CUnit::Player, PlayUnitSound(), CUnit::RefsDecrease(), CPlayer::RemoveFromUnitsConsumingResources(), SpeedTrain, CAnimations::Still, CUnit::SubAction, ThisPlayer, CUnit::_order_data_::_order_train_::Ticks, CUnitType::TileHeight, CUnitType::TileWidth, CAnimations::Train, CUnit::_order_data_::Train, CUnit::TTL, CUnit::Type, UI, UnitActionMove, UnitActionStill, UnitMax, CPlayer::UnitsConsumingResourcesActual, UnitShowAnimation(), CButtonPanel::Update(), UpdateForNewUnit(), VoiceReady, CUnit::Wait, CUnit::X, and CUnit::Y.
| void HandleActionUnload | ( | CUnit * | unit | ) |
Handle command resource.
The transporter unloads a unit.
| unit | Pointer to unit. |
Definition at line 375 of file action_unload.cpp.
References CanMove(), CUnit::ClearAction(), ClosestFreeDropZone(), HandleActionUnload(), LeaveTransporter(), MoveToDropZone(), NewResetPath, CUnit::Orders, PF_REACHED, CUnit::SubAction, UnitActionStill, and y.
Referenced by HandleActionUnload().
| void UnitActions | ( | void | ) |
Unload a unit.
Update the actions of all units each game cycle.
Definition at line 412 of file actions.cpp.
References CUnit::Blink, CYCLES_PER_SECOND, CMapInfo::Description, GameCycle, HandleBuffs(), HandleRegenerations(), HandleUnitAction(), CUnitType::Ident, CPlayer::Index, CMap::Info, CUnit::IX, CUnit::IY, Map, NumUnits, CUnit::Orders, CUnit::Player, CUnit::Refs, sprintf_s(), CUnit::State, CUnit::SubAction, SyncHash, SyncRandSeed, ThisPlayer, CUnit::Type, UnitMax, UnitNumber, Units, VERSION, CUnit::X, and CUnit::Y.
Referenced by GameMainLoop().
| int UnitShowAnimation | ( | CUnit * | unit, | |
| const CAnimation * | anim | |||
| ) |
Handle the actions of all units each game cycle.
Show unit animation.
| unit | Unit of the animation. | |
| anim | Animation script to handle. |
Definition at line 87 of file actions.cpp.
References UnitShowAnimationScaled().
Referenced by ActionStillGeneric(), AnimateActionAttack(), AnimateActionHarvest(), AnimateActionRepair(), HandleActionBoard(), HandleActionDie(), HandleActionSpellCast(), and HandleActionTrain().
| int UnitShowAnimationScaled | ( | CUnit * | unit, | |
| const CAnimation * | anim, | |||
| int | scale | |||
| ) |
< Handle the animation of a unit
Handle the animation of a unit
Show unit animation.
| unit | Unit of the animation. | |
| anim | Animation script to handle. | |
| scale | Scaling factor of the wait times in animation (8 means no scaling). |
Definition at line 101 of file actions.cpp.
References CUnit::_unit_anim_::Anim, CUnit::Anim, AnimationAttack, AnimationExactFrame, AnimationFrame, AnimationGoto, AnimationLabel, AnimationMove, AnimationNone, AnimationRandomFrame, AnimationRandomGoto, AnimationRandomRotate, AnimationRandomSound, AnimationRandomWait, AnimationRotate, AnimationSound, AnimationUnbreakable, AnimationWait, Assert, CUnit::_unit_anim_::CurrAnim, CAnimation::D, FireMissile(), CAnimation::Frame, CUnit::Frame, CAnimation::Goto, CUnit::IsVisible(), CAnimation::Move, CAnimation::Next, CUnit::Orders, CUnit::Player, PlayUnitSound(), CAnimation::RandomFrame, CAnimation::RandomGoto, CAnimation::RandomSound, CAnimation::RandomWait, CUnit::ReCast, ReplayRevealMap, CAnimation::Rotate, CSound::Sound, CAnimation::Sound, SpellCast(), SyncRand(), ThisPlayer, CAnimation::Type, CAnimation::Unbreakable, CUnit::_unit_anim_::Unbreakable, UnitActionSpellCast, UnitRotate(), UnitUpdateHeading(), CAnimation::Wait, and CUnit::_unit_anim_::Wait.
Referenced by DoActionMove(), and UnitShowAnimation().
| int UnloadUnit | ( | CUnit * | unit | ) |
Reappear unit on map.
| unit | Unit to drop out. |
Definition at line 140 of file action_unload.cpp.
References Assert, CUnit::Boarded, FindUnloadPosition(), CUnitType::MovementMask, CUnit::Place(), CUnit::Removed, CUnit::Type, CUnit::X, CUnit::Y, and y.
Referenced by LeaveTransporter().
| unsigned SyncHash |
Hash calculated to find sync failures.
Definition at line 57 of file actions.cpp.
Referenced by CclSavedGameInfo(), CreateGame(), InitModules(), LoadGame(), NetworkSendCommands(), SaveGame(), and UnitActions().
1.5.6