_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "settings.h"
#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 small ai can ignore non aggressive targets if searching attacker. More... | |
class | CPreference |
unit.h - The unit headerfile. | |
#define | PRIORITY_FACTOR 0x00080000 |
#define | HEALTH_FACTOR 0x00000001 |
#define | DISTANCE_FACTOR 0x00010000 |
#define | INRANGE_FACTOR 0x00008000 |
#define | INRANGE_BONUS 0x01000000 |
#define | CANATTACK_BONUS 0x00080000 |
#define | AIPRIORITY_BONUS 0x04000000 |
#define | AT_ATTACKED_BY_FACTOR 0x40000000 |
#define | AT_THREAT_FACTOR 0x20000000 |
#define | AT_PRIORITY_OFFSET 15 |
#define | AT_DISTANCE_OFFSET 7 |
#define | AT_PRIORITY_MASK_HI 0xFFFF8000 |
#define | AT_FARAWAY_REDUCE_OFFSET 14 |
#define | NextDirection 32 |
#define | UnitNotSeen 0x7fffffff |
#define | NoUnitP (CUnit *)0 |
#define | UnitNumber(unit) ((unit).UnitManagerData.GetUnitId()) |
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. More... | |
unsigned long | ShowOrdersCount |
All sprite's infos. More... | |
unsigned long | ShowNameDelay |
Show orders for some time. More... | |
unsigned long | ShowNameTime |
Delay to show unit's name. More... | |
bool | EnableTrainingQueue |
Show unit's name for some time. More... | |
bool | EnableBuildingCapture |
Config: training queues enabled. More... | |
bool | RevealAttacker |
Config: building capture enabled. More... | |
int | ResourcesMultiBuildersMultiplier |
Config: reveal attacker enabled. More... | |
const CViewport * | CurrentViewport |
Config: spend resources for building with multiple workers. More... | |
void(* | DrawSelection )(IntColor, int, int, int, int) |
Show unit's name for some time. More... | |
unsigned int | MaxSelectable |
std::vector< CUnit * > | Selected |
How many units could be selected. More... | |
void(*)(IntColor, int, int, int, int) | DrawSelectionEllipse (float factor) |
Draw ellipse around unit. More... | |
void | SelectedUnitChanged () |
Called whenever the selected unit was updated. More... | |
int | MapDistanceBetweenTypes (const CUnitType &src, const Vec2i &pos1, const CUnitType &dst, const Vec2i &pos2) |
Returns the map distance between to unittype as locations. More... | |
void | DrawUnitSelection (const CViewport &vp, const CUnit &unit) |
CurrentViewport. More... | |
void | MarkUnitFieldFlags (const CUnit &unit) |
currently selected units More... | |
void | UnmarkUnitFieldFlags (const CUnit &unit) |
Unmark the field with the FieldFlags. More... | |
void | UpdateUnitSightRange (CUnit &unit) |
Update unit->CurrentSightRange. More... | |
CUnit * | MakeUnit (const CUnitType &type, CPlayer *player) |
Create a new unit. More... | |
CUnit * | MakeUnitAndPlace (const Vec2i &pos, const CUnitType &type, CPlayer *player) |
Create a new unit and place on map. More... | |
void | FindNearestDrop (const CUnitType &type, const Vec2i &goalPos, Vec2i &resPos, int heading) |
Find the nearest position at which unit can be placed. More... | |
void | UnitLost (CUnit &unit) |
Handle the loss of a unit (food,...) More... | |
void | UnitClearOrders (CUnit &unit) |
Remove the Orders of a Unit. More... | |
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. More... | |
void | UnitGoesOutOfFog (CUnit &unit, const CPlayer &player) |
Call when an Unit goes out of fog. More... | |
void | UnitCountSeen (CUnit &unit) |
Does a recount for VisCount. More... | |
void | RescueUnits () |
Check for rescue each second. More... | |
int | DirectionToHeading (const Vec2i &dir) |
Convert direction (dx,dy) to heading (0-255) More... | |
int | DirectionToHeading (const PixelDiff &dir) |
Convert direction (dx,dy) to heading (0-255) More... | |
void | CorrectWallDirections (CUnit &unit) |
Correct directions for placed wall. More... | |
void | CorrectWallNeighBours (CUnit &unit) |
Correct the surrounding walls. More... | |
void | UnitUpdateHeading (CUnit &unit) |
Update frame from heading. More... | |
void | UnitHeadingFromDeltaXY (CUnit &unit, const Vec2i &delta) |
Heading and frame from delta direction. More... | |
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. More... | |
CBuildRestrictionOnTop * | OnTopDetails (const CUnit &unit, const CUnitType *parent) |
Return the rule used to build this building. More... | |
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. More... | |
int | ExtraDeathIndex (const char *death) |
Get the suitable animation frame depends of unit's damaged type. More... | |
CUnit * | UnitOnScreen (int x, int y) |
Get unit under cursor. More... | |
void | LetUnitDie (CUnit &unit, bool suicide=false) |
Let a unit die. More... | |
void | DestroyAllInside (CUnit &source) |
Destroy all units inside another unit. More... | |
int | ThreatCalculate (const CUnit &unit, const CUnit &dest) |
Calculate some value to measure the unit's priority for AI. More... | |
int | TargetPriorityCalculate (const CUnit *const attacker, const CUnit *const dest) |
bool | InReactRange (const CUnit &unit, const CUnit &target) |
Is target within reaction range of this unit? More... | |
bool | InAttackRange (const CUnit &unit, const CUnit &target) |
Is target within attack range of this unit? More... | |
bool | InAttackRange (const CUnit &unit, const Vec2i &tilePos) |
Is tile within attack range of this unit? More... | |
Vec2i | GetRndPosInDirection (const Vec2i &srcPos, const CUnit &dirUnit, const bool dirFrom, const int minRange, const int devRadius, const int rangeDev=3) |
Return randomly selected position in direction (to/from) dirUnit from srcPos. More... | |
Vec2i | GetRndPosInDirection (const Vec2i &srcPos, const Vec2i &dirPos, const bool dirFrom, const int minRange, const int devRadius, const int rangeDev=3) |
Return randomly selected position in direction (to/from) dirPos from srcPos. More... | |
void | HitUnit (CUnit *attacker, CUnit &target, int damage, const Missile *missile=NULL) |
Hit unit with damage, if destroyed give attacker the points. More... | |
int | ViewPointDistance (const Vec2i &pos) |
Calculate the distance from current view point to coordinate. More... | |
int | ViewPointDistanceToUnit (const CUnit &dest) |
Calculate the distance from current view point to unit. More... | |
int | CanTarget (const CUnitType &type, const CUnitType &dest) |
Can this unit-type attack the other (destination) More... | |
int | CanTransport (const CUnit &transporter, const CUnit &unit) |
Can transporter transport the other unit. More... | |
std::string | UnitReference (const CUnit &unit) |
Generate a unit reference, a printable unique string for unit. More... | |
std::string | UnitReference (const CUnitPtr &unit) |
Generate a unit reference, a printable unique string for unit. More... | |
void | SaveUnit (const CUnit &unit, CFile &file) |
save unit-structure More... | |
void | InitUnits () |
Initialize unit module. More... | |
void | CleanUnits () |
Clean unit module. More... | |
void | DrawSelectionNone (IntColor, int, int, int, int) |
Draw nothing around unit. More... | |
void | DrawSelectionCircle (IntColor, int, int, int, int) |
Draw circle around unit. More... | |
void | DrawSelectionCircleWithTrans (IntColor, int, int, int, int) |
Draw circle filled with alpha around unit. More... | |
void | DrawSelectionRectangle (IntColor, int, int, int, int) |
Draw rectangle around unit. More... | |
void | DrawSelectionRectangleWithTrans (IntColor, int, int, int, int) |
Draw rectangle filled with alpha around unit. More... | |
void | DrawSelectionCorners (IntColor, int, int, int, int) |
Draw corners around unit. More... | |
void | DecorationCclRegister () |
Register CCL decorations features. More... | |
void | LoadDecorations () |
Load the decorations (health,mana) of units. More... | |
void | CleanDecorations () |
Clean the decorations (health,mana) of units. More... | |
void | DrawShadow (const CUnitType &type, int frame, const PixelPos &screenPos) |
Draw unit's shadow. More... | |
int | FindAndSortUnits (const CViewport &vp, std::vector< CUnit * > &table) |
Draw all units visible on map in viewport. More... | |
void | ShowOrder (const CUnit &unit) |
Show a unit's orders. More... | |
void | SaveGroups (CFile &file) |
Save groups. More... | |
void | CleanGroups () |
Cleanup groups. More... | |
const std::vector< CUnit * > & | GetUnitsOfGroup (int num) |
Get the array of units of a particular group. More... | |
void | ClearGroup (int num) |
Remove all units from a group. More... | |
void | AddToGroup (CUnit **units, unsigned int nunits, int num) |
Add the array of units to the group. More... | |
void | SetGroup (CUnit **units, unsigned int nunits, int num) |
Set the contents of a particular group with an array of units. More... | |
void | RemoveUnitFromGroups (CUnit &unit) |
Remove a unit from a group. More... | |
void | GroupCclRegister () |
Register CCL group features. More... | |
bool | IsGroupTainted (int num) |
bool | IsOnlySelected (const CUnit &unit) |
Check if unit is the currently only selected. More... | |
void | SaveSelection () |
Save selection to restore after. More... | |
void | RestoreSelection () |
Restore selection. More... | |
void | UnSelectAll () |
Clear current selection. More... | |
void | ChangeTeamSelectedUnits (CPlayer &player, const std::vector< CUnit * > &units) |
Changed TeamUnit Selection. More... | |
int | SelectUnit (CUnit &unit) |
Add a unit to selection. More... | |
void | SelectSingleUnit (CUnit &unit) |
Select one unit as selection. More... | |
void | UnSelectUnit (CUnit &unit) |
Remove a unit from selection. More... | |
int | ToggleSelectUnit (CUnit &unit) |
Add a unit to selected if not already selected, remove it otherwise. More... | |
int | SelectUnitsByType (CUnit &base) |
Select units from the same type (if selectable by rectangle) More... | |
int | ToggleUnitsByType (CUnit &base) |
Toggle units from the same type (if selectable by rectangle) More... | |
int | SelectGroup (int group_number, GroupSelectionMode mode=SELECTABLE_BY_RECTANGLE_ONLY) |
Select the units belonging to a particular group. More... | |
int | AddGroupFromUnitToSelection (CUnit &unit) |
Add the units from the same group as the one in parameter. More... | |
int | SelectGroupFromUnit (CUnit &unit) |
Select the units from the same group as the one in parameter. More... | |
int | SelectUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select the units in the selection rectangle. More... | |
int | SelectGroundUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select ground units in the selection rectangle. More... | |
int | SelectAirUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Select flying units in the selection rectangle. More... | |
int | AddSelectedUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add the units in the selection rectangle to the current selection. More... | |
int | AddSelectedGroundUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add ground units in the selection rectangle to the current selection. More... | |
int | AddSelectedAirUnitsInRectangle (const PixelPos &corner_topleft, const PixelPos &corner_bottomright) |
Add flying units in the selection rectangle to the current selection. More... | |
void | SaveSelections (CFile &file) |
Save current selection state. More... | |
void | CleanSelections () |
Clean up selections. More... | |
void | SelectionCclRegister () |
Register CCL selection features. More... | |
void | UnitCclRegister () |
register CCL units features More... | |
#define AIPRIORITY_BONUS 0x04000000 |
#define AT_ATTACKED_BY_FACTOR 0x40000000 |
#define AT_DISTANCE_OFFSET 7 |
#define AT_FARAWAY_REDUCE_OFFSET 14 |
#define AT_PRIORITY_MASK_HI 0xFFFF8000 |
#define AT_PRIORITY_OFFSET 15 |
#define AT_THREAT_FACTOR 0x20000000 |
#define CANATTACK_BONUS 0x00080000 |
#define DISTANCE_FACTOR 0x00010000 |
#define HEALTH_FACTOR 0x00000001 |
#define INRANGE_BONUS 0x01000000 |
#define INRANGE_FACTOR 0x00008000 |
#define NextDirection 32 |
#define NoUnitP (CUnit *)0 |
#define PRIORITY_FACTOR 0x00080000 |
#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 |
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. |
Can build unit here. Hall too near to goldmine. Refinery or shipyard too near to oil patch.
unit | Unit doing the building |
type | unit-type to be checked. |
pos | Map position. |
bool CanBuildOn | ( | const Vec2i & | pos, |
int | mask | ||
) |
Can build on this point.
pos | tile map position. |
mask | terrain mask |
FIXME: more docu.
Can build unit-type at this point.
unit | Worker that want to build the building or NULL. |
type | Building unit-type. |
pos | tile map position. |
real | Really build, or just placement |
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 |
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. |
Correct directions for placed wall.
Correct direction for placed wall.
unit | The wall unit. |
Correct the surrounding walls.
Correct the surrounding walls.
unit | The wall unit. |
void DecorationCclRegister | ( | ) |
Register CCL decorations features.
Register CCL features for decorations.
Destroy all units inside another unit.
Destroy all units inside unit.
source | container. |
int DirectionToHeading | ( | const PixelDiff & | delta | ) |
Convert direction (dx,dy) to heading (0-255)
Convert direction to heading.
delta | Delta. |
int DirectionToHeading | ( | const Vec2i & | delta | ) |
Convert direction (dx,dy) to heading (0-255)
Convert direction to heading.
delta | Delta. |
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. |
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. |
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. |
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. |
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. |
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. |
Drop out all units in the unit.
Drop out all units inside unit.
source | All units inside source are dropped out. |
Place a unit on the map nearest to goalPos.
unit | Unit to drop out. |
goalPos | Goal map tile position. |
addx | Tile width of unit it's dropping out of. |
addy | Tile height of unit it's dropping out of. |
Place a unit on the map to the side of a unit.
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 |
Find the nearest position at which unit can be placed.
Find the nearest position at which unit can be placed.
type | Type of the dropped unit. |
goalPos | Goal map tile position. |
resPos | Holds the nearest point. |
heading | preferense side to drop out of. |
Return the unit not transported, by viewing the container recursively.
unit | unit from where look the first conatiner. |
Vec2i GetRndPosInDirection | ( | const Vec2i & | srcPos, |
const CUnit & | dirUnit, | ||
const bool | dirFrom, | ||
const int | minRange, | ||
const int | devRadius, | ||
const int | rangeDev | ||
) |
Return randomly selected position in direction (to/from) dirUnit from srcPos.
Returns end position of randomly generated vector form srcPos in direction to/from dirUnit
srcPos | Vector origin |
dirUnit | Position to determine vector direction |
dirFrom | Direction of src-dir. True if "from" dirPos, false if "to" dirPos |
minRange | Minimal range to new position |
devRadius | Diviation radius |
rangeDev | Range deviation |
Vec2i GetRndPosInDirection | ( | const Vec2i & | srcPos, |
const Vec2i & | dirPos, | ||
const bool | dirFrom, | ||
const int | minRange, | ||
const int | devRadius, | ||
const int | rangeDev | ||
) |
Return randomly selected position in direction (to/from) dirPos from srcPos.
Returns end position of randomly generated vector form srcPos in direction to/from dirPos
srcPos | Vector origin |
dirPos | Position to determine vector direction |
dirFrom | Direction of src-dir. True if "from" dirPos, false if "to" dirPos |
minRange | Minimal range to new position |
devRadius | Diviation radius |
rangeDev | Range deviation |
const std::vector<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. |
Is target within attack range of this unit?
Returns true, if target is in attack range of the unit and there are no obstacles between them (when inside caves)
unit | Unit to check for. |
target | Checked target. |
Is tile within attack range of this unit?
Returns true, if tile is in attack range of the unit and there are no obstacles between them (when inside caves)
unit | Unit to check for. |
pos | Checked position. |
void InitUnits | ( | ) |
Initialize unit module.
Initialize unit module.
Is target within reaction range of this unit?
Returns true, if target is in reaction range of the unit
unit | Unit to check for. |
target | Checked target. |
bool IsGroupTainted | ( | int | num | ) |
bool IsOnlySelected | ( | const CUnit & | unit | ) |
Check if unit is the currently only selected.
Check if unit is the currently only selected.
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.
Create new unit and place on map.
pos | map tile position. |
type | Pointer to unit-type. |
player | Pointer to owning player. |
int MapDistanceBetweenTypes | ( | const CUnitType & | src, |
const Vec2i & | pos1, | ||
const CUnitType & | dst, | ||
const Vec2i & | pos2 | ||
) |
Returns the map distance between to unittype as locations.
Returns the map distance between two points with unit type.
src | src unittype |
pos1 | map tile position of src (upperleft). |
dst | Unit type to take into account. |
pos2 | map tile position of dst. |
currently selected units
Mark the field with the FieldFlags.
Mark the field with the FieldFlags.
unit | unit to mark. |
Find nearest point of unit.
unit | Pointer to unit. |
pos | tile map position. |
dpos | Out: nearest point tile map position to (tx,ty). |
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) |
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 SaveSelection | ( | ) |
Save selection to restore after.
Save selection to restore after.
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.
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: 0 can't happen. Maybe when scripting will use it?
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 |
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. |
Show a unit's orders.
Show the current order of a unit.
unit | Pointer to the unit. |
Check if target attacks us (or has us as goal for any action)
Unit can attack back.
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. |
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. |
FIXME: toggle not written FIXME: should always select the nearest 9 units to the base!
void UnitCclRegister | ( | ) |
register CCL units features
Register CCL features for unit.
Remove the Orders of a Unit.
Removes all orders from a unit.
unit | The unit that will have all its orders cleared |
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.
Change unit heading/frame from delta direction x, y.
unit | Unit for new direction looking. |
delta | map tile delta direction. |
Handle the loss of a unit (food,...)
Update information for lost units.
unit | Pointer to unit. |
CUnit* UnitOnScreen | ( | int | x, |
int | y | ||
) |
Get unit under cursor.
Unit on map screen.
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. First take highest unit.
x | X pixel position. |
y | Y pixel position. |
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.
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.
Update frame from heading.
Update sprite frame for new heading.
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
Remove a unit from selection.
Unselect unit
unit | Pointer to unit to be unselected. |
Update for new unit. Food and income ...
unit | New unit pointer. |
upgrade | True unit was upgraded. |
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.
Compute the distance from the view point to a given point.
pos | map tile position. |
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.
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. |
bool EnableBuildingCapture |
Config: training queues enabled.
bool EnableTrainingQueue |
Show unit's name for some time.
unsigned int MaxSelectable |
CPreference Preference |
Lua handler count.
int ResourcesMultiBuildersMultiplier |
Config: reveal attacker enabled.
bool RevealAttacker |
Config: building capture enabled.
Config: building capture enabled.
std::vector<CUnit *> Selected |
How many units could be selected.
How many units could be selected.
unsigned long ShowNameDelay |
Show orders for some time.
unsigned long ShowNameTime |
Delay to show unit's name.
unsigned long ShowOrdersCount |
All sprite's infos.