| 1 |
// ____ _ __ |
| 2 |
// / __ )____ _____ | | / /___ ___________ |
| 3 |
// / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ |
| 4 |
// / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) |
| 5 |
// /_____/\____/____/ |__/|__/\__,_/_/ /____/ |
| 6 |
// |
| 7 |
// A futuristic real-time strategy game. |
| 8 |
// This file is part of Bos Wars. |
| 9 |
// |
| 10 |
/**@name actions.h - The actions headerfile. */ |
| 11 |
// |
| 12 |
// (c) Copyright 1998-2007 by Lutz Sammer and Jimmy Salmon |
| 13 |
// |
| 14 |
// This program is free software; you can redistribute it and/or modify |
| 15 |
// it under the terms of the GNU General Public License as published by |
| 16 |
// the Free Software Foundation; only version 2 of the License. |
| 17 |
// |
| 18 |
// This program is distributed in the hope that it will be useful, |
| 19 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
// GNU General Public License for more details. |
| 22 |
// |
| 23 |
// You should have received a copy of the GNU General Public License |
| 24 |
// along with this program; if not, write to the Free Software |
| 25 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 26 |
// 02111-1307, USA. |
| 27 |
|
| 28 |
#ifndef __ACTIONS_H__ |
| 29 |
#define __ACTIONS_H__ |
| 30 |
|
| 31 |
//@{ |
| 32 |
|
| 33 |
/*---------------------------------------------------------------------------- |
| 34 |
-- Declarations |
| 35 |
----------------------------------------------------------------------------*/ |
| 36 |
|
| 37 |
enum _diplomacy_ { |
| 38 |
DiplomacyAllied, /// Ally with opponent |
| 39 |
DiplomacyNeutral, /// Don't attack be neutral |
| 40 |
DiplomacyEnemy, /// Attack opponent |
| 41 |
DiplomacyCrazy, /// Ally and attack opponent |
| 42 |
}; /// Diplomacy states for CommandDiplomacy |
| 43 |
|
| 44 |
class CUnit; |
| 45 |
class CUnitType; |
| 46 |
class SpellType; |
| 47 |
class COrder; |
| 48 |
class CAnimation; |
| 49 |
|
| 50 |
/*---------------------------------------------------------------------------- |
| 51 |
-- Variables |
| 52 |
----------------------------------------------------------------------------*/ |
| 53 |
|
| 54 |
extern unsigned SyncHash; /// Hash calculated to find sync failures |
| 55 |
|
| 56 |
/*---------------------------------------------------------------------------- |
| 57 |
-- Functions |
| 58 |
----------------------------------------------------------------------------*/ |
| 59 |
|
| 60 |
/*---------------------------------------------------------------------------- |
| 61 |
-- Commands: in command.c |
| 62 |
----------------------------------------------------------------------------*/ |
| 63 |
|
| 64 |
/** |
| 65 |
** This function gives a unit a new command. If the command is given |
| 66 |
** by the user the function with Send prefix should be used. |
| 67 |
*/ |
| 68 |
|
| 69 |
/// Prepare command quit |
| 70 |
extern void CommandQuit(int player); |
| 71 |
/// Prepare command stop |
| 72 |
extern void CommandStopUnit(CUnit *unit); |
| 73 |
/// Prepare command stand ground |
| 74 |
extern void CommandStandGround(CUnit *unit, int flush); |
| 75 |
/// Prepare command follow |
| 76 |
extern void CommandFollow(CUnit *unit, CUnit *dest, |
| 77 |
int flush); |
| 78 |
/// Prepare command move |
| 79 |
extern void CommandMove(CUnit *unit, int x, int y, int flush); |
| 80 |
/// Prepare command repair |
| 81 |
extern void CommandRepair(CUnit *unit, int x, int y, |
| 82 |
CUnit *dest, int flush); |
| 83 |
/// Send auto repair command |
| 84 |
extern void CommandAutoRepair(CUnit *unit, int on); |
| 85 |
/// Prepare command attack |
| 86 |
extern void CommandAttack(CUnit *unit, int x, int y, |
| 87 |
CUnit *dest, int flush); |
| 88 |
/// Prepare command attack ground |
| 89 |
extern void CommandAttackGround(CUnit *unit, int x, int y, int flush); |
| 90 |
/// Prepare command patrol |
| 91 |
extern void CommandPatrolUnit(CUnit *unit, int x, int y, int flush); |
| 92 |
/// Prepare command board |
| 93 |
extern void CommandBoard(CUnit *unit, CUnit *dest, int flush); |
| 94 |
/// Prepare command unload |
| 95 |
extern void CommandUnload(CUnit *unit, int x, int y, |
| 96 |
CUnit *what, int flush); |
| 97 |
/// Prepare command build |
| 98 |
extern void CommandBuildBuilding(CUnit *, int x, int y, |
| 99 |
CUnitType *, int); |
| 100 |
/// Prepare command dismiss |
| 101 |
extern void CommandDismiss(CUnit *unit); |
| 102 |
/// Prepare command resource |
| 103 |
extern void CommandResource(CUnit *unit, CUnit *dest, |
| 104 |
int flush); |
| 105 |
/// Prepare command train |
| 106 |
extern void CommandTrainUnit(CUnit *unit, CUnitType *what, |
| 107 |
int flush); |
| 108 |
/// Prepare command cancel training |
| 109 |
extern void CommandCancelTraining(CUnit *unit, int slot, |
| 110 |
const CUnitType *type); |
| 111 |
/// Prepare command spellcast |
| 112 |
extern void CommandSpellCast(CUnit *unit, int x, int y, |
| 113 |
CUnit *dest, SpellType *spell, int flush); |
| 114 |
/// Prepare command auto spellcast |
| 115 |
extern void CommandAutoSpellCast(CUnit *unit, int spellid, int on); |
| 116 |
/// Prepare diplomacy command |
| 117 |
extern void CommandDiplomacy(int player, int state, int opponent); |
| 118 |
/// Prepare shared vision command |
| 119 |
extern void CommandSharedVision(int player, bool state, int opponent); |
| 120 |
/// Send any command |
| 121 |
extern void CommandAnyOrder(CUnit *unit, COrder *order, int flush); |
| 122 |
/// Move an order in command queue |
| 123 |
extern void CommandMoveOrder(CUnit *unit, int src, int dst); |
| 124 |
|
| 125 |
extern bool TerrainAllowsTraining(const CUnit *trainer, const CUnitType *traineeType); |
| 126 |
|
| 127 |
/*---------------------------------------------------------------------------- |
| 128 |
-- Actions: in action_<name>.c |
| 129 |
----------------------------------------------------------------------------*/ |
| 130 |
|
| 131 |
/// Generic still action |
| 132 |
extern void ActionStillGeneric(CUnit *unit, bool stand_ground); |
| 133 |
/// Handle command still |
| 134 |
extern void HandleActionStill(CUnit *unit); |
| 135 |
/// Handle command stand ground |
| 136 |
extern void HandleActionStandGround(CUnit *unit); |
| 137 |
/// Handle command follow |
| 138 |
extern void HandleActionFollow(CUnit *unit); |
| 139 |
/// Generic move action |
| 140 |
extern int DoActionMove(CUnit *unit); |
| 141 |
/// Handle command move |
| 142 |
extern void HandleActionMove(CUnit *unit); |
| 143 |
/// Handle command repair |
| 144 |
extern void HandleActionRepair(CUnit *unit); |
| 145 |
/// Handle command patrol |
| 146 |
extern void HandleActionPatrol(CUnit *unit); |
| 147 |
/// Show attack animation |
| 148 |
extern void AnimateActionAttack(CUnit *unit); |
| 149 |
/// Handle command attack |
| 150 |
extern void HandleActionAttack(CUnit *unit); |
| 151 |
/// Handle command board |
| 152 |
extern void HandleActionBoard(CUnit *unit); |
| 153 |
/// Handle command unload |
| 154 |
extern void HandleActionUnload(CUnit *unit); |
| 155 |
/// Handle command resource |
| 156 |
extern void HandleActionResource(CUnit *unit); |
| 157 |
/// Handle command die |
| 158 |
extern void HandleActionDie(CUnit *unit); |
| 159 |
/// Handle command build |
| 160 |
extern void HandleActionBuild(CUnit *unit); |
| 161 |
/// Handle command built |
| 162 |
extern void HandleActionBuilt(CUnit *unit); |
| 163 |
/// Handle command train |
| 164 |
extern void HandleActionTrain(CUnit *unit); |
| 165 |
/// Handle command spellcast |
| 166 |
extern void HandleActionSpellCast(CUnit *unit); |
| 167 |
|
| 168 |
/*---------------------------------------------------------------------------- |
| 169 |
-- Actions: actions.c |
| 170 |
----------------------------------------------------------------------------*/ |
| 171 |
|
| 172 |
/// Handle the animation of a unit |
| 173 |
extern int UnitShowAnimationScaled(CUnit *unit, const CAnimation *anim, int scale); |
| 174 |
/// Handle the animation of a unit |
| 175 |
extern int UnitShowAnimation(CUnit *unit, const CAnimation *anim); |
| 176 |
/// Handle the actions of all units each game cycle |
| 177 |
extern void UnitActions(void); |
| 178 |
/// Unload a unit. |
| 179 |
extern int UnloadUnit(CUnit *unit); |
| 180 |
//@} |
| 181 |
|
| 182 |
#endif // !__ACTIONS_H__ |