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

src/include/commands.h File Reference

#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.
void CommandStopUnit (CUnit &unit)
 Prepare command stop.
void CommandStandGround (CUnit &unit, int flush)
 Prepare command stand ground.
void CommandFollow (CUnit &unit, CUnit &dest, int flush)
 Prepare command follow.
void CommandMove (CUnit &unit, const Vec2i &pos, int flush)
 Prepare command move.
void CommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
 Prepare command repair.
void CommandAutoRepair (CUnit &unit, int on)
 Send auto repair command.
void CommandAttack (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
 Prepare command attack.
void CommandAttackGround (CUnit &unit, const Vec2i &pos, int flush)
 Prepare command attack ground.
void CommandPatrolUnit (CUnit &unit, const Vec2i &pos, int flush)
 Prepare command patrol.
void CommandBoard (CUnit &unit, CUnit &dest, int flush)
 Prepare command board.
void CommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
 Prepare command unload.
void CommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &, int flush)
 Prepare command build.
void CommandDismiss (CUnit &unit)
 Prepare command dismiss.
void CommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush)
 Prepare command resource location.
void CommandResource (CUnit &unit, CUnit &dest, int flush)
 Prepare command resource.
void CommandReturnGoods (CUnit &unit, CUnit *depot, int flush)
 Prepare command return.
void CommandTrainUnit (CUnit &unit, CUnitType &what, int flush)
 Prepare command train.
void CommandCancelTraining (CUnit &unit, int slot, const CUnitType *type)
 Prepare command cancel training.
void CommandUpgradeTo (CUnit &unit, CUnitType &what, int flush)
 Prepare command upgrade to.
void CommandTransformIntoType (CUnit &unit, CUnitType &type)
 immediate transforming into type.
void CommandCancelUpgradeTo (CUnit &unit)
 Prepare command cancel upgrade to.
void CommandResearch (CUnit &unit, CUpgrade &what, int flush)
 Prepare command research.
void CommandCancelResearch (CUnit &unit)
 Prepare command cancel research.
void CommandSpellCast (CUnit &unit, const Vec2i &pos, CUnit *dest, const SpellType &spell, int flush)
 Prepare command spellcast.
void CommandAutoSpellCast (CUnit &unit, int spellid, int on)
 Prepare command auto spellcast.
void CommandDiplomacy (int player, int state, int opponent)
 Prepare diplomacy command.
void CommandSharedVision (int player, bool state, int opponent)
 Prepare shared vision command.
void SendCommandStopUnit (CUnit &unit)
 Send stop command.
void SendCommandStandGround (CUnit &unit, int flush)
 Send stand ground command.
void SendCommandFollow (CUnit &unit, CUnit &dest, int flush)
 Send follow command.
void SendCommandMove (CUnit &unit, const Vec2i &pos, int flush)
 Send move command.
void SendCommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
 Send repair command.
void SendCommandAutoRepair (CUnit &unit, int on)
 Send auto repair command.
void SendCommandAttack (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
 Send attack command.
void SendCommandAttackGround (CUnit &unit, const Vec2i &pos, int flush)
 Send attack ground command.
void SendCommandPatrol (CUnit &unit, const Vec2i &pos, int flush)
 Send patrol command.
void SendCommandBoard (CUnit &unit, CUnit &dest, int flush)
 Send board command.
void SendCommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
 Send unload command.
void SendCommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &what, int flush)
 Send build building command.
void SendCommandDismiss (CUnit &unit)
 Send cancel building command.
void SendCommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush)
 Send harvest location command.
void SendCommandResource (CUnit &unit, CUnit &dest, int flush)
 Send harvest command.
void SendCommandReturnGoods (CUnit &unit, CUnit *dest, int flush)
 Send return goods command.
void SendCommandTrainUnit (CUnit &unit, CUnitType &what, int flush)
 Send train command.
void SendCommandCancelTraining (CUnit &unit, int slot, const CUnitType *type)
 Send cancel training command.
void SendCommandUpgradeTo (CUnit &unit, CUnitType &what, int flush)
 Send upgrade to command.
void SendCommandCancelUpgradeTo (CUnit &unit)
 Send cancel upgrade to command.
void SendCommandResearch (CUnit &unit, CUpgrade &what, int flush)
 Send research command.
void SendCommandCancelResearch (CUnit &unit)
 Send cancel research command.
void SendCommandSpellCast (CUnit &unit, const Vec2i &pos, CUnit *dest, int spellid, int flush)
 Send spell cast command.
void SendCommandAutoSpellCast (CUnit &unit, int spellid, int on)
 Send auto spell cast command.
void SendCommandDiplomacy (int player, int state, int opponent)
 Send diplomacy command.
void SendCommandSharedVision (int player, bool state, int opponent)
 Send shared vision command.
void ParseCommand (unsigned char type, UnitRef unum, unsigned short x, unsigned short y, UnitRef dest)
 Parse a command (from network).
