____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       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"

actions.h File Reference

The actions headerfile. More...

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.


Detailed Description

The actions headerfile.

Definition in file actions.h.


Enumeration Type Documentation

Enumerator:
DiplomacyAllied  Ally with opponent.
DiplomacyNeutral  Don't attack be neutral.
DiplomacyEnemy  Attack opponent.
DiplomacyCrazy  Ally and attack opponent.

Definition at line 37 of file actions.h.


Function Documentation

void ActionStillGeneric ( CUnit unit,
bool  stand_ground 
)

void AnimateActionAttack ( CUnit unit  ) 

Handle command attack.

Animate unit attack!

Parameters:
unit Unit, for that the attack animation is played.
Todo:
manage correctly unit with no animation attack.

Definition at line 74 of file action_attack.cpp.

References CUnitType::Animations, CAnimations::Attack, FireMissile(), CUnit::Type, and UnitShowAnimation().

Referenced by ActionStillGeneric(), and AttackTarget().

void CommandAnyOrder ( CUnit unit,
COrder cpyorder,
int  flush 
)

Move an order in command queue.

Order an already formed Order structure

Parameters:
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().

void CommandAttack ( CUnit unit,
int  x,
int  y,
CUnit attack,
int  flush 
)

void CommandAttackGround ( CUnit unit,
int  x,
int  y,
int  flush 
)

Prepare command patrol.

Attack ground with unit.

Parameters:
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.

Parameters:
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.

Parameters:
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().

void CommandBoard ( CUnit unit,
CUnit dest,
int  flush 
)

Prepare command unload.

Board a transporter with unit.

Parameters:
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().

void CommandBuildBuilding ( CUnit unit,
int  x,
int  y,
CUnitType what,
int  flush 
)

Prepare command dismiss.

Send a unit building

Parameters:
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().

void CommandCancelTraining ( CUnit unit,
int  slot,
const CUnitType type 
)

Prepare command spellcast.

Cancel the training of a unit.

Parameters:
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.

Parameters:
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.

Parameters:
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().

void CommandFollow ( CUnit unit,
CUnit dest,
int  flush 
)

Prepare command move.

Follow unit to new position

Parameters:
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

Parameters:
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 ! )

Parameters:
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.

Parameters:
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.

Parameters:
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().

void CommandRepair ( CUnit unit,
int  x,
int  y,
CUnit dest,
int  flush 
)

Send auto repair command.

Repair unit

Parameters:
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().

void CommandResource ( CUnit unit,
CUnit dest,
int  flush 
)

Prepare command train.

Send unit to harvest resources

Parameters:
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.

Parameters:
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().

void CommandSpellCast ( CUnit unit,
int  x,
int  y,
CUnit dest,
SpellType spell,
int  flush 
)

Prepare command auto spellcast.

Cast a spell at position or unit.

Parameters:
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.

Parameters:
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.

Parameters:
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().

void CommandTrainUnit ( CUnit unit,
CUnitType type,
int  flush 
)

Prepare command cancel training.

Building starts training a unit.

Parameters:
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().

void CommandUnload ( CUnit unit,
int  x,
int  y,
CUnit what,
int  flush 
)

Prepare command build.

Unload a transporter.

Parameters:
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  ) 

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.

Todo:
Lets do some tries to reach the target. If target place is not reachable, choose better goal to reduce the pathfinder load.
Parameters:
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.

Todo:
FIXME: While waiting for the transporter the units must defend themselves.
Parameters:
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.

Parameters:
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  ) 

void HandleActionDie ( CUnit unit  ) 

void HandleActionFollow ( CUnit unit  ) 

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.

Parameters:
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.

Todo:
FIXME: Should do some tries to reach the end-points. Should support patrol between more points! Patrol between units.
Parameters:
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

Parameters:
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

Parameters:
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  ) 

void HandleActionStandGround ( CUnit unit  ) 

Handle command follow.

Unit stands ground!

Parameters:
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!

Parameters:
unit Unit pointer for still action.

Definition at line 233 of file action_still.cpp.

References ActionStillGeneric().

void HandleActionTrain ( CUnit unit  ) 

void HandleActionUnload ( CUnit unit  ) 

Handle command resource.

The transporter unloads a unit.

Parameters:
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   ) 

int UnitShowAnimation ( CUnit unit,
const CAnimation anim 
)

Handle the actions of all units each game cycle.

Show unit animation.

Parameters:
unit Unit of the animation.
anim Animation script to handle.
Returns:
The flags of the current script step.

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 
)

int UnloadUnit ( CUnit unit  ) 

Reappear unit on map.

Parameters:
unit Unit to drop out.
Returns:
True if unit can be unloaded.
Bug:
FIXME: Place unit only on fields reachable from the transporter

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().


Variable Documentation

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().


Generated on Sat Feb 21 00:28:15 2009 for Bos Wars by  doxygen 1.5.6