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

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 CommandExplore(CUnit &unit, int flush);
90 extern void CommandDismiss(CUnit &unit);
92 extern void CommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush);
94 extern void CommandResource(CUnit &unit, CUnit &dest, int flush);
96 extern void CommandReturnGoods(CUnit &unit, CUnit *depot, int flush);
98 extern void CommandTrainUnit(CUnit &unit, CUnitType &what, int flush);
100 extern void CommandCancelTraining(CUnit &unit, int slot, const CUnitType *type);
102 extern void CommandUpgradeTo(CUnit &unit, CUnitType &what, int flush, bool instant = false);
104 extern void CommandTransformIntoType(CUnit &unit, CUnitType &type);
106 extern void CommandCancelUpgradeTo(CUnit &unit);
108 extern void CommandResearch(CUnit &unit, CUpgrade &what, int flush);
110 extern void CommandCancelResearch(CUnit &unit);
112 extern void CommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush, bool isAutocast = false);
114 extern void CommandAutoSpellCast(CUnit &unit, int spellid, int on);
116 extern void CommandDiplomacy(int player, int state, int opponent);
118 extern void CommandSharedVision(int player, bool state, int opponent);
119 
120 /*
121 ** The send command functions sends a command, if needed over the
122 ** Network, this is only for user commands. Automatic reactions which
123 ** are on all computers equal, should use the functions without Send.
124 */
125 
129 typedef unsigned short UnitRef;
130 
132 extern void SendCommandStopUnit(CUnit &unit);
134 extern void SendCommandStandGround(CUnit &unit, int flush);
136 extern void SendCommandDefend(CUnit &unit, CUnit &dest, int flush);
138 extern void SendCommandFollow(CUnit &unit, CUnit &dest, int flush);
140 extern void SendCommandMove(CUnit &unit, const Vec2i &pos, int flush);
142 extern void SendCommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
144 extern void SendCommandAutoRepair(CUnit &unit, int on);
146 extern void SendCommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush);
148 extern void SendCommandAttackGround(CUnit &unit, const Vec2i &pos, int flush);
150 extern void SendCommandPatrol(CUnit &unit, const Vec2i &pos, int flush);
152 extern void SendCommandBoard(CUnit &unit, CUnit &dest, int flush);
154 extern void SendCommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush);
156 extern void SendCommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &what, int flush);
158 extern void SendCommandExplore(CUnit &unit, int flush);
160 extern void SendCommandDismiss(CUnit &unit);
162 extern void SendCommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush);
164 extern void SendCommandResource(CUnit &unit, CUnit &dest, int flush);
166 extern void SendCommandReturnGoods(CUnit &unit, CUnit *dest, int flush);
168 extern void SendCommandTrainUnit(CUnit &unit, CUnitType &what, int flush);
170 extern void SendCommandCancelTraining(CUnit &unit, int slot, const CUnitType *type);
172 extern void SendCommandUpgradeTo(CUnit &unit, CUnitType &what, int flush);
174 extern void SendCommandCancelUpgradeTo(CUnit &unit);
176 extern void SendCommandResearch(CUnit &unit, CUpgrade &what, int flush);
178 extern void SendCommandCancelResearch(CUnit &unit);
180 extern void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush);
182 extern void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on);
184 extern void SendCommandDiplomacy(int player, int state, int opponent);
186 extern void SendCommandSharedVision(int player, bool state, int opponent);
187 
189 extern void ExecCommand(unsigned char type, UnitRef unum, unsigned short x,
190  unsigned short y, UnitRef dest);
192 extern void ExecExtendedCommand(unsigned char type, int status, unsigned char arg1,
193  unsigned short arg2, unsigned short arg3,
194  unsigned short arg4);
195 
196 #define FlushCommands 1
197 
198 
199 
200 #endif // !__COMMANDS_H__
SendCommandStandGround
void SendCommandStandGround(CUnit &unit, int flush)
Send stand ground command.
Definition: commands.cpp:75
CommandCancelTraining
void CommandCancelTraining(CUnit &unit, int slot, const CUnitType *type)
Prepare command cancel training.
Definition: command.cpp:700
SendCommandAutoRepair
void SendCommandAutoRepair(CUnit &unit, int on)
Send auto repair command.
Definition: commands.cpp:160
CommandStopUnit
void CommandStopUnit(CUnit &unit)
Prepare command stop.
Definition: command.cpp:166
CommandCancelResearch
void CommandCancelResearch(CUnit &unit)
Prepare command cancel research.
Definition: command.cpp:830
CommandMove
void CommandMove(CUnit &unit, const Vec2i &pos, int flush)
Prepare command move.
Definition: command.cpp:262
SendCommandDiplomacy
void SendCommandDiplomacy(int player, int state, int opponent)
Send diplomacy command.
Definition: commands.cpp:506
SendCommandUpgradeTo
void SendCommandUpgradeTo(CUnit &unit, CUnitType &what, int flush)
Send upgrade to command.
Definition: commands.cpp:401
SendCommandTrainUnit
void SendCommandTrainUnit(CUnit &unit, CUnitType &what, int flush)
Send train command.
Definition: commands.cpp:365
CommandUnload
void CommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
Prepare command unload.
Definition: command.cpp:476
CommandFollow
void CommandFollow(CUnit &unit, CUnit &dest, int flush)
Prepare command follow.
Definition: command.cpp:235
CommandQuit
void CommandQuit(int player)
Prepare command quit.
Definition: command.cpp:970
SendCommandUnload
void SendCommandUnload(CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
Send unload command.
Definition: commands.cpp:247
vec2i.h
SendCommandExplore
void SendCommandExplore(CUnit &unit, int flush)
Send explore command.
Definition: commands.cpp:281
SendCommandFollow
void SendCommandFollow(CUnit &unit, CUnit &dest, int flush)
Send follow command.
Definition: commands.cpp:109
SendCommandBuildBuilding
void SendCommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &what, int flush)
Send build building command.
Definition: commands.cpp:265
SendCommandDefend
void SendCommandDefend(CUnit &unit, CUnit &dest, int flush)
Send defend command.
Definition: commands.cpp:92
CommandTrainUnit
void CommandTrainUnit(CUnit &unit, CUnitType &what, int flush)
Prepare command train.
Definition: command.cpp:666
CUnitType
Definition: unittype.h:508
CommandAttack
void CommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Prepare command attack.
Definition: command.cpp:338
Vec2T
Definition: vec2i.h:36
SendCommandCancelTraining
void SendCommandCancelTraining(CUnit &unit, int slot, const CUnitType *type)
Send cancel training command.
Definition: commands.cpp:382
CommandResearch
void CommandResearch(CUnit &unit, CUpgrade &what, int flush)
Prepare command research.
Definition: command.cpp:808
CommandBuildBuilding
void CommandBuildBuilding(CUnit &unit, const Vec2i &pos, CUnitType &, int flush)
Prepare command build.
Definition: command.cpp:498
CUpgrade
Definition: upgrade_structs.h:154
SendCommandStopUnit
void SendCommandStopUnit(CUnit &unit)
Send stop command.
Definition: commands.cpp:59
CommandDismiss
void CommandDismiss(CUnit &unit)
Prepare command dismiss.
Definition: command.cpp:550
SendCommandSpellCast
void SendCommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush)
Send spell cast command.
Definition: commands.cpp:470
SendCommandRepair
void SendCommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Send repair command.
Definition: commands.cpp:144
CommandCancelUpgradeTo
void CommandCancelUpgradeTo(CUnit &unit)
Prepare command cancel upgrade to.
Definition: command.cpp:788
ExecExtendedCommand
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:785
CommandResourceLoc
void CommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush)
Prepare command resource location.
Definition: command.cpp:569
CommandPatrolUnit
void CommandPatrolUnit(CUnit &unit, const Vec2i &pos, int flush)
Prepare command patrol.
Definition: command.cpp:402
SendCommandDismiss
void SendCommandDismiss(CUnit &unit)
Send cancel building command.
Definition: commands.cpp:296
SendCommandCancelResearch
void SendCommandCancelResearch(CUnit &unit)
Send cancel research command.
Definition: commands.cpp:450
SendCommandAttackGround
void SendCommandAttackGround(CUnit &unit, const Vec2i &pos, int flush)
Send attack ground command.
Definition: commands.cpp:195
ExecCommand
void ExecCommand(unsigned char type, UnitRef unum, unsigned short x, unsigned short y, UnitRef dest)
Execute a command (from network).
Definition: commands.cpp:576
SendCommandCancelUpgradeTo
void SendCommandCancelUpgradeTo(CUnit &unit)
Send cancel upgrade to command.
Definition: commands.cpp:416
CommandStandGround
void CommandStandGround(CUnit &unit, int flush)
Prepare command stand ground.
Definition: command.cpp:184
SendCommandPatrol
void SendCommandPatrol(CUnit &unit, const Vec2i &pos, int flush)
Send patrol command.
Definition: commands.cpp:212
CommandResource
void CommandResource(CUnit &unit, CUnit &dest, int flush)
Prepare command resource.
Definition: command.cpp:600
SendCommandAttack
void SendCommandAttack(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Send attack command.
Definition: commands.cpp:178
CommandSharedVision
void CommandSharedVision(int player, bool state, int opponent)
Prepare shared vision command.
Definition: command.cpp:919
SendCommandSharedVision
void SendCommandSharedVision(int player, bool state, int opponent)
Send shared vision command.
Definition: commands.cpp:541
SendCommandResource
void SendCommandResource(CUnit &unit, CUnit &dest, int flush)
Send harvest command.
Definition: commands.cpp:331
SendCommandResourceLoc
void SendCommandResourceLoc(CUnit &unit, const Vec2i &pos, int flush)
Send harvest location command.
Definition: commands.cpp:314
SendCommandAutoSpellCast
void SendCommandAutoSpellCast(CUnit &unit, int spellid, int on)
Send auto spell cast command.
Definition: commands.cpp:488
SendCommandReturnGoods
void SendCommandReturnGoods(CUnit &unit, CUnit *dest, int flush)
Send return goods command.
Definition: commands.cpp:348
CommandDiplomacy
void CommandDiplomacy(int player, int state, int opponent)
Prepare diplomacy command.
Definition: command.cpp:894
SendCommandBoard
void SendCommandBoard(CUnit &unit, CUnit &dest, int flush)
Send board command.
Definition: commands.cpp:229
CommandBoard
void CommandBoard(CUnit &unit, CUnit &dest, int flush)
Prepare command board.
Definition: command.cpp:445
SendCommandMove
void SendCommandMove(CUnit &unit, const Vec2i &pos, int flush)
Send move command.
Definition: commands.cpp:126
CommandAutoRepair
void CommandAutoRepair(CUnit &unit, int on)
Send auto repair command.
Definition: command.cpp:322
CommandAttackGround
void CommandAttackGround(CUnit &unit, const Vec2i &pos, int flush)
Prepare command attack ground.
Definition: command.cpp:371
CommandUpgradeTo
void CommandUpgradeTo(CUnit &unit, CUnitType &what, int flush, bool instant=false)
Prepare command upgrade to.
Definition: command.cpp:747
UnitRef
unsigned short UnitRef
Definition: commands.h:129
SendCommandResearch
void SendCommandResearch(CUnit &unit, CUpgrade &what, int flush)
Send research command.
Definition: commands.cpp:434
CommandDefend
void CommandDefend(CUnit &unit, CUnit &dest, int flush)
Prepare command defend.
Definition: command.cpp:208
CommandAutoSpellCast
void CommandAutoSpellCast(CUnit &unit, int spellid, int on)
Prepare command auto spellcast.
Definition: command.cpp:879
CommandReturnGoods
void CommandReturnGoods(CUnit &unit, CUnit *depot, int flush)
Prepare command return.
Definition: command.cpp:634
CommandExplore
void CommandExplore(CUnit &unit, int flush)
Prepare command explore.
Definition: command.cpp:524
CommandRepair
void CommandRepair(CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
Prepare command repair.
Definition: command.cpp:292
SpellType
Definition: spells.h:205
CFile
Definition: iolib.h:102
CUnit
The big unit structure.
Definition: unit.h:135
CommandTransformIntoType
void CommandTransformIntoType(CUnit &unit, CUnitType &type)
immediate transforming into type.
Definition: command.cpp:773
CommandSpellCast
void CommandSpellCast(CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush, bool isAutocast=false)
Prepare command spellcast.
Definition: command.cpp:852
(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.