void ParseExtendedCommand (unsigned char type, int status, unsigned char arg1, unsigned short arg2, unsigned short arg3, unsigned short arg4)
 Parse an extended command (from network).

Define Documentation

#define FlushCommands   1


Typedef Documentation

typedef unsigned short UnitRef

Unit references over network, or for memory saving.


Function Documentation

void CommandAttack ( CUnit unit,
const Vec2i pos,
CUnit dest,
int  flush 
)

Prepare command attack.

void CommandAttackGround ( CUnit unit,
const Vec2i pos,
int  flush 
)

Prepare command attack ground.

void CommandAutoRepair ( CUnit unit,
int  on 
)

Send auto repair command.

Auto repair.

Parameters:
unit pointer to unit.
on 1 for auto repair on, 0 for off.

void CommandAutoSpellCast ( CUnit unit,
int  spellid,
int  on 
)

Prepare command auto spellcast.

Auto spell cast.

Parameters:
unit pointer to unit.
spellid Spell id.
on 1 for auto cast on, 0 for off.

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

Prepare command board.

Board a transporter with unit.

Parameters:
unit pointer to unit.
dest unit to be boarded.
flush if true, flush command queue.

void CommandBuildBuilding ( CUnit unit,
const Vec2i pos,
CUnitType ,
int  flush 
)

Prepare command build.

void CommandCancelResearch ( CUnit unit  ) 

Prepare command cancel research.

Cancel Building researching.

Parameters:
unit Pointer to unit.

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

Prepare command cancel training.

Cancel the training of an unit.

Parameters:
unit pointer to unit.
slot slot number to cancel.
type Unit-type to cancel.

void CommandCancelUpgradeTo ( CUnit unit  ) 

Prepare command cancel upgrade to.

Cancel building upgrading to.

Parameters:
unit pointer to unit.

void CommandDiplomacy ( int  player,
int  state,
int  opponent 
)

Prepare diplomacy command.

Diplomacy changed.

Parameters:
player Player which changes his state.
state New diplomacy state.
opponent Opponent.

void CommandDismiss ( CUnit unit  ) 

Prepare command dismiss.

Cancel the building construction, or kill a unit.

Parameters:
unit pointer to unit.

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

Prepare command follow.

Follow unit to new position

Parameters:
unit pointer to unit.
dest unit to be followed
flush if true, flush command queue.

void CommandMove ( CUnit unit,
const Vec2i pos,
int  flush 
)

Prepare command move.

void CommandPatrolUnit ( CUnit unit,
const Vec2i pos,
int  flush 
)

Prepare command patrol.

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.

Parameters:
player Player number that quit.

void CommandRepair ( CUnit unit,
const Vec2i pos,
CUnit dest,
int  flush 
)

Prepare command repair.

void CommandResearch ( CUnit unit,
CUpgrade what,
int  flush 
)

Prepare command research.

Building starts researching.

Parameters:
unit pointer to unit.
what what to research.
flush if true, flush command queue.

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

Prepare command resource.

Send unit to harvest resources

Parameters:
unit pointer to unit.
dest destination unit.
flush if true, flush command queue.

void CommandResourceLoc ( CUnit unit,
const Vec2i pos,
int  flush 
)

Prepare command resource location.

void CommandReturnGoods ( CUnit unit,
CUnit depot,
int  flush 
)

Prepare command return.

Let unit returning goods.

Parameters:
unit pointer to unit.
depot bring goods to this depot.
flush if true, flush command queue.

void CommandSharedVision ( int  player,
bool  state,
int  opponent 
)

Prepare shared vision command.

Shared vision changed.

Parameters:
player Player which changes his state.
state New shared vision state.
opponent Opponent.

void CommandSpellCast ( CUnit unit,
const Vec2i pos,
CUnit dest,
const SpellType spell,
int  flush 
)

Prepare command spellcast.

void CommandStandGround ( CUnit unit,
int  flush 
)

Prepare command stand ground.

Stand ground.

Parameters:
unit pointer to unit.
flush if true, flush command queue.

void CommandStopUnit ( CUnit unit  ) 

Prepare command stop.

Stop unit.

Parameters:
unit pointer to unit.

void CommandTrainUnit ( CUnit unit,
CUnitType type,
int   
)

Prepare command train.

Building starts training an unit.

Parameters:
unit pointer to unit.
type unit type to train.
flush if true, flush command queue.

void CommandTransformIntoType ( CUnit unit,
CUnitType type 
)

immediate transforming into type.

Immediate transforming unit into type.

Parameters:
unit pointer to unit.
type upgrade to type

void CommandUnload ( CUnit unit,
const Vec2i pos,
CUnit what,
int  flush 
)

Prepare command unload.

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

Prepare command upgrade to.

Building starts upgrading to.

Parameters:
unit pointer to unit.
type upgrade to type
flush if true, flush command queue.

