_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commands.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 1998-2006 by Lutz Sammer and Jimmy Salmon
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __COMMANDS_H__
31 #define __COMMANDS_H__
32 
34 
35 #include "vec2i.h"
36 
37 /*----------------------------------------------------------------------------
38 -- Declarations
39 ----------------------------------------------------------------------------*/
40 
41 class CUnit;
42 class CFile;
43 class SpellType;
44 class CUnitType;
45 class CUpgrade;
46 
47 /*----------------------------------------------------------------------------
48 -- Functions
49 ----------------------------------------------------------------------------*/
50 /*----------------------------------------------------------------------------
51 -- Commands: in command.c
52 ----------------------------------------------------------------------------*/
53 
59 extern void CommandQuit(int player);
62 extern void CommandStopUnit(CUnit &unit);
64 extern void CommandStandGround(CUnit &unit, int flush);
66 extern void CommandDefend(CUnit &unit, CUnit &dest, int flush);
68 extern void CommandFollow(CUnit &unit, CUnit &dest, int flush);
70 extern void CommandMove(CUnit &unit, const Vec2i &pos, int flush);
72 extern void CommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
74 extern void CommandAutoRepair(CUnit &unit, int on);
76 extern void CommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
78 extern void CommandAttackGround(CUnit &unit, const Vec2i &pos, int flush);
80 extern void CommandPatrolUnit(CUnit &unit, const Vec2i &pos, int flush);
82 extern void CommandBoard(CUnit &unit, CUnit &dest, int flush);
84 extern void CommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush);
86 extern void CommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &, int flush);
88 extern void CommandDismiss(CUnit &unit);
90 extern void CommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush);
92 extern void CommandResource(CUnit &unit, CUnit &dest, int flush);
94 extern void CommandReturnGoods(CUnit &unit, CUnit *depot, int flush);
96 extern void CommandTrainUnit(CUnit &unit, CUnitType &what, int flush);
98 extern void CommandCancelTraining(CUnit &unit, int slot, const CUnitType *type);
100 extern void CommandUpgradeTo(CUnit &unit, CUnitType &what, int flush);
102 extern void CommandTransformIntoType(CUnit &unit, CUnitType &type);
104 extern void CommandCancelUpgradeTo(CUnit &unit);
106 extern void CommandResearch(CUnit &unit, CUpgrade &what, int flush);
108 extern void CommandCancelResearch(CUnit &unit);
110 extern void CommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush, bool isAutocast = false);
112 extern void CommandAutoSpellCast(CUnit &unit, int spellid, int on);
114 extern void CommandDiplomacy(int player, int state, int opponent);
116 extern void CommandSharedVision(int player, bool state, int opponent);
117 
118 /*
119 ** The send command functions sends a command, if needed over the
120 ** Network, this is only for user commands. Automatic reactions which
121 ** are on all computers equal, should use the functions without Send.
122 */
123 
127 typedef unsigned short UnitRef;
128 
130 extern void SendCommandStopUnit(CUnit &unit);
132 extern void SendCommandStandGround(CUnit &unit, int flush);
134 extern void SendCommandDefend(CUnit &unit, CUnit &dest, int flush);
136 extern void SendCommandFollow(CUnit &unit, CUnit &dest, int flush);
138 extern void SendCommandMove(CUnit &unit, const Vec2i &pos, int flush);
140 extern void SendCommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
142 extern void SendCommandAutoRepair(CUnit &unit, int on);
144 extern void SendCommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
146 extern void SendCommandAttackGround(CUnit &unit, const Vec2i &pos, int flush);
148 extern void SendCommandPatrol(CUnit &unit, const Vec2i &pos, int flush);
150 extern void SendCommandBoard(CUnit &unit, CUnit &dest, int flush);
152 extern void SendCommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush);
154 extern void SendCommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &what, int flush);
156 extern void SendCommandDismiss(CUnit &unit);
158 extern void SendCommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush);
160 extern void SendCommandResource(CUnit &unit, CUnit &dest, int flush);
162 extern void SendCommandReturnGoods(CUnit &unit, CUnit *dest, int flush);
164 extern void SendCommandTrainUnit(CUnit &unit, CUnitType &what, int flush);
166 extern void SendCommandCancelTraining(CUnit &unit, int slot, const CUnitType *type);
168 extern void SendCommandUpgradeTo(CUnit &unit, CUnitType &what, int flush);
170 extern void SendCommandCancelUpgradeTo(CUnit &unit);
172 extern void SendCommandResearch(CUnit &unit, CUpgrade &what, int flush);
174 extern void SendCommandCancelResearch(CUnit &unit);
176 extern void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush);
178 extern void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on);
180 extern void SendCommandDiplomacy(int player, int state, int opponent);
182 extern void SendCommandSharedVision(int player, bool state, int opponent);
183 
185 extern void ExecCommand(unsigned char type, UnitRef unum, unsigned short x,
186  unsigned short y, UnitRef dest);
188 extern void ExecExtendedCommand(unsigned char type, int status, unsigned char arg1,
189  unsigned short arg2, unsigned short arg3,
190  unsigned short arg4);
191 
192 #define FlushCommands 1
193 
194 
195 
196 #endif // !__COMMANDS_H__
void CommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
Prepare command unload.
Definition: command.cpp:460
void SendCommandBoard(CUnit &unit, CUnit &dest, int flush)
Send board command.
Definition: commands.cpp:228
void SendCommandCancelResearch(CUnit &unit)
Send cancel research command.
Definition: commands.cpp:433
void SendCommandDismiss(CUnit &unit)
Send cancel building command.
Definition: commands.cpp:279
void CommandReturnGoods(CUnit &unit, CUnit *depot, int flush)
Prepare command return.
Definition: command.cpp:591
void CommandMove(CUnit &unit, const Vec2i &pos, int flush)
Prepare command move.
Definition: command.cpp:259
void SendCommandCancelTraining(CUnit &unit, int slot, const CUnitType *type)
Send cancel training command.
Definition: commands.cpp:365
void CommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Prepare command repair.
Definition: command.cpp:289
void CommandTrainUnit(CUnit &unit, CUnitType &what, int flush)
Prepare command train.
Definition: command.cpp:623
void SendCommandCancelUpgradeTo(CUnit &unit)
Send cancel upgrade to command.
Definition: commands.cpp:399
void CommandQuit(int player)
Prepare command quit.
Definition: command.cpp:931
void SendCommandPatrol(CUnit &unit, const Vec2i &pos, int flush)
Send patrol command.
Definition: commands.cpp:211
void CommandSharedVision(int player, bool state, int opponent)
Prepare shared vision command.
Definition: command.cpp:876
void CommandAutoSpellCast(CUnit &unit, int spellid, int on)
Prepare command auto spellcast.
Definition: command.cpp:836
void CommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush)
Prepare command resource location.
Definition: command.cpp:526
void SendCommandFollow(CUnit &unit, CUnit &dest, int flush)
Send follow command.
Definition: commands.cpp:108
unsigned short UnitRef
Definition: commands.h:127
void SendCommandSharedVision(int player, bool state, int opponent)
Send shared vision command.
Definition: commands.cpp:524
void SendCommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Send repair command.
Definition: commands.cpp:143
void SendCommandAttackGround(CUnit &unit, const Vec2i &pos, int flush)
Send attack ground command.
Definition: commands.cpp:194
The big unit structure.
Definition: unit.h:119
void CommandAttackGround(CUnit &unit, const Vec2i &pos, int flush)
Prepare command attack ground.
Definition: command.cpp:368
void SendCommandDefend(CUnit &unit, CUnit &dest, int flush)
Send defend command.
Definition: commands.cpp:91
void CommandCancelUpgradeTo(CUnit &unit)
Prepare command cancel upgrade to.
Definition: command.cpp:745
void CommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush, bool isAutocast=false)
Prepare command spellcast.
Definition: command.cpp:809
void SendCommandUpgradeTo(CUnit &unit, CUnitType &what, int flush)
Send upgrade to command.
Definition: commands.cpp:384
void SendCommandAutoRepair(CUnit &unit, int on)
Send auto repair command.
Definition: commands.cpp:159
void CommandStandGround(CUnit &unit, int flush)
Prepare command stand ground.
Definition: command.cpp:181
void ExecExtendedCommand(unsigned char type, int status, unsigned char arg1, unsigned short arg2, unsigned short arg3, unsigned short arg4)
Execute an extended command (from network).
Definition: commands.cpp:764
void SendCommandTrainUnit(CUnit &unit, CUnitType &what, int flush)
Send train command.
Definition: commands.cpp:348
void CommandBoard(CUnit &unit, CUnit &dest, int flush)
Prepare command board.
Definition: command.cpp:429
Definition: unittype.h:467
Definition: iolib.h:101
void SendCommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
Send unload command.
Definition: commands.cpp:246
void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush)
Send spell cast command.
Definition: commands.cpp:453
void CommandDefend(CUnit &unit, CUnit &dest, int flush)
Prepare command defend.
Definition: command.cpp:205
void SendCommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Send attack command.
Definition: commands.cpp:177
void CommandCancelTraining(CUnit &unit, int slot, const CUnitType *type)
Prepare command cancel training.
Definition: command.cpp:657
void CommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Prepare command attack.
Definition: command.cpp:335
void SendCommandResearch(CUnit &unit, CUpgrade &what, int flush)
Send research command.
Definition: commands.cpp:417
void CommandResearch(CUnit &unit, CUpgrade &what, int flush)
Prepare command research.
Definition: command.cpp:765
void SendCommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush)
Send harvest location command.
Definition: commands.cpp:297
void CommandTransformIntoType(CUnit &unit, CUnitType &type)
immediate transforming into type.
Definition: command.cpp:730
void ExecCommand(unsigned char type, UnitRef unum, unsigned short x, unsigned short y, UnitRef dest)
Execute a command (from network).
Definition: commands.cpp:559
void SendCommandDiplomacy(int player, int state, int opponent)
Send diplomacy command.
Definition: commands.cpp:489
void SendCommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &what, int flush)
Send build building command.
Definition: commands.cpp:264
void SendCommandStandGround(CUnit &unit, int flush)
Send stand ground command.
Definition: commands.cpp:74
void SendCommandStopUnit(CUnit &unit)
Send stop command.
Definition: commands.cpp:58
void SendCommandResource(CUnit &unit, CUnit &dest, int flush)
Send harvest command.
Definition: commands.cpp:314
void SendCommandReturnGoods(CUnit &unit, CUnit *dest, int flush)
Send return goods command.
Definition: commands.cpp:331
void CommandFollow(CUnit &unit, CUnit &dest, int flush)
Prepare command follow.
Definition: command.cpp:232
void CommandResource(CUnit &unit, CUnit &dest, int flush)
Prepare command resource.
Definition: command.cpp:557
void SendCommandMove(CUnit &unit, const Vec2i &pos, int flush)
Send move command.
Definition: commands.cpp:125
void CommandStopUnit(CUnit &unit)
Prepare command stop.
Definition: command.cpp:163
void CommandUpgradeTo(CUnit &unit, CUnitType &what, int flush)
Prepare command upgrade to.
Definition: command.cpp:704
void CommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &, int flush)
Prepare command build.
Definition: command.cpp:482
void CommandDiplomacy(int player, int state, int opponent)
Prepare diplomacy command.
Definition: command.cpp:851
void CommandCancelResearch(CUnit &unit)
Prepare command cancel research.
Definition: command.cpp:787
void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on)
Send auto spell cast command.
Definition: commands.cpp:471
Definition: upgrade_structs.h:154
Definition: vec2i.h:36
void CommandAutoRepair(CUnit &unit, int on)
Send auto repair command.
Definition: command.cpp:319
void CommandPatrolUnit(CUnit &unit, const Vec2i &pos, int flush)
Prepare command patrol.
Definition: command.cpp:399
void CommandDismiss(CUnit &unit)
Prepare command dismiss.
Definition: command.cpp:507
Definition: spells.h:205
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.