$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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "actions.h"
#include "tileset.h"
#include "map.h"
#include "upgrade.h"
#include "pathfinder.h"
#include "spells.h"
#include "interface.h"
#include "ui.h"
Functions | |
command.cpp - Give units a command. | |
static void | ReleaseOrders (CUnit &unit) |
static COrderPtr | GetNextOrder (CUnit &unit, int flush) |
static void | RemoveOrder (CUnit &unit, int order) |
static void | ClearSavedAction (CUnit &unit) |
void | CommandStopUnit (CUnit &unit) |
Prepare command stop. | |
void | CommandAnyOrder (CUnit &unit, COrderPtr cpyorder, int flush) |
void | CommandMoveOrder (CUnit &unit, int src, int dst) |
Send any command. | |
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) |
void | CommandRepair (CUnit &unit, const Vec2i &pos, CUnit *dest, int flush) |
void | CommandAutoRepair (CUnit &unit, int on) |
Send auto repair command. | |
void | CommandAttack (CUnit &unit, const Vec2i &pos, CUnit *attack, int flush) |
void | CommandAttackGround (CUnit &unit, const Vec2i &pos, int flush) |
void | CommandPatrolUnit (CUnit &unit, const Vec2i &pos, int flush) |
void | CommandBoard (CUnit &unit, CUnit &dest, int flush) |
Prepare command board. | |
void | CommandUnload (CUnit &unit, const Vec2i &pos, CUnit *what, int flush) |
void | CommandBuildBuilding (CUnit &unit, const Vec2i &pos, CUnitType &what, int flush) |
void | CommandDismiss (CUnit &unit) |
Prepare command dismiss. | |
void | CommandResourceLoc (CUnit &unit, const Vec2i &pos, int flush) |
void | CommandResource (CUnit &unit, CUnit &dest, int flush) |
Prepare command resource. | |
void | CommandReturnGoods (CUnit &unit, CUnit *goal, int flush) |
Prepare command return. | |
void | CommandTrainUnit (CUnit &unit, CUnitType &type, int) |
Prepare command train. | |
void | CommandCancelTraining (CUnit &unit, int slot, const CUnitType *type) |
Prepare command cancel training. | |
void | CommandUpgradeTo (CUnit &unit, CUnitType &type, 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, SpellType *spell, int flush) |
void | CommandAutoSpellCast (CUnit &unit, int spellid, int on) |
Prepare command auto spellcast. | |
void | CommandDiplomacy (int player, int state, int opponent) |
Prepare diplomacy command. | |
void | CommandSetResource (int player, int resource, int value) |
Prepare set resources command. | |
void | CommandSharedVision (int player, bool state, int opponent) |
Prepare shared vision command. | |
void | CommandQuit (int player) |
Hash calculated to find sync failures. |
static void ClearSavedAction | ( | CUnit & | unit | ) | [static] |
Clear the saved action.
unit | Unit pointer, that get the saved action cleared. |
Internal functions, must protect it, if needed.
Order an already formed Order structure
unit | pointer to unit | |
cpyorder | pointer to valid order | |
flush | if true, flush command queue. |
Attack with unit at new position
unit | pointer to unit. | |
pos | map position to attack. | |
attack | or unit to be attacked. | |
flush | if true, flush command queue. |
Attack ground with unit.
unit | pointer to unit. | |
pos | map position to fire on. | |
flush | if true, flush command queue. |
void CommandAutoRepair | ( | CUnit & | unit, | |
int | on | |||
) |
Send auto repair command.
Auto repair.
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.
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. |
Send a unit building
unit | pointer to unit. | |
pos | map position to build. | |
what | Unit type to build. | |
flush | if true, flush command queue. |
void CommandCancelResearch | ( | CUnit & | unit | ) |
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. |
void CommandCancelUpgradeTo | ( | CUnit & | unit | ) |
Prepare command cancel upgrade to.
Cancel building upgrading to.
unit | pointer to unit. |
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. |
void CommandDismiss | ( | CUnit & | unit | ) |
Prepare command dismiss.
Cancel the building construction, or kill a unit.
unit | pointer to unit. |
Prepare command follow.
Follow unit to new position
unit | pointer to unit. | |
dest | unit to be followed | |
flush | if true, flush command queue. |
Move unit to new position
unit | pointer to unit. | |
pos | map position to move to. | |
flush | if true, flush command queue. |
void CommandMoveOrder | ( | CUnit & | unit, | |
int | src, | |||
int | dst | |||
) |
Send any command.
Move an order in the order queue. ( Cannot move the order 0 ! )
unit | pointer to unit | |
src | the order to move | |
dst | the new position of the order |
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 | ) |
Hash calculated to find sync failures.
Player quit.
player | Player number that quit. |
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. |
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. | |
goal | bring goods to this depot. | |
flush | if true, flush command queue. |
void CommandSetResource | ( | int | player, | |
int | resource, | |||
int | value | |||
) |
Prepare set resources command.
Set new resources count for player.
player | Player which changes his state. | |
resource | Resource index | |
value | New value |
void CommandSharedVision | ( | int | player, | |
bool | state, | |||
int | opponent | |||
) |
Prepare shared vision command.
Shared vision changed.
player | Player which changes his state. | |
state | New shared vision state. | |
opponent | Opponent. |
void CommandSpellCast | ( | CUnit & | unit, | |
const Vec2i & | pos, | |||
CUnit * | dest, | |||
SpellType * | spell, | |||
int | flush | |||
) |
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. |
void CommandStandGround | ( | CUnit & | unit, | |
int | flush | |||
) |
Prepare command stand ground.
Stand ground.
unit | pointer to unit. | |
flush | if true, flush command queue. |
void CommandStopUnit | ( | CUnit & | unit | ) |
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 |
Unload a transporter.
unit | pointer to unit. | |
pos | map position to unload. | |
what | unit to be unloaded, NoUnitP 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. |
Get next free order slot.
unit | pointer to unit. | |
flush | if true, flush order queue. |
static void ReleaseOrders | ( | CUnit & | unit | ) | [static] |
Release all orders of a unit.
unit | Pointer to unit. |
static void RemoveOrder | ( | CUnit & | unit, | |
int | order | |||
) | [static] |
Remove an order from the list of orders pending
unit | pointer to unit | |
order | number of the order to remove |