$treeview $search $mathjax
Stratagus  2.2.6
$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/network/commands.cpp File Reference

#include "stratagus.h"
#include "commands.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "actions.h"
#include "network.h"
#include "spells.h"
#include "replay.h"

Functions

commands.cpp - Global command handler - network support.
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)
void SendCommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush)
void SendCommandAutoRepair (CUnit &unit, int on)
 Send auto repair command.
void SendCommandAttack (CUnit &unit, const Vec2i &pos, CUnit *attack, int flush)
void SendCommandAttackGround (CUnit &unit, const Vec2i &pos, int flush)
void SendCommandPatrol (CUnit &unit, const Vec2i &pos, int flush)
void SendCommandBoard (CUnit &unit, CUnit &dest, int flush)
 Send board command.
void SendCommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush)
void SendCommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &what, int flush)
void SendCommandDismiss (CUnit &unit)
 Send cancel building command.
void SendCommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush)
void SendCommandResource (CUnit &unit, CUnit &dest, int flush)
 Send harvest command.
void SendCommandReturnGoods (CUnit &unit, CUnit *goal, 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)
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 SendCommandSetResource (int player, int resource, int value)
 Send set resource command.
void SendCommandSharedVision (int player, bool state, int opponent)
 Send shared vision command.
parse
void ParseCommand (unsigned char msgnr, UnitRef unum, unsigned short x, unsigned short y, UnitRef dstnr)
 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).

Function Documentation

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 attack,
int  flush 
)

Send command: Unit attack unit or at position.

Parameters:
unit pointer to unit.
pos map tile position to attack.
attack or !=NoUnitP unit to be attacked.
flush Flag flush all pending commands.

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

Send command: Unit attack ground.

Parameters:
unit pointer to unit.
pos map tile position to fire on.
flush Flag flush all pending commands.

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 command: Unit builds building at position.

Parameters:
unit pointer to unit.
pos map tile position of construction.
what pointer to unit-type of the building.
flush Flag flush all pending commands.

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 command: Move unit to position.

Parameters:
unit pointer to unit.
pos map tile position to move to.
flush Flag flush all pending commands.

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

Send command: Unit patrol between current and position.

Parameters:
unit pointer to unit.
pos map tile position to patrol between.
flush Flag flush all pending commands.

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

Send command: Unit repair.

Parameters:
unit Pointer to unit.
pos map tile position to repair.
dest Unit to be repaired.
flush Flag flush all pending commands.

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 command: Unit harvests a location (wood for now).

Parameters:
unit pointer to unit.
pos map tile position where to harvest.
flush Flag flush all pending commands.

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 SendCommandSetResource ( int  player,
int  resource,
int  value 
)

Send set resource command.

Send command: Diplomacy changed.

Parameters:
player Player which changes his resource.
resource Resource type.
value New resource value.

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 command: Unit spell cast on position/unit.

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

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 command: Unit unload unit.

Parameters:
unit pointer to unit.
pos map tile position of unload.
what Passagier to be unloaded.
flush Flag flush all pending commands.

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-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.