void ParseCommand ( unsigned char  msgnr,
UnitRef  unum,
unsigned short  x,
unsigned short  y,
UnitRef  dstnr 
)

Parse a command (from network).

Parse a command (from network).

Parameters:
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 ParseExtendedCommand ( unsigned char  type,
int  status,
unsigned char  arg1,
unsigned short  arg2,
unsigned short  arg3,
unsigned short  arg4 
)

Parse an extended command (from network).

Parse an extended command (from network).

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

void SendCommandAttack ( CUnit unit,
const Vec2i pos,
CUnit dest,
int  flush 
)

Send attack command.

void SendCommandAttackGround ( CUnit unit,
const Vec2i pos,
int  flush 
)

Send attack ground command.

void SendCommandAutoRepair ( CUnit unit,
int  on 
)

Send auto repair command.

Send command: Unit auto repair.

Parameters:
unit pointer to unit.
on 1 for auto repair on, 0 for off.

void SendCommandAutoSpellCast ( CUnit unit,
int  spellid,
int  on 
)

Send auto spell cast command.

Send command: Unit auto spell cast.

Parameters:
unit pointer to unit.
spellid Spell type id.
on 1 for auto cast on, 0 for off.

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

Send board command.

Send command: Unit board unit.

Parameters:
unit pointer to unit.
dest Destination to be boarded.
flush Flag flush all pending commands.

void SendCommandBuildBuilding ( CUnit unit,
const Vec2i pos,
CUnitType what,
int  flush 
)

Send build building command.

void SendCommandCancelResearch ( CUnit unit  ) 

Send cancel research command.

Send command: Cancel Building/unit research.

Parameters:
unit pointer to unit.

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

Send cancel training command.

Send command: Cancel training.

Parameters:
unit Pointer to unit.
slot Slot of training queue to cancel.
type Unit-type of unit to cancel.

void SendCommandCancelUpgradeTo ( CUnit unit  ) 

Send cancel upgrade to command.

Send command: Cancel building upgrading to.

Parameters:
unit Pointer to unit.

void SendCommandDiplomacy ( int  player,
int  state,
int  opponent 
)

Send diplomacy command.

Send command: Diplomacy changed.

Parameters:
player Player which changes his state.
state New diplomacy state.
opponent Opponent.

void SendCommandDismiss ( CUnit unit  ) 

Send cancel building command.

Send command: Cancel this building construction.

Parameters:
unit pointer to unit.

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

Send follow command.

Send command: Follow unit to position.

Parameters:
unit pointer to unit.
dest follow this unit.
flush Flag flush all pending commands.

void SendCommandMove ( CUnit unit,
const Vec2i pos,
int  flush 
)

Send move command.

void SendCommandPatrol ( CUnit unit,
const Vec2i pos,
int  flush 
)

Send patrol command.

void SendCommandRepair ( CUnit unit,
const Vec2i pos,
CUnit dest,
int  flush 
)

Send repair command.

void SendCommandResearch ( CUnit unit,
CUpgrade what,
int  flush 
)

Send research command.

Send command: Building/unit research.

Parameters:
unit pointer to unit.
what research-type of the research.
flush Flag flush all pending commands.

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

Send harvest command.

Send command: Unit harvest resources

Parameters:
unit pointer to unit.
dest pointer to destination (oil-platform,gold mine).
flush Flag flush all pending commands.

void SendCommandResourceLoc ( CUnit unit,
const Vec2i pos,
int  flush 
)

Send harvest location command.

void SendCommandReturnGoods ( CUnit unit,
CUnit goal,
int  flush 
)

Send return goods command.

Send command: Unit return goods.

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

Parameters:
player Player which changes his state.
state New shared vision state.
opponent Opponent.

void SendCommandSpellCast ( CUnit unit,
const Vec2i pos,
CUnit dest,
int  spellid,
int  flush 
)

Send spell cast command.

void SendCommandStandGround ( CUnit unit,
int  flush 
)

Send stand ground command.

Send command: Unit stand ground.

Parameters:
unit pointer to unit.
flush Flag flush all pending commands.

void SendCommandStopUnit ( CUnit unit  ) 

Send stop command.

Send command: Unit stop.

Parameters:
unit pointer to unit.

void SendCommandTrainUnit ( CUnit unit,
CUnitType what,
int  flush 
)

Send train command.

Send command: Building/unit train new unit.

Parameters:
unit pointer to unit.
what pointer to unit-type of the unit to be trained.
flush Flag flush all pending commands.

void SendCommandUnload ( CUnit unit,
const Vec2i pos,
CUnit what,
int  flush 
)

Send unload command.

void SendCommandUpgradeTo ( CUnit unit,
CUnitType what,
int  flush 
)

Send upgrade to command.

Send command: Building starts upgrading to.

Parameters:
unit pointer to unit.
what pointer to unit-type of the unit upgrade.
flush Flag flush all pending commands.

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