$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
#include <vector>
#include "unittype.h"
#include "player.h"
#include "vec2i.h"
Go to the source code of this file.
Classes | |
class | CUnit |
The big unit structure. More... | |
class | CUnit::CUnitManagerData |
struct | CUnit::_seen_stuff_ |
Unit visibility counts. More... | |
struct | CUnit::_unit_anim_ |
The counter while ai unit couldn't change target. More... | |
class | CPreference |
unit.h - The unit headerfile. | |
#define | PRIORITY_FACTOR 0x00001000 |
#define | HEALTH_FACTOR 0x00000001 |
#define | DISTANCE_FACTOR 0x00010000 |
#define | INRANGE_FACTOR 0x00001000 |
#define | INRANGE_BONUS 0x00100000 |
#define | CANATTACK_BONUS 0x00010000 |
#define | AIPRIORITY_BONUS 0x01000000 |
#define | NextDirection 32 |
#define | UnitNotSeen 0x7fffffff |
#define | NoUnitP (CUnit *)0 |
#define | UnitNumber(unit) ((unit).UnitManagerData.GetUnitId()) |
#define | IsOnlySelected(unit) (NumSelected == 1 && Selected[0] == &(unit)) |
Check if unit is the currently only selected. | |
enum | _directions_ { LookingN = 0 * 32, LookingNE = 1 * 32, LookingE = 2 * 32, LookingSE = 3 * 32, LookingS = 4 * 32, LookingSW = 5 * 32, LookingW = 6 * 32, LookingNW = 7 * 32 } |
typedef COrder * | COrderPtr |
CPreference | Preference |
Lua handler count. | |
unsigned long | ShowOrdersCount |
All sprite's infos. | |
unsigned long | ShowNameDelay |
Show orders for some time. | |
unsigned long | ShowNameTime |
Delay to show unit's name. | |
bool | EnableTrainingQueue |
Show unit's name for some time. | |
bool | EnableBuildingCapture |
Config: training queues enabled. | |
bool | RevealAttacker |
Config: building capture enabled. | |
int | ResourcesMultiBuildersMultiplier |
Config: reveal attacker enabled. | |
const CViewport * | CurrentViewport |
Config: spend resources for building with multiple workers. | |
void(* | DrawSelection )(Uint32, int, int, int, int) |
Show unit's name for some time. | |
int | MaxSelectable |
How many units selected. | |
CUnit ** | Selected |
How many units could be selected. | |
CUnit ** | TeamSelected [PlayerMax] |
currently selected units | |
int | NumSelected |
teams currently selected units | |
int | TeamNumSelected [PlayerMax] |
how many units selected | |
void | SelectedUnitChanged () |
Called whenever the selected unit was updated. | |
int | MapDistanceBetweenTypes (const CUnitType &src, const Vec2i &pos1, const CUnitType &dst, const Vec2i &pos2) |
Returns the map diestance between to unittype as locations. | |
void | DrawUnitSelection (const CViewport &vp, const CUnit &unit) |
CurrentViewport. | |
void | MarkUnitFieldFlags (const CUnit &unit) |
Number of Units a team member has selected. | |
void | UnmarkUnitFieldFlags (const CUnit &unit) |
Unmark the field with the FieldFlags. | |
void | UpdateUnitSightRange (CUnit &unit) |
Update unit->CurrentSightRange. | |
CUnit * | MakeUnit (const CUnitType &type, CPlayer *player) |
Create a new unit. | |
CUnit * | MakeUnitAndPlace (const Vec2i &pos, const CUnitType &type, CPlayer *player) |
Create a new unit and place on map. | |
void | UnitLost (CUnit &unit) |
Handle the loss of a unit (food,...). | |
void | UnitClearOrders (CUnit &unit) |
Remove the Orders of a Unit. | |
void | UpdateForNewUnit (const CUnit &unit, int upgrade) |
void | NearestOfUnit (const CUnit &unit, const Vec2i &pos, Vec2i *dpos) |
CUnit * | GetFirstContainer (const CUnit &unit) |
void | UnitGoesUnderFog (CUnit &unit, const CPlayer &player) |
Call when an Unit goes under fog. | |
void | UnitGoesOutOfFog (CUnit &unit, const CPlayer &player) |
Call when an Unit goes out of fog. | |
void | UnitsOnTileMarkSeen (const CPlayer &player, int x, int y, int p) |
Marks a unit as seen. | |
void | UnitsOnTileMarkSeen (const CPlayer &player, unsigned int index, int p) |
void | UnitsOnTileUnmarkSeen (const CPlayer &player, int x, int y, int p) |
Unmarks a unit as seen. | |
void | UnitsOnTileUnmarkSeen (const CPlayer &player, unsigned int index, int p) |
void | UnitCountSeen (CUnit &unit) |
Does a recount for VisCount. | |
void | RescueUnits () |
Check for rescue each second. | |
int | DirectionToHeading (const Vec2i &dir) |
Convert direction (dx,dy) to heading (0-255). | |
void | CorrectWallDirections (CUnit &unit) |
Correct directions for placed wall. | |
void | CorrectWallNeighBours (CUnit &unit) |
Correct the surrounding walls. | |
void | UnitUpdateHeading (CUnit &unit) |
Update frame from heading. | |
void | UnitHeadingFromDeltaXY (CUnit &unit, const Vec2i &delta) |
Heading and frame from delta direction. | |
void | DropOutOnSide (CUnit &unit, int heading, const CUnit *container) |
void | DropOutNearest (CUnit &unit, const Vec2i &goalPos, const CUnit *container) |
void | DropOutAll (const CUnit &unit) |
Drop out all units in the unit. | |
CBuildRestrictionOnTop * | OnTopDetails (const CUnit &unit, const CUnitType *parent) |
Return the rule used to build this building. | |
CUnit * | CanBuildHere (const CUnit *unit, const CUnitType &type, const Vec2i &pos) |
bool | CanBuildOn (const Vec2i &pos, int mask) |
CUnit * | CanBuildUnitType (const CUnit *unit, const CUnitType &type, const Vec2i &pos, int real) |
FIXME: more docu. | |
int | ExtraDeathIndex (const char *death) |
Get the suitable animation frame depends of unit's damaged type. | |
CUnit * | UnitOnScreen (CUnit *unit, int x, int y) |
void | LetUnitDie (CUnit &unit) |
Let a unit die. | |
void | DestroyAllInside (CUnit &source) |
Destroy all units inside another unit. | |
int | ThreatCalculate (const CUnit &unit, const CUnit &dest) |
Calculate some value to measure the unit's priority for AI. | |
void | HitUnit (CUnit *attacker, CUnit &target, int damage, const Missile *missile=NULL) |
Hit unit with damage, if destroyed give attacker the points. | |
int | ViewPointDistance (const Vec2i &pos) |
Calculate the distance from current view point to coordinate. | |
int | ViewPointDistanceToUnit (const CUnit &dest) |
Calculate the distance from current view point to unit. | |
int | CanTarget (const CUnitType *type, const CUnitType *dest) |
Can this unit-type attack the other (destination). | |
int | CanTransport (const CUnit &transporter, const CUnit &unit) |
Can transporter transport the other unit. | |
std::string | UnitReference (const CUnit &unit) |
Generate a unit reference, a printable unique string for unit. | |
std::string | UnitReference (const CUnitPtr &unit) |
Generate a unit reference, a printable unique string for unit. | |
void | SaveUnit (const CUnit &unit, CFile &file) |
save unit-structure | |
void | InitUnits () |
Initialize unit module. | |
void | CleanUnits () |
Clean unit module. | |
void | DrawSelectionNone (Uint32, int, int, int, int) |
Draw nothing around unit. | |
void | DrawSelectionCircle (Uint32, int, int, int, int) |
Draw circle around unit. | |
void | DrawSelectionCircleWithTrans (Uint32, int, int, int, int) |
Draw circle filled with alpha around unit. | |
void | DrawSelectionRectangle (Uint32, int, int, int, int) |
Draw rectangle around unit. | |
void | DrawSelectionRectangleWithTrans (Uint32, int, int, int, int) |
Draw rectangle filled with alpha around unit. | |
void | DrawSelectionCorners (Uint32, int, int, int, int) |
Draw corners around unit. | |
void | DecorationCclRegister () |
Register CCL decorations features. | |
void | LoadDecorations () |
Load the decorations (health,mana) of units. | |
void | CleanDecorations () |
Clean the decorations (health,mana) of units. | |
void | DrawShadow (const CUnitType &type, int frame, const PixelPos &screenPos) |
Draw unit's shadow. | |
int | FindAndSortUnits (const CViewport &vp, std::vector< CUnit * > &table) |
Draw all units visible on map in viewport. | |
void | ShowOrder (const CUnit &unit) |
Show a unit's orders. | |
void | InitGroups () |
Initialize data structures for groups. | |
void | SaveGroups (CFile &file) |
Save groups. | |
void | CleanGroups () |
Cleanup groups. | |
int | GetNumberUnitsOfGroup (int num, GroupSelectionMode mode=SELECTABLE_BY_RECTANGLE_ONLY) |
Get the number of units in a particular group. | |
CUnit ** | GetUnitsOfGroup (int num) |
Get the array of units of a particular group. | |
void | ClearGroup (int num) |
Remove all units from a group. | |
void | AddToGroup (CUnit **units, int nunits, int num) |
Add the array of units to the group. | |
void | SetGroup (CUnit **units, int nunits, int num) |
Set the contents of a particular group with an array of units. | |
void | RemoveUnitFromGroups (CUnit &unit) |
Remove a unit from a group. | |
void | GroupCclRegister () |
Register CCL group features. | |
bool | IsGroupTainted (int num) |
void | SaveSelection () |
Save selection to restore after. | |
void | RestoreSelection () |
Restore selection. | |
void | UnSelectAll () |
Clear current selection. | |
void | ChangeTeamSelectedUnits (CPlayer &player, const std::vector< CUnit * > &units, int adjust) |
Changed TeamUnit Selection. | |
int | SelectUnit (CUnit &unit) |
Add a unit to selection. | |
void | SelectSingleUnit (CUnit &unit) |
Select one unit as selection. | |
void | UnSelectUnit (CUnit &unit) |
Remove a unit from selection. | |
int | ToggleSelectUnit (CUnit &unit) |
Add a unit to selected if not already selected, remove it otherwise. | |
int | SelectUnitsByType (CUnit &base) |
Select units from the same type (if selectable by rectangle). | |
int | ToggleUnitsByType (CUnit &base) |
Toggle units from the same type (if selectable by rectangle). | |
int | SelectGroup (int group_number, GroupSelectionMode mode=SELECTABLE_BY_RECTANGLE_ONLY) |
Select the units belonging to a particular group. | |
int | AddGroupFromUnitToSelection (CUnit &unit) |
Add the units from the same group as the one in parameter. | |
int | SelectGroupFromUnit (CUnit &unit) |
Select the units from the same group as the one in parameter. | |
int | SelectUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select the units in the selection rectangle. | |
int | SelectGroundUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select ground units in the selection rectangle. | |
int | SelectAirUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select flying units in the selection rectangle. | |
int | AddSelectedUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add the units in the selection rectangle to the current selection. | |
int | AddSelectedGroundUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add ground units in the selection rectangle to the current selection. | |
int | AddSelectedAirUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add flying units in the selection rectangle to the current selection. | |
void | InitSelections () |
Init selections. | |
void | SaveSelections (CFile &file) |
Save current selection state. | |
void | CleanSelections () |
Clean up selections. | |
void | SelectionCclRegister () |
Register CCL selection features. | |
void | UnitCclRegister () |
register CCL units features |
#define AIPRIORITY_BONUS 0x01000000 |
#define CANATTACK_BONUS 0x00010000 |
#define DISTANCE_FACTOR 0x00010000 |
#define HEALTH_FACTOR 0x00000001 |
#define INRANGE_BONUS 0x00100000 |
#define INRANGE_FACTOR 0x00001000 |
#define IsOnlySelected | ( | unit | ) | (NumSelected == 1 && Selected[0] == &(unit)) |
Check if unit is the currently only selected.
#define NextDirection 32 |
#define NoUnitP (CUnit *)0 |
#define PRIORITY_FACTOR 0x00001000 |
#define UnitNotSeen 0x7fffffff |
#define UnitNumber | ( | unit | ) | ((unit).UnitManagerData.GetUnitId()) |
Returns unit number (unique to this unit)
enum _directions_ |
int AddGroupFromUnitToSelection | ( | CUnit & | unit | ) |
Add the units from the same group as the one in parameter.
Add units from group of a particular unit to selection.
unit | unit belonging to the group to be selected. |
int AddSelectedAirUnitsInRectangle | ( | const PixelPos & | corner_topleft, | |
const PixelPos & | corner_bottomright | |||
) |
Add flying units in the selection rectangle to the current selection.
Add the air units in the rectangle to the current selection
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
int AddSelectedGroundUnitsInRectangle | ( | const PixelPos & | corner_topleft, | |
const PixelPos & | corner_bottomright | |||
) |
Add ground units in the selection rectangle to the current selection.
Add the ground units in the rectangle to the current selection
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
int AddSelectedUnitsInRectangle | ( | const PixelPos & | corner_topleft, | |
const PixelPos & | corner_bottomright | |||
) |
Add the units in the selection rectangle to the current selection.
Add the units in the rectangle to the current selection
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
void AddToGroup | ( | CUnit ** | units, | |
int | nunits, | |||
int | num | |||
) |
Add the array of units to the group.
Add units to group num contents from unit array "units"
units | Array of units to place into group. | |
nunits | Number of units in array. | |
num | Group number for storage. |
FIXME: more docu.
Can this unit-type attack the other (destination).
Can the source unit attack the destination unit.
source | Unit type pointer of the attacker. | |
dest | Unit type pointer of the target. |
Can transporter transport the other unit.
Can the transporter transport the other unit.
transporter | Unit which is the transporter. | |
unit | Unit which wants to go in the transporter. |
Changed TeamUnit Selection.
Change A Unit Selection from my Team
player | The Player who is selecting the units | |
units | The Units to add/remove | |
adjust | 0 = reset, 1 = remove units, 2 = add units |
void CleanDecorations | ( | ) |
Clean the decorations (health,mana) of units.
Clean decorations.
void CleanGroups | ( | ) |
Cleanup groups.
Clean up group part.
void CleanSelections | ( | ) |
Clean up selections.
Clean up the selection module.
void CleanUnits | ( | ) |
Clean unit module.
Clean up unit module.
void ClearGroup | ( | int | num | ) |
Remove all units from a group.
Clear contents of group num
num | Group number. |
void CorrectWallDirections | ( | CUnit & | unit | ) |
Correct directions for placed wall.
Correct direction for placed wall.
unit | The wall unit. |
void CorrectWallNeighBours | ( | CUnit & | unit | ) |
Correct the surrounding walls.
Correct the surrounding walls.
unit | The wall unit. |
void DecorationCclRegister | ( | ) |
Register CCL decorations features.
Register CCL features for decorations.
void DestroyAllInside | ( | CUnit & | source | ) |
Destroy all units inside another unit.
Destroy all units inside unit.
source | container. |
int DirectionToHeading | ( | const Vec2i & | delta | ) |
Convert direction (dx,dy) to heading (0-255).
Convert direction to heading.
delta | Delta. |
void DrawSelectionCircle | ( | Uint32 | color, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Draw circle around unit.
Show selected units with circle.
color | Color to draw circle | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
void DrawSelectionCircleWithTrans | ( | Uint32 | color, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Draw circle filled with alpha around unit.
Show selected units with circle.
color | Color to draw and fill circle. | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
void DrawSelectionCorners | ( | Uint32 | color, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Draw corners around unit.
Draw selected corners around the unit.
color | Color to draw corners. | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
void DrawSelectionNone | ( | Uint32 | , | |
int | , | |||
int | , | |||
int | , | |||
int | ||||
) |
Draw nothing around unit.
Don't show selected units.
color | Color to draw, nothing in this case. | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
void DrawSelectionRectangle | ( | Uint32 | color, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Draw rectangle around unit.
Draw selected rectangle around the unit.
color | Color to draw rectangle. | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
void DrawSelectionRectangleWithTrans | ( | Uint32 | color, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
Draw rectangle filled with alpha around unit.
Draw selected rectangle around the unit.
color | Color to draw and fill rectangle. | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
Draw unit's shadow.
Draw unit's shadow.
type | Pointer to the unit type. | |
frame | Frame number | |
screenPos | Screen position of the unit. |
CurrentViewport.
CurrentViewport.
Show selection marker around a unit.
unit | Pointer to unit. |
void DropOutAll | ( | const CUnit & | source | ) |
Drop out all units in the unit.
Drop out all units inside unit.
source | All units inside source are dropped out. |
unit | Unit to drop out. | |
heading | Direction in which the unit should appear. | |
container | Unit "containing" unit to drop (may be different of unit.Container). |
int ExtraDeathIndex | ( | const char * | death | ) |
Get the suitable animation frame depends of unit's damaged type.
Find the index of a extra death type
Draw all units visible on map in viewport.
Find all units to draw in viewport.
vp | Viewport to be drawn. | |
table | Table of units to return in sorted order |
Return the unit not transported, by viewing the container recursively.
unit | unit from where look the first conatiner. |
int GetNumberUnitsOfGroup | ( | int | num, | |
GroupSelectionMode | mode | |||
) |
Get the number of units in a particular group.
Return the number of units of group num
num | Group number. |
CUnit** GetUnitsOfGroup | ( | int | num | ) |
Get the array of units of a particular group.
Return the units of group num
num | Group number. |
void GroupCclRegister | ( | ) |
Register CCL group features.
Register CCL features for groups.
Hit unit with damage, if destroyed give attacker the points.
Unit is hit by missile or other damage.
attacker | Unit that attacks. | |
target | Unit that is hit. | |
damage | How many damage to take. | |
missile | Which missile took the damage. |
void InitGroups | ( | ) |
Initialize data structures for groups.
Initialize data structures for groups.
Initialize group part.
void InitSelections | ( | ) |
Init selections.
Initialize the selection module.
void InitUnits | ( | ) |
Initialize unit module.
Initialize unit module.
bool IsGroupTainted | ( | int | num | ) |
void LetUnitDie | ( | CUnit & | unit | ) |
Let a unit die.
Let an unit die.
unit | Unit to be destroyed. |
void LoadDecorations | ( | ) |
Load the decorations (health,mana) of units.
Load decoration.
Create a new unit.
Create a new unit.
type | Pointer to unit-type. | |
player | Pointer to owning player. |
Create a new unit and place on map.
int MapDistanceBetweenTypes | ( | const CUnitType & | src, | |
const Vec2i & | pos1, | |||
const CUnitType & | dst, | |||
const Vec2i & | pos2 | |||
) |
Returns the map diestance between to unittype as locations.
void MarkUnitFieldFlags | ( | const CUnit & | unit | ) |
Number of Units a team member has selected.
Mark the field with the FieldFlags.
Mark the field with the FieldFlags.
unit | unit to mark. |
CBuildRestrictionOnTop* OnTopDetails | ( | const CUnit & | unit, | |
const CUnitType * | parent | |||
) |
Return the rule used to build this building.
Find the building restriction that gives me this unit built on top Allows you to define how the restriction is effecting the build
unit | the unit that is "OnTop" | |
parent | the parent unit if known. (guess otherwise) |
void RemoveUnitFromGroups | ( | CUnit & | unit | ) |
Remove a unit from a group.
Remove unit from its groups
unit | Unit to remove from group. |
void RescueUnits | ( | ) |
Check for rescue each second.
Rescue units.
Look through all rescueable players, if they could be rescued.
void RestoreSelection | ( | ) |
Restore selection.
Restore selection.
void SaveGroups | ( | CFile & | file | ) |
Save groups.
Save groups.
file | Output file. |
void SaveSelection | ( | ) |
Save selection to restore after.
Save selection to restore after.
Save selection to restore after.
void SaveSelections | ( | CFile & | file | ) |
Save current selection state.
Save current selection state.
file | Output file. |
save unit-structure
Save the state of a unit to file.
unit | Unit pointer to be saved. | |
file | Output file. |
int SelectAirUnitsInRectangle | ( | const PixelPos & | corner_topleft, | |
const PixelPos & | corner_bottomright | |||
) |
Select flying units in the selection rectangle.
Select own air units in a rectangle.
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
void SelectedUnitChanged | ( | ) |
Called whenever the selected unit was updated.
The selected unit has been altered.
int SelectGroundUnitsInRectangle | ( | const PixelPos & | corner_topleft, | |
const PixelPos & | corner_bottomright | |||
) |
Select ground units in the selection rectangle.
Select own ground units in a rectangle.
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
int SelectGroup | ( | int | group_number, | |
GroupSelectionMode | mode | |||
) |
Select the units belonging to a particular group.
Change selected units to units from group group_number Doesn't change the selection if the group has no unit.
group_number | number of the group to be selected. |
int SelectGroupFromUnit | ( | CUnit & | unit | ) |
Select the units from the same group as the one in parameter.
Select units from group of a particular unit. Doesn't change the selection if the group has no unit, or the unit doesn't belong to any group.
unit | unit belonging to the group to be selected. |
void SelectionCclRegister | ( | ) |
Register CCL selection features.
Register CCL features for selections.
void SelectSingleUnit | ( | CUnit & | unit | ) |
Select one unit as selection.
Select a single unit, unselecting the previous ones
unit | Pointer to unit to be selected. |
int SelectUnit | ( | CUnit & | unit | ) |
Add a unit to selection.
Add a unit to the other selected units.
unit | Pointer to unit to add. |
int SelectUnitsByType | ( | CUnit & | base | ) |
Select units from the same type (if selectable by rectangle).
Select units from a particular type and belonging to the local player.
The base is included in the selection and defines the type of the other units to be selected.
base | Select all units of same type. |
FIXME: should always select the nearest 9 units to the base!
Select the units in the selection rectangle.
Select units in a rectangle. Proceed in order in none found:
corner_topleft,start | of selection rectangle | |
corner_bottomright | end of selection rectangle |
void SetGroup | ( | CUnit ** | units, | |
int | nunits, | |||
int | num | |||
) |
Set the contents of a particular group with an array of units.
Set group num contents to unit array "units"
units | Array of units to place into group. | |
nunits | Number of units in array. | |
num | Group number for storage. |
void ShowOrder | ( | const CUnit & | unit | ) |
Show a unit's orders.
Show the current order of a unit.
unit | Pointer to the unit. |
Calculate some value to measure the unit's priority for AI.
int ToggleSelectUnit | ( | CUnit & | unit | ) |
Add a unit to selected if not already selected, remove it otherwise.
Toggle the selection of a unit in a group of selected units
unit | Pointer to unit to be toggled. |
int ToggleUnitsByType | ( | CUnit & | base | ) |
Toggle units from the same type (if selectable by rectangle).
Toggle units from a particular type and belonging to the local player.
The base is included in the selection and defines the type of the other units to be selected.
base | Toggle all units of same type. |
void UnitCclRegister | ( | ) |
register CCL units features
Register CCL features for unit.
void UnitClearOrders | ( | CUnit & | unit | ) |
Remove the Orders of a Unit.
Removes all orders from a unit.
unit | The unit that will have all its orders cleared |
void UnitCountSeen | ( | CUnit & | unit | ) |
Does a recount for VisCount.
Recalculates a units visiblity count. This happens really often, Like every time a unit moves. It's really fast though, since we have per-tile counts.
unit | pointer to the unit to check if seen |
Call when an Unit goes out of fog.
This function should get called when a unit goes out of fog of war.
unit | The unit that goes out of fog. | |
player | The player the unit goes out of fog for. |
Call when an Unit goes under fog.
This function should get called when a unit goes under fog of war.
unit | The unit that goes under fog. | |
player | The player the unit goes out of fog for. |
Heading and frame from delta direction.
void UnitLost | ( | CUnit & | unit | ) |
Handle the loss of a unit (food,...).
Update information for lost units.
unit | Pointer to unit. |
Select units on screen. (x, y are in pixels relative to map 0,0). Not GAMEPLAY safe, uses ReplayRevealMap
More units on same position. Cycle through units. ounit is the old one. First take highest unit.
ounit | Old selected unit. | |
x | X pixel position. | |
y | Y pixel position. |
std::string UnitReference | ( | const CUnitPtr & | unit | ) |
Generate a unit reference, a printable unique string for unit.
Generate a unit reference, a printable unique string for unit.
std::string UnitReference | ( | const CUnit & | unit | ) |
Generate a unit reference, a printable unique string for unit.
Generate a unit reference, a printable unique string for unit.
void UnitsOnTileMarkSeen | ( | const CPlayer & | player, | |
const unsigned int | index, | |||
int | cloak | |||
) |
Mark all units on a tile as now visible.
player | The player this is for. | |
x | x location to check | |
y | y location to check | |
cloak | If we mark cloaked units too. |
void UnitsOnTileMarkSeen | ( | const CPlayer & | player, | |
int | x, | |||
int | y, | |||
int | p | |||
) |
Marks a unit as seen.
void UnitsOnTileUnmarkSeen | ( | const CPlayer & | player, | |
const unsigned int | index, | |||
int | cloak | |||
) |
This function unmarks units on x, y as seen. It uses a reference count.
player | The player to mark for. | |
x | x location to check if building is on, and mark as seen | |
y | y location to check if building is on, and mark as seen | |
cloak | If this is for cloaked units. |
void UnitsOnTileUnmarkSeen | ( | const CPlayer & | player, | |
int | x, | |||
int | y, | |||
int | p | |||
) |
Unmarks a unit as seen.
void UnitUpdateHeading | ( | CUnit & | unit | ) |
Update frame from heading.
Update sprite frame for new heading.
void UnmarkUnitFieldFlags | ( | const CUnit & | unit | ) |
Unmark the field with the FieldFlags.
Mark the field with the FieldFlags.
unit | unit to mark. |
void UnSelectAll | ( | ) |
Clear current selection.
Unselect all the units in the current selection
void UnSelectUnit | ( | CUnit & | unit | ) |
Remove a unit from selection.
Unselect unit
unit | Pointer to unit to be unselected. |
void UpdateForNewUnit | ( | const CUnit & | unit, | |
int | upgrade | |||
) |
unit | New unit pointer. | |
upgrade | True unit was upgraded. |
void UpdateUnitSightRange | ( | CUnit & | unit | ) |
Update unit->CurrentSightRange.
Update the Unit Current sight range to good value and transported units inside.
unit | unit to update SightRange |
int ViewPointDistance | ( | const Vec2i & | pos | ) |
Calculate the distance from current view point to coordinate.
int ViewPointDistanceToUnit | ( | const CUnit & | dest | ) |
Calculate the distance from current view point to unit.
Compute the distance from the view point to a given unit.
dest | Distance to this unit. |
const CViewport* CurrentViewport |
Config: spend resources for building with multiple workers.
void(* DrawSelection)(Uint32, int, int, int, int) |
Show unit's name for some time.
Show that units are selected.
color | FIXME | |
x1,y1 | Coordinates of the top left corner. | |
x2,y2 | Coordinates of the bottom right corner. |
Config: training queues enabled.
bool EnableTrainingQueue |
Show unit's name for some time.
int MaxSelectable |
How many units selected.
int NumSelected |
teams currently selected units
Lua handler count.
Config: reveal attacker enabled.
bool RevealAttacker |
Config: building capture enabled.
unsigned long ShowNameDelay |
Show orders for some time.
unsigned long ShowNameTime |
Delay to show unit's name.
unsigned long ShowOrdersCount |
int TeamNumSelected[PlayerMax] |
how many units selected
CUnit** TeamSelected[PlayerMax] |
currently selected units