____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include "unit.h"
Go to the source code of this file.
Functions | |
| void | SendCommandStopUnit (CUnit *unit) |
| < Send stop command | |
| void | SendCommandStandGround (CUnit *unit, int flush) |
| Send follow command. | |
| void | SendCommandFollow (CUnit *unit, CUnit *dest, int flush) |
| Send move command. | |
| void | SendCommandMove (CUnit *unit, int x, int y, int flush) |
| Send repair command. | |
| void | SendCommandRepair (CUnit *unit, int x, int y, CUnit *dest, int flush) |
| Send auto repair command. | |
| void | SendCommandAutoRepair (CUnit *unit, int on) |
| Send attack command. | |
| void | SendCommandAttack (CUnit *unit, int x, int y, CUnit *dest, int flush) |
| Send attack ground command. | |
| void | SendCommandAttackGround (CUnit *unit, int x, int y, int flush) |
| Send patrol command. | |
| void | SendCommandPatrol (CUnit *unit, int x, int y, int flush) |
| Send board command. | |
| void | SendCommandBoard (CUnit *unit, int x, int y, CUnit *dest, int flush) |
| Send unload command. | |
| void | SendCommandUnload (CUnit *unit, int x, int y, CUnit *what, int flush) |
| Send build building command. | |
| void | SendCommandBuildBuilding (CUnit *unit, int x, int y, CUnitType *what, int flush) |
| Send cancel building command. | |
| void | SendCommandDismiss (CUnit *unit) |
| Send harvest command. | |
| void | SendCommandResource (CUnit *unit, CUnit *dest, int flush) |
| Send train command. | |
| void | SendCommandTrainUnit (CUnit *unit, CUnitType *what, int flush) |
| Send cancel training command. | |
| void | SendCommandCancelTraining (CUnit *unit, int slot, const CUnitType *type) |
| Send spell cast command. | |
| void | SendCommandSpellCast (CUnit *unit, int x, int y, CUnit *dest, int spellid, int flush) |
| Send auto spell cast command. | |
| void | SendCommandAutoSpellCast (CUnit *unit, int spellid, int on) |
| Send diplomacy command. | |
| void | SendCommandDiplomacy (int player, int state, int opponent) |
| Send shared vision command. | |
| void | SendCommandSharedVision (int player, bool state, int opponent) |
| Parse a command (from network). | |
| void | ParseCommand (unsigned char type, UnitRef unum, unsigned short x, unsigned short y, UnitRef dest) |
| Parse an extended command (from network). | |
| void | ParseExtendedCommand (unsigned char type, int status, unsigned char arg1, unsigned short arg2, unsigned short arg3, unsigned short arg4) |
Definition in file commands.h.
| void ParseCommand | ( | unsigned char | msgnr, | |
| UnitRef | unum, | |||
| unsigned short | x, | |||
| unsigned short | y, | |||
| UnitRef | dstnr | |||
| ) |
Parse an extended command (from network).
Parse 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. |
Definition at line 453 of file commands.cpp.
References _C_, Assert, CommandAttack(), CommandAttackGround(), CommandAutoRepair(), CommandAutoSpellCast(), CommandBoard(), CommandBuildBuilding(), CommandCancelTraining(), CommandDismiss(), CommandFollow(), CommandLog(), CommandMove(), CommandPatrolUnit(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandStandGround(), CommandStopUnit(), CommandTrainUnit(), CommandUnload(), DebugPrint, CUnit::Destroyed, FlushCommands, MessageChat, MessageCommandAttack, MessageCommandAutoRepair, MessageCommandBoard, MessageCommandBuild, MessageCommandCancelTrain, MessageCommandDismiss, MessageCommandFollow, MessageCommandGround, MessageCommandMove, MessageCommandPatrol, MessageCommandRepair, MessageCommandResource, MessageCommandSpellCast, MessageCommandStand, MessageCommandStop, MessageCommandTrain, MessageCommandUnload, MessageQuit, MessageSync, NoUnitP, SpellTypeTable, CUnit::Type, UnitNumber, UnitSlotFree, UnitSlots, and UnitTypes.
Referenced by ParseNetworkCommand().
| 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).
| 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 |
Definition at line 619 of file commands.cpp.
References _C_, CommandDiplomacy(), CommandLog(), CommandSharedVision(), DebugPrint, DiplomacyAllied, DiplomacyCrazy, DiplomacyEnemy, DiplomacyNeutral, ExtendedMessageDiplomacy, ExtendedMessageSharedVision, and NoUnitP.
Referenced by ParseNetworkCommand().
Send attack ground command.
Send command: Unit attack unit or at position.
| unit | pointer to unit. | |
| x | X map tile position to attack. | |
| y | Y map tile position to attack. | |
| attack | or !=NoUnitP unit to be attacked. | |
| flush | Flag flush all pending commands. |
Definition at line 161 of file commands.cpp.
References CommandAttack(), CommandLog(), IsNetworkGame, MessageCommandAttack, and NetworkSendCommand().
Referenced by DoNextReplay(), DoRightButton(), and SendAttack().
| void SendCommandAttackGround | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Send patrol command.
Send command: Unit attack ground.
| unit | pointer to unit. | |
| x | X map tile position to fire on. | |
| y | Y map tile position to fire on. | |
| flush | Flag flush all pending commands. |
Definition at line 179 of file commands.cpp.
References CommandAttackGround(), CommandLog(), IsNetworkGame, MessageCommandGround, NetworkSendCommand(), and NoUnitP.
Referenced by DoNextReplay(), and SendAttackGround().
| void SendCommandAutoRepair | ( | CUnit * | unit, | |
| int | on | |||
| ) |
Send attack command.
Send command: Unit auto repair.
| unit | pointer to unit. | |
| on | 1 for auto repair on, 0 for off. |
Definition at line 140 of file commands.cpp.
References CommandAutoRepair(), CommandLog(), FlushCommands, IsNetworkGame, MessageCommandAutoRepair, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), and DoNextReplay().
| void SendCommandAutoSpellCast | ( | CUnit * | unit, | |
| int | spellid, | |||
| int | on | |||
| ) |
Send diplomacy command.
Send command: Unit auto spell cast.
| unit | pointer to unit. | |
| spellid | Spell type id. | |
| on | 1 for auto cast on, 0 for off. |
Definition at line 364 of file commands.cpp.
References CommandAutoSpellCast(), CommandLog(), FlushCommands, IsNetworkGame, MessageCommandSpellCast, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), and DoNextReplay().
Send unload command.
Send command: Unit board unit.
| unit | pointer to unit. | |
| x | X map tile position (unused). | |
| y | Y map tile position (unused). | |
| dest | Destination to be boarded. | |
| flush | Flag flush all pending commands. |
Definition at line 216 of file commands.cpp.
References CommandBoard(), CommandLog(), IsNetworkGame, MessageCommandBoard, and NetworkSendCommand().
Referenced by DoNextReplay(), DoRightButton(), and SendMove().
Send cancel building command.
Send command: Unit builds building at position.
| unit | pointer to unit. | |
| x | X map tile position of construction. | |
| y | Y map tile position of construction. | |
| what | pointer to unit-type of the building. | |
| flush | Flag flush all pending commands. |
Definition at line 254 of file commands.cpp.
References CommandBuildBuilding(), CommandLog(), CUnitType::Ident, IsNetworkGame, MessageCommandBuild, NetworkSendCommand(), and NoUnitP.
Referenced by DoNextReplay(), and UIHandleButtonDown().
Send spell cast command.
Send command: Cancel training.
| unit | Pointer to unit. | |
| slot | Slot of training queue to cancel. | |
| type | Unit-type of unit to cancel. |
Definition at line 323 of file commands.cpp.
References CommandCancelTraining(), CommandLog(), FlushCommands, CUnitType::Ident, IsNetworkGame, MessageCommandCancelTrain, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), DoNextReplay(), and UIHandleButtonDown().
| void SendCommandDiplomacy | ( | int | player, | |
| int | state, | |||
| int | opponent | |||
| ) |
Send shared vision command.
Send command: Diplomacy changed.
| player | Player which changes his state. | |
| state | New diplomacy state. | |
| opponent | Opponent. |
Definition at line 383 of file commands.cpp.
References CommandDiplomacy(), CommandLog(), DiplomacyAllied, DiplomacyCrazy, DiplomacyEnemy, DiplomacyNeutral, ExtendedMessageDiplomacy, IsNetworkGame, NetworkSendExtendedCommand(), and NoUnitP.
Referenced by CclSetDiplomacy(), and DoNextReplay().
| void SendCommandDismiss | ( | CUnit * | unit | ) |
Send harvest command.
Send command: Cancel this building construction.
| unit | pointer to unit. |
Definition at line 270 of file commands.cpp.
References CommandDismiss(), CommandLog(), FlushCommands, IsNetworkGame, MessageCommandDismiss, and NetworkSendCommand().
Referenced by CButtonPanel::DoClicked(), and DoNextReplay().
Send move command.
Send command: Follow unit to position.
| unit | pointer to unit. | |
| dest | follow this unit. | |
| flush | Flag flush all pending commands. |
Definition at line 87 of file commands.cpp.
References CommandFollow(), CommandLog(), IsNetworkGame, MessageCommandFollow, and NetworkSendCommand().
Referenced by DoNextReplay(), DoRightButton(), and SendMove().
| void SendCommandMove | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Send repair command.
Send command: Move unit to position.
| unit | pointer to unit. | |
| x | X map tile position to move to. | |
| y | Y map tile position to move to. | |
| flush | Flag flush all pending commands. |
Definition at line 105 of file commands.cpp.
References CommandLog(), CommandMove(), IsNetworkGame, MessageCommandMove, NetworkSendCommand(), and NoUnitP.
Referenced by DoNextReplay(), DoRightButton(), SendAttack(), SendAttackGround(), SendMove(), and SendResource().
| void SendCommandPatrol | ( | CUnit * | unit, | |
| int | x, | |||
| int | y, | |||
| int | flush | |||
| ) |
Send board command.
Send command: Unit patrol between current and position.
| unit | pointer to unit. | |
| x | X map tile position to patrol between. | |
| y | Y map tile position to patrol between. | |
| flush | Flag flush all pending commands. |
Definition at line 197 of file commands.cpp.
References CommandLog(), CommandPatrolUnit(), IsNetworkGame, MessageCommandPatrol, NetworkSendCommand(), and NoUnitP.
Referenced by DoNextReplay(), and SendPatrol().
Send auto repair command.
Send command: Unit repair.
| unit | Pointer to unit. | |
| x | X map tile position to repair. | |
| y | Y map tile position to repair. | |
| dest | Unit to be repaired. | |
| flush | Flag flush all pending commands. |
Definition at line 124 of file commands.cpp.
References CommandLog(), CommandRepair(), IsNetworkGame, MessageCommandRepair, and NetworkSendCommand().
Referenced by DoNextReplay(), DoRightButton(), and SendRepair().
Send train command.
Send command: Unit harvest resources
| unit | pointer to unit. | |
| dest | pointer to destination (oil-platform,gold mine). | |
| flush | Flag flush all pending commands. |
Definition at line 289 of file commands.cpp.
References CommandLog(), CommandResource(), IsNetworkGame, MessageCommandResource, and NetworkSendCommand().
Referenced by DoNextReplay(), DoRightButton(), and SendResource().
| void SendCommandSharedVision | ( | int | player, | |
| bool | state, | |||
| int | opponent | |||
| ) |
Parse a command (from network).
Send command: Shared vision changed.
| player | Player which changes his state. | |
| state | New shared vision state. | |
| opponent | Opponent. |
Definition at line 418 of file commands.cpp.
References CommandLog(), CommandSharedVision(), ExtendedMessageSharedVision, IsNetworkGame, NetworkSendExtendedCommand(), and NoUnitP.
Referenced by CclSetSharedVision(), and DoNextReplay().
Send auto spell cast command.
Send command: Unit spell cast on position/unit.
| unit | pointer to unit. | |
| x | X map tile position where to cast spell. | |
| y | Y map tile position where to cast spell. | |
| dest | Cast spell on unit (if exist). | |
| spellid | Spell type id. | |
| flush | Flag flush all pending commands. |
Definition at line 345 of file commands.cpp.
References CommandLog(), CommandSpellCast(), IsNetworkGame, MessageCommandSpellCast, NetworkSendCommand(), and SpellTypeTable.
Referenced by DoNextReplay(), DoRightButton(), and SendSpellCast().
| void SendCommandStandGround | ( | CUnit * | unit, | |
| int | flush | |||
| ) |
Send follow command.
Send command: Unit stand ground.
| unit | pointer to unit. | |
| flush | Flag flush all pending commands. |
Definition at line 70 of file commands.cpp.
References CommandLog(), CommandStandGround(), IsNetworkGame, MessageCommandStand, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), and DoNextReplay().
| void SendCommandStopUnit | ( | CUnit * | unit | ) |
< Send stop command
Send stand ground command
Send command: Unit stop.
| unit | pointer to unit. |
Definition at line 54 of file commands.cpp.
References CommandLog(), CommandStopUnit(), FlushCommands, IsNetworkGame, MessageCommandStop, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), DoNextReplay(), DoRightButton(), and SendMove().
Send cancel training 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. |
Definition at line 306 of file commands.cpp.
References CommandLog(), CommandTrainUnit(), CUnitType::Ident, IsNetworkGame, MessageCommandTrain, NetworkSendCommand(), and NoUnitP.
Referenced by CButtonPanel::DoClicked(), and DoNextReplay().
Send build building command.
Send command: Unit unload unit.
| unit | pointer to unit. | |
| x | X map tile position of unload. | |
| y | Y map tile position of unload. | |
| what | Passagier to be unloaded. | |
| flush | Flag flush all pending commands. |
Definition at line 235 of file commands.cpp.
References CommandLog(), CommandUnload(), IsNetworkGame, MessageCommandUnload, and NetworkSendCommand().
Referenced by CButtonPanel::DoClicked(), DoNextReplay(), SendUnload(), and UIHandleButtonDown().
1.5.6