_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "vec2i.h"
Go to the source code of this file.
commands.h - The commands header file. | |
#define | FlushCommands 1 |
typedef unsigned short | UnitRef |
void | CommandQuit (int player) |
Prepare command quit. More... | |
void | CommandStopUnit (CUnit &unit) |
Prepare command stop. More... | |
void | CommandStandGround (CUnit &unit, int flush) |
Prepare command stand ground. More... | |
void | CommandDefend (CUnit &unit, CUnit &dest, int flush) |
Prepare command defend. More... | |
void | CommandFollow (CUnit &unit, CUnit &dest, int flush) |
Prepare command follow. More... | |
void | CommandMove (CUnit &unit, const Vec2i &pos, int flush) |
Prepare command move. More... | |
void | CommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush) |
Prepare command repair. More... | |
void | CommandAutoRepair (CUnit &unit, int on) |
Send auto repair command. More... | |
void | CommandAttack (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush) |
Prepare command attack. More... | |
void | CommandAttackGround (CUnit &unit, const Vec2i &pos, int flush) |
Prepare command attack ground. More... | |
void | CommandPatrolUnit (CUnit &unit, const Vec2i &pos, int flush) |
Prepare command patrol. More... | |
void | CommandBoard (CUnit &unit, CUnit &dest, int flush) |
Prepare command board. More... | |
void | CommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush) |
Prepare command unload. More... | |
void | CommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &, int flush) |
Prepare command build. More... | |
void | CommandExplore (CUnit &unit, int flush) |
Prepare command explore. More... | |
void | CommandDismiss (CUnit &unit) |
Prepare command dismiss. More... | |
void | CommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush) |
Prepare command resource location. More... | |
void | CommandResource (CUnit &unit, CUnit &dest, int flush) |
Prepare command resource. More... | |
void | CommandReturnGoods (CUnit &unit, CUnit *depot, int flush) |
Prepare command return. More... | |
void | CommandTrainUnit (CUnit &unit, CUnitType &what, int flush) |
Prepare command train. More... | |
void | CommandCancelTraining (CUnit &unit, int slot, const CUnitType *type) |
Prepare command cancel training. More... | |
void | CommandUpgradeTo (CUnit &unit, CUnitType &what, int flush, bool instant=false) |
Prepare command upgrade to. More... | |
void | CommandTransformIntoType (CUnit &unit, CUnitType &type) |
immediate transforming into type. More... | |
void | CommandCancelUpgradeTo (CUnit &unit) |
Prepare command cancel upgrade to. More... | |
void | CommandResearch (CUnit &unit, CUpgrade &what, int flush) |
Prepare command research. More... | |
void | CommandCancelResearch (CUnit &unit) |
Prepare command cancel research. More... | |
void | CommandSpellCast (CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush, bool isAutocast=false) |
Prepare command spellcast. More... | |
void | CommandAutoSpellCast (CUnit &unit, int spellid, int on) |
Prepare command auto spellcast. More... | |
void | CommandDiplomacy (int player, int state, int opponent) |
Prepare diplomacy command. More... | |
void | CommandSharedVision (int player, bool state, int opponent) |
Prepare shared vision command. More... | |
void | SendCommandStopUnit (CUnit &unit) |
Send stop command. More... | |
void | SendCommandStandGround (CUnit &unit, int flush) |
Send stand ground command. More... | |
void | SendCommandDefend (CUnit &unit, CUnit &dest, int flush) |
Send defend command. More... | |
void | SendCommandFollow (CUnit &unit, CUnit &dest, int flush) |
Send follow command. More... | |
void | SendCommandMove (CUnit &unit, const Vec2i &pos, int flush) |
Send move command. More... | |
void | SendCommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush) |
Send repair command. More... | |
void | SendCommandAutoRepair (CUnit &unit, int on) |
Send auto repair command. More... | |
void | SendCommandAttack (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush) |
Send attack command. More... | |
void | SendCommandAttackGround (CUnit &unit, const Vec2i &pos, int flush) |
Send attack ground command. More... | |
void | SendCommandPatrol (CUnit &unit, const Vec2i &pos, int flush) |
Send patrol command. More... | |
void | SendCommandBoard (CUnit &unit, CUnit &dest, int flush) |
Send board command. More... | |
void | SendCommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush) |
Send unload command. More... | |
void | SendCommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &what, int flush) |
Send build building command. More... | |
void | SendCommandExplore (CUnit &unit, int flush) |
Send explore command. More... | |
void | SendCommandDismiss (CUnit &unit) |
Send cancel building command. More... | |
void | SendCommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush) |
Send harvest location command. More... | |
void | SendCommandResource (CUnit &unit, CUnit &dest, int flush) |
Send harvest command. More... | |
void | SendCommandReturnGoods (CUnit &unit, CUnit *dest, int flush) |
Send return goods command. More... | |
void | SendCommandTrainUnit (CUnit &unit, CUnitType &what, int flush) |
Send train command. More... | |
void | SendCommandCancelTraining (CUnit &unit, int slot, const CUnitType *type) |
Send cancel training command. More... | |
void | SendCommandUpgradeTo (CUnit &unit, CUnitType &what, int flush) |
Send upgrade to command. More... | |
void | SendCommandCancelUpgradeTo (CUnit &unit) |
Send cancel upgrade to command. More... | |
void | SendCommandResearch (CUnit &unit, CUpgrade &what, int flush) |
Send research command. More... | |
void | SendCommandCancelResearch (CUnit &unit) |
Send cancel research command. More... | |
void | SendCommandSpellCast (CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush) |
Send spell cast command. More... | |
void | SendCommandAutoSpellCast (CUnit &unit, int spellid, int on) |
Send auto spell cast command. More... | |
void | SendCommandDiplomacy (int player, int state, int opponent) |
Send diplomacy command. More... | |
void | SendCommandSharedVision (int player, bool state, int opponent) |
Send shared vision command. More... | |
void | ExecCommand (unsigned char type, UnitRef unum, unsigned short x, unsigned short y, UnitRef dest) |
Execute a command (from network). More... | |
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). More... | |
#define FlushCommands 1 |
typedef unsigned short UnitRef |
Unit references over network, or for memory saving.
Prepare command attack.
Attack with unit at new position
unit | pointer to unit. |
pos | map position to attack. |
target | or unit to be attacked. |
flush | if true, flush command queue. |
Prepare command attack ground.
Attack ground with unit.
unit | pointer to unit. |
pos | map position to fire on. |
flush | if true, flush command queue. |
Send auto repair command.
Auto repair.
unit | pointer to unit. |
on | 1 for auto repair on, 0 for off. |
Prepare command auto spellcast.
Auto spell cast.
unit | pointer to unit. |
spellid | Spell id. |
on | 1 for auto cast on, 0 for off. |
Prepare command board.
Board a transporter with unit.
unit | pointer to unit. |
dest | unit to be boarded. |
flush | if true, flush command queue. |
Prepare command build.
Send a unit building
unit | pointer to unit. |
pos | map position to build. |
what | Unit type to build. |
flush | if true, flush command queue. |
Prepare command cancel research.
Cancel Building researching.
unit | Pointer to unit. |
Prepare command cancel training.
Cancel the training of an unit.
unit | pointer to unit. |
slot | slot number to cancel. |
type | Unit-type to cancel. |
Prepare command cancel upgrade to.
Cancel building upgrading to.
unit | pointer to unit. |
Prepare command defend.
Follow unit and defend it
unit | pointer to unit. |
dest | unit to follow |
flush | if true, flush command queue. |
void CommandDiplomacy | ( | int | player, |
int | state, | ||
int | opponent | ||
) |
Prepare diplomacy command.
Diplomacy changed.
player | Player which changes his state. |
state | New diplomacy state. |
opponent | Opponent. |
Prepare command dismiss.
Cancel the building construction, or kill a unit.
unit | pointer to unit. |
Prepare command explore.
Send a unit exploring
unit | pointer to unit. |
flush | if true, flush command queue. |
Prepare command follow.
Follow unit to new position
unit | pointer to unit. |
dest | unit to be followed |
flush | if true, flush command queue. |
Prepare command move.
Move unit to new position
unit | pointer to unit. |
pos | map position to move to. |
flush | if true, flush command queue. |
Prepare command patrol.
Let a unit patrol from current to new position
FIXME: want to support patroling between units.
unit | pointer to unit. |
pos | map position to patrol between. |
flush | if true, flush command queue. |
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.
Player quit.
player | Player number that quit. |
Prepare command repair.
Repair unit
unit | pointer to unit. |
pos | map position to repair. |
dest | or unit to be repaired. FIXME: not supported |
flush | if true, flush command queue. |
Prepare command research.
Building starts researching.
unit | pointer to unit. |
what | what to research. |
flush | if true, flush command queue. |
Prepare command resource.
Send unit to harvest resources
unit | pointer to unit. |
dest | destination unit. |
flush | if true, flush command queue. |
Prepare command resource location.
Send unit harvest a location
unit | pointer to unit. |
pos | map position for harvest. |
flush | if true, flush command queue. |
Prepare command return.
Let unit returning goods.
unit | pointer to unit. |
depot | bring goods to this depot. |
flush | if true, flush command queue. |
void CommandSharedVision | ( | int | playerIndex, |
bool | state, | ||
int | opponentIndex | ||
) |
Prepare shared vision command.
Shared vision changed.
playerIndex | Player which changes his state. |
state | New shared vision state. |
opponentIndex | Opponent. |
TODO: change ThisPlayer to currently rendered player/players #RenderTargets
void CommandSpellCast | ( | CUnit & | unit, |
const Vec2i & | pos, | ||
CUnit * | dest, | ||
const SpellType & | spell, | ||
int | flush, | ||
bool | isAutocast | ||
) |
Prepare command spellcast.
Cast a spell at position or unit.
unit | Pointer to unit. |
pos | map position to spell cast on. |
dest | Spell cast on unit (if exist). |
spell | Spell type pointer. |
flush | If true, flush command queue. |
Prepare command stand ground.
Stand ground.
unit | pointer to unit. |
flush | if true, flush command queue. |
Prepare command stop.
Stop unit.
unit | pointer to unit. |
Prepare command train.
Building starts training an unit.
unit | pointer to unit. |
type | unit type to train. |
flush | if true, flush command queue. |
immediate transforming into type.
Immediate transforming unit into type.
unit | pointer to unit. |
type | upgrade to type |
Prepare command unload.
Unload a transporter.
unit | pointer to unit. |
pos | map position to unload. |
what | unit to be unloaded, NULL for all. |
flush | if true, flush command queue. |
Prepare command upgrade to.
Building starts upgrading to.
unit | pointer to unit. |
type | upgrade to type |
flush | if true, flush command queue. |
void ExecCommand | ( | unsigned char | msgnr, |
UnitRef | unum, | ||
unsigned short | x, | ||
unsigned short | y, | ||
UnitRef | dstnr | ||
) |
Execute a command (from network).
Execute a command (from network).
msgnr | Network message type |
unum | Unit number (slot) that receive the command. |
x | optional X map position. |
y | optional y map position. |
dstnr | optional destination unit. |
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).
Execute an extended command (from network).
type | Network extended message type |
status | Bit 7 of message type |
arg1 | Messe argument 1 |
arg2 | Messe argument 2 |
arg3 | Messe argument 3 |
arg4 | Messe argument 4 |
arg1: 0:true / 1:false
CommandLog(...);
CommandLog(...);
arg1: 0:cShadowCasting / 1:cSimpleRadial
CommandLog(...);
CommandLog(...);
Arg2: Opaque fields flags
CommandLog(...);
CommandLog(...);
arg1: enable/disable fog
arg2: request for update
CommandLog(...);
Send attack command.
Send command: Unit attack unit or at position.
unit | pointer to unit. |
pos | map tile position to attack. |
attack | or !=NoUnitP unit to be attacked. |
flush | Flag flush all pending commands. |
Send attack ground command.
Send command: Unit attack ground.
unit | pointer to unit. |
pos | map tile position to fire on. |
flush | Flag flush all pending commands. |
Send auto repair command.
Send command: Unit auto repair.
unit | pointer to unit. |
on | 1 for auto repair on, 0 for off. |
Send auto spell cast command.
Send command: Unit auto spell cast.
unit | pointer to unit. |
spellid | Spell type id. |
on | 1 for auto cast on, 0 for off. |
Send board command.
Send command: Unit board unit.
unit | pointer to unit. |
dest | Destination to be boarded. |
flush | Flag flush all pending commands. |
Send build building command.
Send command: Unit builds building at position.
unit | pointer to unit. |
pos | map tile position of construction. |
what | pointer to unit-type of the building. |
flush | Flag flush all pending commands. |
Send cancel research command.
Send command: Cancel Building/unit research.
unit | pointer to unit. |
Send cancel training command.
Send command: Cancel training.
unit | Pointer to unit. |
slot | Slot of training queue to cancel. |
type | Unit-type of unit to cancel. |
Send cancel upgrade to command.
Send command: Cancel building upgrading to.
unit | Pointer to unit. |
Send defend command.
Send command: Defend some unit.
unit | pointer to unit. |
dest | defend this unit. |
flush | Flag flush all pending commands. |
void SendCommandDiplomacy | ( | int | player, |
int | state, | ||
int | opponent | ||
) |
Send diplomacy command.
Send command: Diplomacy changed.
player | Player which changes his state. |
state | New diplomacy state. |
opponent | Opponent. |
Send cancel building command.
Send command: Cancel this building construction.
unit | pointer to unit. |
Send explore command.
Send command: Unit explores the map.
unit | pointer to unit. |
flush | Flag flush all pending commands. |
Send follow command.
Send command: Follow unit to position.
unit | pointer to unit. |
dest | follow this unit. |
flush | Flag flush all pending commands. |
Send move command.
Send command: Move unit to position.
unit | pointer to unit. |
pos | map tile position to move to. |
flush | Flag flush all pending commands. |
Send patrol command.
Send command: Unit patrol between current and position.
unit | pointer to unit. |
pos | map tile position to patrol between. |
flush | Flag flush all pending commands. |
Send repair command.
Send command: Unit repair.
unit | Pointer to unit. |
pos | map tile position to repair. |
dest | Unit to be repaired. |
flush | Flag flush all pending commands. |
Send research command.
Send command: Building/unit research.
unit | pointer to unit. |
what | research-type of the research. |
flush | Flag flush all pending commands. |
Send harvest command.
Send command: Unit harvest resources
unit | pointer to unit. |
dest | pointer to destination (oil-platform,gold mine). |
flush | Flag flush all pending commands. |
Send harvest location command.
Send command: Unit harvests a location (wood for now).
unit | pointer to unit. |
pos | map tile position where to harvest. |
flush | Flag flush all pending commands. |
Send return goods command.
Send command: Unit return goods.
unit | pointer to unit. |
goal | pointer to destination of the goods. (NULL=search best) |
flush | Flag flush all pending commands. |
void SendCommandSharedVision | ( | int | player, |
bool | state, | ||
int | opponent | ||
) |
Send shared vision command.
Send command: Shared vision changed.
player | Player which changes his state. |
state | New shared vision state. |
opponent | Opponent. |
Send spell cast command.
Send command: Unit spell cast on position/unit.
unit | pointer to unit. |
pos | map tile position where to cast spell. |
dest | Cast spell on unit (if exist). |
spellid | Spell type id. |
flush | Flag flush all pending commands. |
Send stand ground command.
Send command: Unit stand ground.
unit | pointer to unit. |
flush | Flag flush all pending commands. |
Send stop command.
Send command: Unit stop.
unit | pointer to unit. |
Send train command.
Send command: Building/unit train new unit.
unit | pointer to unit. |
what | pointer to unit-type of the unit to be trained. |
flush | Flag flush all pending commands. |
Send unload command.
Send command: Unit unload unit.
unit | pointer to unit. |
pos | map tile position of unload. |
what | Passagier to be unloaded. |
flush | Flag flush all pending commands. |