____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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>
Public Member Functions | |
| CUnit () | |
| void | Init () |
| bool | IsIdle () const |
| void | ClearAction () |
| Increase a unit's reference count. | |
| void | RefsIncrease () |
| Decrease a unit's reference count. | |
| void | RefsDecrease () |
| Initialize unit structure with default values. | |
| void | Init (CUnitType *type) |
| Assign unit to player. | |
| void | AssignToPlayer (CPlayer *player) |
| Draw a single unit. | |
| void | Draw () const |
| Place a unit on map. | |
| void | Place (int x, int y) |
| Move unit to tile(x, y). (Do special stuff : vision, cachelist, pathfinding). | |
| void | MoveToXY (int x, int y) |
| Add a unit inside a container. Only deal with list stuff. | |
| void | AddInContainer (CUnit *host) |
| Change owner of unit. | |
| void | ChangeOwner (CPlayer *newplayer) |
| Remove unit from map/groups/... | |
| void | Remove (CUnit *host) |
| Release a unit. | |
| void | Release () |
| Returns true, if unit is directly seen by an allied unit. | |
| bool | IsVisible (const CPlayer *player) const |
| Returns true, if unit is visible as a goal. | |
| bool | IsVisibleAsGoal (const CPlayer *player) const |
| Returns true, if the unit is alive and on the map. | |
| bool | IsAliveOnMap () const |
| Returns true, if unit is Visible for game logic on the map. | |
| bool | IsVisibleOnMap (const CPlayer *player) const |
| Returns true if unit is visible on minimap. Only for ThisPlayer. | |
| bool | IsVisibleOnMinimap () const |
| Returns true if unit is visible in an viewport. Only for ThisPlayer. | |
| bool | IsVisibleInViewport (const CViewport *vp) const |
| Returns true, if unit is visible on current map view (any viewport). | |
| bool | IsVisibleOnScreen () const |
| void | GetMapArea (int *sx, int *sy, int *ex, int *ey) const |
| bool | IsEnemy (const CPlayer *x) const |
| bool | IsEnemy (const CUnit *x) const |
| bool | IsAllied (const CPlayer *x) const |
| bool | IsAllied (const CUnit *x) const |
| bool | IsSharedVision (const CPlayer *x) const |
| bool | IsSharedVision (const CUnit *x) const |
| bool | IsBothSharedVision (const CPlayer *x) const |
| bool | IsBothSharedVision (const CUnit *x) const |
| bool | IsTeamed (const CPlayer *x) const |
| bool | IsTeamed (const CUnit *x) const |
| bool | IsUnusable () const |
Public Attributes | |
| unsigned long | Refs |
| Reference counter. | |
| int | Slot |
| Assigned slot number. | |
| CUnit ** | UnitSlot |
| Slot pointer of Units. | |
| CUnit ** | PlayerSlot |
| Slot pointer of Player->Units. | |
| CUnit * | Next |
| Generic link pointer (on map). | |
| int | InsideCount |
| Number of units inside. | |
| int | BoardCount |
| Number of units transported inside. | |
| CUnit * | UnitInside |
| Pointer to one of the units inside. | |
| CUnit * | Container |
| Pointer to the unit containing it (or 0). | |
| CUnit * | NextContained |
| Next unit in the container. | |
| CUnit * | PrevContained |
| Previous unit in the container. | |
| int | X |
| Map position X. | |
| int | Y |
| Map position Y. | |
| CUnitType * | Type |
| Pointer to unit-type (peon,...). | |
| CPlayer * | Player |
| Owner of this unit. | |
| CUnitStats * | Stats |
| Current unit stats. | |
| int | CurrentSightRange |
| Unit's Current Sight Range. | |
| CUnitColors * | Colors |
| Player colors. | |
| signed char | IX |
| X image displacement to map position. | |
| signed char | IY |
| Y image displacement to map position. | |
| int | Frame |
| Image frame: <0 is mirrored. | |
| unsigned | Direction: 8 |
| angle (0-255) unit looking | |
| unsigned long | Attacked |
| gamecycle unit was last attacked | |
| unsigned | Burning: 1 |
| unit is burning | |
| unsigned | Destroyed: 1 |
| unit is destroyed pending reference | |
| unsigned | Removed: 1 |
| unit is removed (not on map) | |
| unsigned | Selected: 1 |
| unit is selected | |
| unsigned | Constructed: 1 |
| Unit is in construction. | |
| unsigned | Boarded: 1 |
| Unit is on board a transporter. | |
| unsigned | TeamSelected |
| unit is selected by a team member. | |
| CPlayer * | RescuedFrom |
| int | VisCount [PlayerMax] |
| Unit visibility counts. | |
| struct CUnit::_unit_seen_ | Seen |
| CVariable * | Variable |
| array of User Defined variables. | |
| unsigned long | TTL |
| time to live | |
| int | GroupId |
| unit belongs to this group id | |
| int | LastGroup |
| unit belongs to this last group | |
| int | ResourcesHeld [MaxCosts] |
| Resources held by a unit. | |
| unsigned | ProductionEfficiency: 8 |
| Production efficiency. | |
| unsigned | SubAction: 8 |
| sub-action of unit | |
| unsigned | Wait |
| action counter | |
| unsigned | State: 8 |
| action state | |
| unsigned | Blink: 3 |
| Let selection rectangle blink. | |
| unsigned | Moving: 1 |
| The unit is moving. | |
| unsigned | ReCast: 1 |
| Recast again next cycle. | |
| struct CUnit::_unit_anim_ | Anim |
| char | OrderCount |
| how many orders in queue | |
| char | OrderFlush |
| cancel current order, take next | |
| std::vector< COrder * > | Orders |
| orders to process | |
| COrder | SavedOrder |
| order to continue after current | |
| COrder | NewOrder |
| order for new trained units | |
| char * | AutoCastSpell |
| spells to auto cast | |
| unsigned | AutoRepair: 1 |
| True if unit tries to repair on still action. | |
| union CUnit::_order_data_ | Data |
| Storage room for different commands. | |
| CUnit * | Goal |
| Generic goal pointer. | |
Classes | |
| union | _order_data_ |
| struct | _unit_anim_ |
| struct | _unit_seen_ |
Everything belonging to a unit. FIXME: rearrange for less memory.
This class contains all information about a unit in game. A unit could be anything: a man, a vehicle, a ship, or a building. Currently only a tile, a unit, or a missile could be placed on the map.
The unit structure members:
The reference counter of the unit. If the pointer to the unit is stored the counter must be incremented and if this reference is destroyed the counter must be decremented. Alternative it would be possible to implement a garbage collector for this.
This is the unique slot number. It is not possible that two units have the same slot number at the same time. The slot numbers are reused. This field could be accessed by the macro UnitNumber(Unit *). Maximal 65535 (=MAX_UNIT_SLOTS) simultaneous units are supported.
This is the pointer into Units[], where the unit pointer is stored. Units[] is a table of all units currently active in game. This pointer is only needed to speed up, the remove of the unit pointer from Units[], it didn't must be searched in the table.
A pointer into Player::Units[], where the unit pointer is stored. Player::Units[] is a table of all units currently belonging to a player. This pointer is only needed to speed up, the remove of the unit pointer from Player::Units[].
A generic link pointer. This member is currently used, if an unit is on the map, to link all units on the same map field together. This also links corpses and stuff. Also, this is used in memory management to link unused units.
Pointer to the unit containing it, or NoUnitP if the unit is free. This points to the transporter for units on board, or to the building for peasants inside(when they are mining).
Pointer to the last unit added inside. Order doesn't really matter. All units inside are kept in a circular linked list. This is NoUnitP if there are no units inside. Multiple levels of inclusion are allowed, though not very usefull right now
CUnit::NextContained, CUnit::PrevContained
The next and previous element in the curent container. Bogus values allowed for units not contained.
The number of units inside the container.
The number of units transported inside the container. This does not include for instance stuff like harvesters returning cargo.
The tile map coordinates of the unit. 0,0 is the upper left on the map. To convert the map coordinates into pixels, they must be multiplicated with the TileSizeX and TileSizeY. To get the pixel coordinates of a unit, calculate CUnit::X*TileSizeX+CUnitIX , CUnit::Y*TileSizeY+CUnitIY.
Pointer to the unit-type (UnitType). The unit-type contains all informations that all units of the same type shares. (Animations, Name, Stats, ...)
CUnit::SeenType Pointer to the unit-type that this unit was, when last seen. Currently only used by buildings.
Pointer to the owner of this unit (Player). An unit could only be owned by one player.
Pointer to the current status (UnitStats) of a unit. The units of the same player and the same type could share the same stats. The status contains all values which could be different for each player. This f.e. the upgradeable abilities of an unit. (CUnit::Stats::SightRange, CUnit::Stats::Armor, CUnit::Stats::HitPoints, ...)
Current sight range of a unit, this changes when a unit enters a transporter or building or exits one of these.
Player colors of the unit. Contains the hardware dependent pixel values for the player colors (palette index #208-#211). Setup from the global palette. This is a pointer.
Coordinate displacement in pixels or coordinates inside a tile. Currently only !=0, if the unit is moving from one tile to another (0-32 and for ships/flyers 0-64).
Current graphic image of the animation sequence. The high bit (128) is used to flip this image horizontal (x direction). This also limits the number of different frames/image to 126.
CUnit::SeenFrame
Graphic image (see CUnit::Frame) what the player on this computer has last seen. If UnitNotSeen the player haven't seen this unit yet.
Contains the binary angle (0-255) in which the direction the unit looks. 0, 32, 64, 128, 160, 192, 224, 256 corresponds to 0, 45, 90, 135, 180, 225, 270, 315, 360 or north, north-east, east, south-east, south, south-west, west, north-west, north. Currently only 8 directions are used, this is more for the future.
Last cycle the unit was attacked. 0 means never.
If Burning is non-zero, the unit is burning.
CUnit::VisCount[PlayerMax]
Used to keep track of visible units on the map, it counts the Number of seen tiles for each player. This is only modified in UnitsMarkSeen and UnitsUnmarkSeen, from fow. We keep track of visilibty for each player, and combine with Shared vision ONLY when querying and such.
CUnit::SeenByPlayer
This is a bitmask of 1 and 0 values. SeenByPlayer & (1<<p) is 0 If p never saw the unit and 1 if it did. This is important for keeping track of dead units under fog. We only keep track of units that are visible under fog with this.
Unit is destroyed. pending reference.
This flag means the unit is not active on map. This flag have workers set if they are inside a building, units that are on board of a transporter.
Unit is selected. (So you can give it orders)
CUnit::Constructed Set when a building is under construction, and still using the generic building animation.
CUnit::SeenConstructed Last seen state of construction. Used to draw correct building frame. See CUnit::Constructed for more information.
CUnit::SeenState The Seen State of the building. 01 The building in being built when last seen. 10 The building was been upgraded when last seen.
This is 1 if the unit is on board a transporter.
CUnit::Kills
How many units have been killed by the unit.
Number of the group to that the unit belongs. This is the main group showed on map, a unit can belong to many groups.
Automatic group number, to reselect the same units. When the user selects more than one unit all units is given the next same number. (Used for ALT-CLICK)
CUnit::Value
This values hold the amount of resources in a resource or in in a harvester.
This is an action private variable, it is zero on the first entry of an action. Must be set to zero, if an action finishes. It should only be used inside of actions.
The unit is forced too wait for that many cycles. Be carefull, setting this to 0 will lock the unit.
Animation state, currently position in the animation script. 0 if an animation has just started, it should only be changed inside of actions.
CUnit::Reset
Pointer to the original owner of a unit. It will be NULL if the unit was not rescued.
The number of the orders unit to process. An unit has atleast one order. CUnit::OrderCount should be a number at least 1. The orders are in CUnit::Orders[].
A flag, which tells the unit to stop with the current order and immediately start with the next order.
CUnit::TotalOrders
The number of Orders allocated for this unit to use. Default is 4, but is dynamically updated if more orders are given.
Contains all orders of the unit. Slot 0 is always used.
This order is executed, if the current order is finished. This is used for attacking units, to return to the old place or for patrolling units to return to patrol after killing some enemies. Any new order given to the unit, clears this saved order.
This field is only used by buildings and this order is assigned to any by this building new trained unit. This is can be used to set the exit or gathering point of a building.
Generic goal pointer. Used by teleporters to point to circle of power.
Definition at line 489 of file unit.h.
| void CUnit::Init | ( | void | ) | [inline] |
Definition at line 493 of file unit.h.
References AutoCastSpell(), AutoRepair(), GroupId, Selected, and TeamSelected.
Referenced by CUnitManager::AllocUnit(), CclUnit(), and MakeUnit().
| bool CUnit::IsIdle | ( | ) | const [inline] |
Definition at line 669 of file unit.h.
References UnitActionStill.
Referenced by AiForceAttacks(), AiMoveUnitInTheWay(), AiPlanAttack(), and AiTrainUnit().
| void CUnit::ClearAction | ( | ) | [inline] |
Increase a unit's reference count.
Definition at line 673 of file unit.h.
References Selected, SelectedUnitChanged(), and UnitActionStill.
Referenced by CheckCanBuild(), CheckForDeadGoal(), EnterTransporter(), FindNewResource(), GatherResource(), HandleActionBoard(), HandleActionBuilt(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionSpellCast(), HandleActionTrain(), HandleActionUnload(), LeaveTransporter(), MoveToLocation(), RepairUnit(), ResourceGiveUp(), SpellMoveToTarget(), StartBuilding(), and StartGathering().
| void CUnit::RefsIncrease | ( | ) |
Decrease a unit's reference count.
Increase a unit's reference count.
Definition at line 89 of file unit.cpp.
References Assert, Destroyed, Refs, and SaveGameLoading.
Referenced by AiAssignToForce(), AiPlanAttack(), AttackTarget(), AutoAttack(), SpawnMissile::Cast(), AreaBombardment::Cast(), SpawnPortal::Cast(), CclMissile(), CheckForTargetInRange(), CommandAnyOrder(), CommandAttack(), CommandBoard(), CommandFollow(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandUnload(), FireMissile(), HitUnit(), StartBuilding(), StartGathering(), and UnitGoesUnderFog().
| void CUnit::RefsDecrease | ( | ) |
Initialize unit structure with default values.
Decrease a unit's reference count.
Definition at line 100 of file unit.cpp.
References Assert, Destroyed, Refs, Release(), and SaveGameLoading.
Referenced by AiCleanForce(), AiEachCycle(), AttackTarget(), AutoAttack(), CheckForDeadGoal(), CheckForTargetInRange(), EnterTransporter(), FreeMissile(), HandleActionBoard(), HandleActionFollow(), HandleActionMove(), HandleActionTrain(), LeaveTransporter(), MissileHit(), MoveToLocation(), ReleaseOrder(), RepairUnit(), StartGathering(), UnitClearOrders(), UnitGoesOutOfFog(), and WaitForTransporter().
| void CUnit::Init | ( | CUnitType * | type | ) |
Assign unit to player.
Initialize the unit slot with default values.
| type | Unit-type |
Definition at line 186 of file unit.cpp.
References COrder::Action, Assert, CUnitType::AutoCastActive, AutoCastSpell, CUnitType::Building, CUnitType::CanCastSpell, Direction, Frame, CUnit::_unit_seen_::Frame, COrder::Goal, Goal, MaxCosts, MyRand, NewOrder, CUnitTypeVar::NumberVariable, CUnitType::NumDirections, NumUnits, OrderCount, Orders, CUnitType::ProductionCosts, Refs, Removed, ResourcesHeld, SavedOrder, Seen, SpellTypeTable, CUnitType::Sprite, CUnitType::StillFrame, Type, UnitActionStill, UnitNotSeen, UnitSlot, UnitTypeVar, UnitUpdateHeading(), CUnitType::Variable, Variable, COrder::X, and COrder::Y.
| void CUnit::AssignToPlayer | ( | CPlayer * | player | ) |
Draw a single unit.
Assigns a unit to a player, adjusting buildings, food and totals
| player | player which have the unit. |
Definition at line 257 of file unit.cpp.
References CUnitType::Building, Colors, CPlayer::Index, CUnitTypeVar::NumberVariable, CPlayer::NumBuildings, Orders, Player, PlayerSlot, SaveGameLoading, CUnitType::Slot, CUnitType::Stats, Stats, CPlayer::TotalBuildings, CPlayer::TotalNumUnits, CPlayer::TotalUnits, Type, UnitActionDie, CPlayer::UnitColors, CPlayer::Units, CPlayer::UnitTypesCount, UnitTypeVar, CUnitType::Vanishes, Variable, and CUnitStats::Variables.
Referenced by CclUnit(), and MakeUnit().
| void CUnit::Draw | ( | void | ) | const |
Place a unit on map.
Draw unit on map.
Definition at line 794 of file unit_draw.cpp.
References _C_, Assert, CUnit::_order_data_::Built, CUnit::_unit_seen_::CFrame, CUnit::_unit_seen_::Constructed, Constructed, Data, DebugPrint, DrawConstruction(), DrawConstructionShadow(), DrawInformations(), DrawShadow(), DrawUnitSelection(), DrawUnitType(), CUnit::_unit_seen_::Frame, CUnit::_order_data_::_order_built_::Frame, Frame, GameCycle, IsVisible(), CUnit::_unit_seen_::IX, IX, CUnit::_unit_seen_::IY, IY, CViewport::Map2ViewportX(), CViewport::Map2ViewportY(), Orders, ReplayRevealMap, CUnitType::Revealer, Seen, Slot, CUnitType::Sprite, CUnit::_unit_seen_::State, ThisPlayer, CUnitType::TileHeight, TileSizeX, TileSizeY, CUnitType::TileWidth, CUnit::_unit_seen_::Type, Type, UnitActionBuilt, UnitNotSeen, CUnitType::VisibleUnderFog, CUnit::_unit_seen_::X, X, CUnit::_unit_seen_::Y, Y, and y.
Referenced by CViewport::Draw().
| void CUnit::Place | ( | int | x, | |
| int | y | |||
| ) |
Move unit to tile(x, y). (Do special stuff : vision, cachelist, pathfinding).
Place unit on map.
| x | X map tile position. | |
| y | Y map tile position. |
Definition at line 603 of file unit.cpp.
References Assert, Container, CUnitCache::Insert(), MapMarkUnitSight(), MapUnmarkUnitSight(), MarkUnitFieldFlags(), Removed, RemoveUnitFromContainer(), SaveGameLoading, UnitCache, UnitCountSeen(), UnitInXY(), and UpdateUnitSightRange().
Referenced by Polymorph::Cast(), CclCreateUnit(), CclMoveUnit(), DropOutNearest(), DropOutOnSide(), LoadGame(), MakeUnitAndPlace(), StartBuilding(), and UnloadUnit().
| void CUnit::MoveToXY | ( | int | x, | |
| int | y | |||
| ) |
Add a unit inside a container. Only deal with list stuff.
Move a unit (with units inside) to tile (x, y). (Do stuff with vision, cachelist and pathfinding).
| x | X map tile position. | |
| y | Y map tile position. |
Definition at line 580 of file unit.cpp.
References Assert, CUnitCache::Insert(), MapMarkUnitSight(), MapUnmarkUnitSight(), MarkUnitFieldFlags(), CUnitCache::Remove(), UnitCache, UnitCanBeAt(), UnitCountSeen(), UnitInXY(), and UnmarkUnitFieldFlags().
Referenced by SpawnPortal::Cast(), and DoActionMove().
| void CUnit::AddInContainer | ( | CUnit * | host | ) |
Change owner of unit.
Add unit to a container. It only updates linked list stuff.
| host | Pointer to container. |
Definition at line 507 of file unit.cpp.
References Assert, Container, InsideCount, NextContained, NoUnitP, PrevContained, and UnitInside.
| void CUnit::ChangeOwner | ( | CPlayer * | newplayer | ) |
Remove unit from map/groups/...
Change the unit's owner
| newplayer | New owning player. |
Definition at line 1244 of file unit.cpp.
References CUnitType::Building, CUnitType::CanHarvestFrom, ChangeOwner(), DebugPrint, CPlayer::Index, InsideCount, MapMarkUnitSight(), MapUnmarkUnitSight(), NextContained, CPlayer::NumBuildings, Player, PlayerSlot, CUnitType::Slot, CUnitType::Stats, Stats, CPlayer::TotalBuildings, CPlayer::TotalNumUnits, CPlayer::TotalUnits, Type, UnitInside, UnitLost(), CPlayer::Units, CPlayer::UnitTypesCount, UpdateForNewUnit(), and UpdateUnitSightRange().
Referenced by Capture::Cast(), CclChangeUnitsOwner(), ChangeOwner(), EditorCallbackKeyDown(), HitUnit(), and RescueUnits().
| void CUnit::Remove | ( | CUnit * | host | ) |
Release a unit.
Remove unit from map.
Update selection. Update panels. Update map.
| host | Pointer to housing unit. |
Definition at line 656 of file unit.cpp.
References _C_, AddInContainer(), CancelBuildingMode(), DebugPrint, CUnitType::Ident, MapMarkUnitSight(), MapUnmarkUnitSight(), NumSelected, CUnitCache::Remove(), Removed, Selected, SelectionChanged(), Slot, TeamSelected, Type, UnitCache, UnitInXY(), UnitUnderCursor, UnmarkUnitFieldFlags(), UnSelectUnit(), UpdateUnitSightRange(), X, and Y.
Referenced by Summon::Cast(), Capture::Cast(), Polymorph::Cast(), EditorActionPlaceUnit(), EditorActionRemoveUnit(), EnterTransporter(), HandleActionDie(), LetUnitDie(), and StartBuilding().
| void CUnit::Release | ( | ) |
Returns true, if unit is directly seen by an allied unit.
Release a unit.
The unit is only released, if all references are dropped.
Definition at line 121 of file unit.cpp.
References _C_, Assert, AutoCastSpell, Container, DebugPrint, Destroyed, Goal, MapUnmarkUnitSight(), NumUnits, OrderCount, Orders, Refs, CUnitManager::ReleaseUnit(), Removed, RemoveUnitFromContainer(), Slot, Type, UnitManager, UnitSlot, and Variable.
Referenced by Summon::Cast(), Polymorph::Cast(), DestroyAllInside(), EditorActionPlaceUnit(), EditorActionRemoveUnit(), HandleActionDie(), LetUnitDie(), RefsDecrease(), and StartBuilding().
| bool CUnit::IsVisible | ( | const CPlayer * | player | ) | const |
Returns true, if unit is visible as a goal.
Returns true, if the unit is visible. It check the Viscount of the player and everyone who shares vision with him.
| player | The player to check. |
Definition at line 1081 of file unit.cpp.
References CPlayer::Index, CPlayer::IsBothSharedVision(), PlayerMax, Players, and VisCount.
Referenced by Draw(), DrawInfoPanelNoneSelected(), DrawInformations(), DrawUnitOn(), IsVisibleAsGoal(), IsVisibleInViewport(), IsVisibleOnMap(), IsVisibleOnMinimap(), UIHandleMouseMove(), UnitCountSeen(), UnitShowAnimationScaled(), UnitsOnTileMarkSeen(), and UnitsOnTileUnmarkSeen().
| bool CUnit::IsVisibleAsGoal | ( | const CPlayer * | player | ) | const |
Returns true, if the unit is alive and on the map.
Returns true, if unit is visible as an action goal for a player on the map.
| player | Player to check for. |
Definition at line 1104 of file unit.cpp.
References CUnit::_unit_seen_::ByPlayer, CUnit::_unit_seen_::Destroyed, Destroyed, CPlayer::Index, IsVisible(), Orders, PlayerComputer, Removed, Seen, Type, CPlayer::Type, UnitActionDie, UnitVisibleOnRadar(), and CUnitType::VisibleUnderFog.
Referenced by AttackUnitsInDistance(), CheckForDeadGoal(), EnterTransporter(), FindRangeAttack(), HandleActionFollow(), MoveToLocation(), RepairUnit(), StartGathering(), TargetOnMap(), UIHandleMouseMove(), UnitOnScreen(), UnitToRepairInRange(), and WaitForTransporter().
| bool CUnit::IsAliveOnMap | ( | ) | const |
Returns true, if unit is Visible for game logic on the map.
Returns true if unit is alive and on the map. Another unit can interact only with alive map units.
Definition at line 1122 of file unit.cpp.
References Destroyed, Orders, Removed, and UnitActionDie.
Referenced by GatherResource().
| bool CUnit::IsVisibleOnMap | ( | const CPlayer * | player | ) | const |
Returns true if unit is visible on minimap. Only for ThisPlayer.
Returns true, if unit is visible for this player on the map. The unit has to be out of fog of war and alive
| player | Player to check for. |
Definition at line 1135 of file unit.cpp.
References Destroyed, IsVisible(), Orders, Removed, and UnitActionDie.
Referenced by HitUnit(), and SelectUnitsInRectangle().
| bool CUnit::IsVisibleOnMinimap | ( | ) | const |
Returns true if unit is visible in an viewport. Only for ThisPlayer.
Returns true, if unit is shown on minimap.
Definition at line 1149 of file unit.cpp.
References CUnit::_unit_seen_::ByPlayer, CUnit::_unit_seen_::Destroyed, Destroyed, CPlayer::Index, IsVisible(), Orders, Removed, ReplayRevealMap, Seen, CUnit::_unit_seen_::State, ThisPlayer, Type, UnitActionDie, UnitVisibleOnRadar(), and CUnitType::VisibleUnderFog.
| bool CUnit::IsVisibleInViewport | ( | const CViewport * | vp | ) | const |
Returns true, if unit is visible on current map view (any viewport).
Returns true, if unit is visible in viewport.
| vp | Viewport pointer. |
Definition at line 1172 of file unit.cpp.
References Assert, CUnit::_unit_seen_::ByPlayer, CUnit::_unit_seen_::Destroyed, Destroyed, CViewport::EndX, CViewport::EndY, CUnitType::Height, CPlayer::Index, IsVisible(), IX, IY, CViewport::MapX, CViewport::MapY, CViewport::OffsetX, CUnitType::OffsetX, CViewport::OffsetY, CUnitType::OffsetY, ReplayRevealMap, Seen, ThisPlayer, CUnitType::TileHeight, TileSizeX, TileSizeY, CUnitType::TileWidth, Type, CUnitType::VisibleUnderFog, CUnitType::Width, CViewport::X, X, CViewport::Y, Y, and y.
Referenced by FindAndSortUnits(), IsVisibleOnScreen(), and SelectUnitsInRectangle().
| bool CUnit::IsVisibleOnScreen | ( | ) | const |
Definition at line 1211 of file unit.cpp.
References IsVisibleInViewport(), CUserInterface::NumViewports, UI, and CUserInterface::Viewports.
| void CUnit::GetMapArea | ( | int * | sx, | |
| int * | sy, | |||
| int * | ex, | |||
| int * | ey | |||
| ) | const |
Get area of map tiles covered by unit, including its displacement.
| sx | Out: Top left X tile map postion. | |
| sy | Out: Top left Y tile map postion. | |
| ex | Out: Bottom right X tile map postion. | |
| ey | Out: Bottom right Y tile map postion. |
Definition at line 1231 of file unit.cpp.
References IX, IY, CUnitType::TileHeight, CUnitType::TileWidth, Type, X, and Y.
| bool CUnit::IsEnemy | ( | const CPlayer * | x | ) | const |
Check if the player is an enemy
| x | Player to check |
Definition at line 2486 of file unit.cpp.
References CPlayer::Enemy, CPlayer::Index, and Player.
Referenced by Capture::Cast(), Polymorph::Cast(), DoRightButton(), DrawUnitInfo(), HitUnit(), IsEnemy(), PassCondition(), and SelectTargetUnitsOfAutoCast().
| bool CUnit::IsEnemy | ( | const CUnit * | x | ) | const |
| bool CUnit::IsAllied | ( | const CPlayer * | x | ) | const |
Check if the player is an ally
| x | Player to check |
Definition at line 2506 of file unit.cpp.
References CPlayer::IsAllied(), and Player.
Referenced by CheckAlreadyBuilding(), DoRightButton(), IsAllied(), PassCondition(), and RescueUnits().
| bool CUnit::IsAllied | ( | const CUnit * | x | ) | const |
Check if the unit is an ally
| x | Unit to check |
Definition at line 2516 of file unit.cpp.
References IsAllied(), and Player.
| bool CUnit::IsSharedVision | ( | const CPlayer * | x | ) | const |
Check if unit shares vision with the player
| x | Player to check |
Definition at line 2526 of file unit.cpp.
References CPlayer::Index, Player, and CPlayer::SharedVision.
Referenced by IsSharedVision().
| bool CUnit::IsSharedVision | ( | const CUnit * | x | ) | const |
Check if the unit shares vision with the unit
| x | Unit to check |
Definition at line 2536 of file unit.cpp.
References IsSharedVision(), and Player.
| bool CUnit::IsBothSharedVision | ( | const CPlayer * | x | ) | const |
Check if both players share vision
| x | Player to check |
Definition at line 2546 of file unit.cpp.
References CPlayer::Index, Player, and CPlayer::SharedVision.
Referenced by IsBothSharedVision().
| bool CUnit::IsBothSharedVision | ( | const CUnit * | x | ) | const |
Check if both units share vision
| x | Unit to check |
Definition at line 2557 of file unit.cpp.
References IsBothSharedVision(), and Player.
| bool CUnit::IsTeamed | ( | const CPlayer * | x | ) | const |
Check if the player is on the same team
| x | Player to check |
Definition at line 2567 of file unit.cpp.
References Player, and CPlayer::Team.
Referenced by CanTransport(), DoRightButton(), and IsTeamed().
| bool CUnit::IsTeamed | ( | const CUnit * | x | ) | const |
Check if the unit is on the same team
| x | Unit to check |
Definition at line 2577 of file unit.cpp.
References IsTeamed(), and Player.
| bool CUnit::IsUnusable | ( | ) | const |
Check if the unit is unusable (for attacking...)
Definition at line 2586 of file unit.cpp.
References Destroyed, Orders, Removed, UnitActionBuilt, and UnitActionDie.
Referenced by AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AiMoveUnitInTheWay(), FindPlayerUnitsByType(), FindUnitsByType(), MapMarkUnitSight(), MapUnmarkUnitSight(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectOrganicUnitsInTable(), SelectUnitsByType(), and ToggleUnitsByType().
| unsigned long CUnit::Refs |
Reference counter.
Definition at line 552 of file unit.h.
Referenced by CclSlotUsage(), CclUnit(), DrawInformations(), Init(), RefsDecrease(), RefsIncrease(), Release(), CUnitManager::ReleaseUnit(), SaveUnit(), and UnitActions().
| int CUnit::Slot |
Assigned slot number.
Definition at line 553 of file unit.h.
Referenced by CUnitManager::AllocUnit(), CclCreateUnit(), CclSlotUsage(), CclUnit(), CompareUnitDistance(), Draw(), DrawLevelCompare(), FindNewResource(), GatherResource(), NetworkSendCommand(), PlayUnitSound(), Release(), Remove(), ResourceGiveUp(), CUnitCache::Select(), SendSpellCast(), and UpdateUnitVariables().
Slot pointer of Player->Units.
Definition at line 555 of file unit.h.
Referenced by AssignToPlayer(), ChangeOwner(), and UnitLost().
Generic link pointer (on map).
Definition at line 557 of file unit.h.
Referenced by CclUnit(), and SaveUnit().
Number of units inside.
Definition at line 559 of file unit.h.
Referenced by AddInContainer(), ChangeOwner(), DestroyAllInside(), DrawTransportingUnits(), DropOutAll(), LeaveTransporter(), MapMarkUnitSightRec(), RemoveUnitFromContainer(), SaveUnit(), UnitInXY(), and UpdateUnitSightRange().
Number of units transported inside.
Definition at line 560 of file unit.h.
Referenced by CanTransport(), CclUnit(), DrawUnitInfo(), EnterTransporter(), HandleMouseOn(), IsButtonAllowed(), LeaveTransporter(), SaveUnit(), and UpdateUnitVariables().
Pointer to one of the units inside.
Definition at line 561 of file unit.h.
Referenced by AddInContainer(), ChangeOwner(), ClosestFreeDropZone(), DestroyAllInside(), DrawTransportingUnits(), DropOutAll(), LeaveTransporter(), LetUnitDie(), MapMarkUnitSightRec(), RemoveUnitFromContainer(), SaveUnit(), UIHandleButtonDown(), UnitInXY(), and UpdateUnitSightRange().
Pointer to the unit containing it (or 0).
Definition at line 562 of file unit.h.
Referenced by ActionStillGeneric(), AddInContainer(), DropOutNearest(), DropOutOnSide(), FindRangeAttack(), FireMissile(), GetFirstContainer(), MapMarkUnitSightRec(), Place(), Release(), RemoveUnitFromContainer(), SaveUnit(), and UpdateUnitSightRange().
Next unit in the container.
Definition at line 563 of file unit.h.
Referenced by AddInContainer(), ChangeOwner(), DestroyAllInside(), DrawTransportingUnits(), DropOutAll(), LeaveTransporter(), MapMarkUnitSightRec(), RemoveUnitFromContainer(), UIHandleButtonDown(), UnitInXY(), and UpdateUnitSightRange().
Previous unit in the container.
Definition at line 564 of file unit.h.
Referenced by AddInContainer(), RemoveUnitFromContainer(), and SaveUnit().
| int CUnit::X |
Map position X.
Definition at line 566 of file unit.h.
Referenced by AiAssignHarvester(), AiAttackWithForce(), AiCanNotBuild(), AiCheckSurrounding(), AiEnemyUnitsInDistance(), AiFindBuildingPlace(), AiFindTarget(), AiForceAttacks(), AiHelpMe(), AiMarkWaterTransporter(), AiMoveUnitInTheWay(), AiRepairBuilding(), AiTrainingComplete(), AiWorkComplete(), AttackTarget(), AttackUnitsInDistance(), AutoAttack(), CalculateStereo(), Summon::Cast(), Polymorph::Cast(), CclCreateUnit(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclMoveUnit(), CclUnit(), CheckCanBuild(), CheckForDeadGoal(), CheckForTargetInRange(), CommandAttack(), CommandFollow(), CommandPatrolUnit(), CommandRepair(), CommandSpellCast(), CostMoveTo(), DoActionMove(), CButtonPanel::DoClicked(), Draw(), DrawLevelCompare(), DrawUnitOn(), DrawUnitSelection(), DropOutNearest(), DropOutOnSide(), EditorRemoveUnit(), EnemyOnMapTile(), EvaluateMissileLocation(), FindNewResource(), FindRangeAttack(), FireMissile(), GetMapArea(), GetOrderPosition(), HandleActionAttack(), HandleActionBuilt(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionSpellCast(), HandleActionTrain(), HitUnit(), CUnitCache::Insert(), IsVisibleInViewport(), LeaveTransporter(), LetUnitDie(), LoadGame(), MapDistanceBetweenUnits(), MapDistanceToUnit(), MapMarkUnitSight(), MapUnmarkUnitSight(), MarkUnitFieldFlags(), MoveToLocation(), MoveToTarget(), MoveToTransporter(), NearestOfUnit(), NewPath(), NextPathElement(), PlaceReachable(), CUnitCache::Remove(), Remove(), RepairUnit(), RescueUnits(), SaveUnit(), SelectSpritesInsideRectangle(), SelectTargetUnitsOfAutoCast(), ShowOrder(), SpellCast(), SpellMoveToTarget(), StartBuilding(), StartGathering(), TargetOnMap(), UiCenterOnGroup(), UiCenterOnSelected(), UiFindIdleWorker(), UnitActions(), UnitCountSeen(), UnitFillSeenValues(), UnitFindResource(), UnitInXY(), UnitLost(), UnitOnScreen(), UnitReachable(), UnitsOnTileUnmarkSeen(), UnitToRepairInRange(), UnitVisibleOnRadar(), UnloadUnit(), UnmarkUnitFieldFlags(), and UpdateUnitVariables().
| int CUnit::Y |
Map position Y.
Definition at line 567 of file unit.h.
Referenced by AiAssignHarvester(), AiAttackWithForce(), AiCanNotBuild(), AiCheckSurrounding(), AiEnemyUnitsInDistance(), AiFindBuildingPlace(), AiFindTarget(), AiForceAttacks(), AiHelpMe(), AiMarkWaterTransporter(), AiMoveUnitInTheWay(), AiRepairBuilding(), AiTrainingComplete(), AiWorkComplete(), AttackTarget(), AttackUnitsInDistance(), AutoAttack(), Summon::Cast(), Polymorph::Cast(), CclCreateUnit(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclMoveUnit(), CclUnit(), CheckCanBuild(), CheckForDeadGoal(), CheckForTargetInRange(), CommandAttack(), CommandFollow(), CommandPatrolUnit(), CommandRepair(), CommandSpellCast(), CostMoveTo(), DoActionMove(), CButtonPanel::DoClicked(), Draw(), DrawLevelCompare(), DrawUnitOn(), DrawUnitSelection(), DropOutNearest(), DropOutOnSide(), EditorRemoveUnit(), EnemyOnMapTile(), EvaluateMissileLocation(), FindNewResource(), FindRangeAttack(), FireMissile(), GetMapArea(), GetOrderPosition(), HandleActionAttack(), HandleActionBuilt(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionSpellCast(), HandleActionTrain(), HitUnit(), CUnitCache::Insert(), IsVisibleInViewport(), LeaveTransporter(), LetUnitDie(), LoadGame(), MapDistanceBetweenUnits(), MapDistanceToUnit(), MapMarkUnitSight(), MapUnmarkUnitSight(), MarkUnitFieldFlags(), MoveToLocation(), MoveToTarget(), MoveToTransporter(), NearestOfUnit(), NewPath(), NextPathElement(), PlaceReachable(), CUnitCache::Remove(), Remove(), RepairUnit(), RescueUnits(), SaveUnit(), SelectSpritesInsideRectangle(), SelectTargetUnitsOfAutoCast(), ShowOrder(), SpellCast(), SpellMoveToTarget(), StartBuilding(), StartGathering(), TargetOnMap(), UiCenterOnGroup(), UiCenterOnSelected(), UiFindIdleWorker(), UnitActions(), UnitCountSeen(), UnitFillSeenValues(), UnitFindResource(), UnitInXY(), UnitLost(), UnitOnScreen(), UnitReachable(), UnitsOnTileUnmarkSeen(), UnitToRepairInRange(), UnitVisibleOnRadar(), UnloadUnit(), UnmarkUnitFieldFlags(), and UpdateUnitVariables().
Pointer to unit-type (peon,...).
Definition at line 569 of file unit.h.
Referenced by ActionStillGeneric(), AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AddToGroup(), AiAssignToForce(), AiAttackWithForce(), AiAttackWithForceAt(), AiCanNotBuild(), AiCanNotMove(), AiCheckBelongsToForce(), AiCheckMagic(), AiCheckRepair(), AiCleanForce(), AiCollectResources(), AiEnemyUnitsInDistance(), AiFindBuildingPlace2(), AiFindTarget(), AiForceAttacks(), AiForceManager(), AiHelpMe(), AiMarkWaterTransporter(), AiMoveUnitInTheWay(), AiPlanAttack(), AiRepairBuilding(), AiRepairUnit(), AiSendExplorers(), AiTrainingComplete(), AiUnitKilled(), AiWorkComplete(), AnimateActionAttack(), AnimateActionHarvest(), AnimateActionRepair(), AssignToPlayer(), AttackTarget(), AttackUnitsInDistance(), AttackUnitsInRange(), AttackUnitsInReactRange(), AutoAttack(), AutoRepair(), ButtonCheckAttack(), CalculateStereo(), CanHandleOrder(), CanMove(), CanTransport(), Summon::Cast(), Capture::Cast(), Polymorph::Cast(), AreaAdjustVitals::Cast(), CclCreateUnit(), CclGetNumUnitsAt(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclKillUnit(), CclKillUnitAt(), CclOrderUnit(), CclParseBuilt(), CclUnit(), ChangeOwner(), CheckCanBuild(), CheckForTargetInRange(), ChooseUnitVoiceSound(), ClosestFreeDropZone(), CommandAttack(), CommandAttackGround(), CommandBoard(), CommandBuildBuilding(), CommandFollow(), CommandLog(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandStandGround(), CostMoveTo(), DoActionMove(), DoNextReplay(), DoRepair(), DoRightButton(), Draw(), DrawConstructionShadow(), DrawDecoration(), DrawInfoPanelMultipleSelected(), DrawLevelCompare(), DrawShadow(), DrawUnitInfo(), DrawUnitOn(), DrawUnitSelection(), DrawUnitStats(), DropOutAll(), EditorRemoveUnit(), EnemyOnMapTile(), EnterTransporter(), FindIdleWorker(), FindPlayerUnitsByType(), FindRangeAttack(), FindUnitsByType(), FireMissile(), GatherResource(), GetMapArea(), GetOrderPosition(), HandleActionAttack(), HandleActionBoard(), HandleActionBuilt(), HandleActionDie(), HandleActionFollow(), HandleActionMove(), HandleActionNone(), HandleActionPatrol(), HandleActionSpellCast(), HandleActionTrain(), HandleRegenerations(), HitUnit(), Init(), InitPlayers(), CUnitCache::Insert(), IsButtonAllowed(), IsVisibleAsGoal(), IsVisibleInViewport(), IsVisibleOnMinimap(), LetUnitDie(), MapDistanceBetweenUnits(), MapDistanceToUnit(), MapFogFilterFlags(), MapMarkUnitSight(), MapUnmarkUnitSight(), MarkUnitFieldFlags(), MissileHit(), MoveToLocation(), MoveToTarget(), NearestOfUnit(), NewPath(), OnTopDetails(), ParseCommand(), PassCondition(), PlaceReachable(), CPlayer::RebuildUnitsConsumingResourcesList(), Release(), CUnitCache::Remove(), Remove(), RepairUnit(), RescueUnits(), CMap::Reveal(), SaveAiPlayer(), SaveUnit(), CUnitCache::Select(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectOrganicUnitsInTable(), SelectSpritesInsideRectangle(), SelectTargetUnitsOfAutoCast(), SelectUnit(), SelectUnitsByType(), SelectUnitsInRectangle(), SendAttack(), SendAttackGround(), SendMove(), SendRepair(), SendResource(), SendSpellCast(), ShowOrder(), ShowUnitInfo(), SpellCast(), SpellMoveToTarget(), StartBuilding(), StartGathering(), TargetOnMap(), ToggleUnitsByType(), UiDrawLifeBar(), UiDrawManaBar(), UIHandleButtonDown(), UIHandleButtonUp(), UIHandleMouseMove(), UnitActions(), UnitCanBeAt(), UnitCountSeen(), UnitFillSeenValues(), UnitFindResource(), UnitGoesOutOfFog(), UnitGoesUnderFog(), UnitLost(), UnitOnScreen(), UnitReachable(), UnitRemoveConsumingResources(), UnitRotate(), UnitsOnTileUnmarkSeen(), UnitToRepairInRange(), UnitUpdateHeading(), UnitVisibleOnRadar(), UnloadUnit(), UnmarkUnitFieldFlags(), CButtonPanel::Update(), UpdateButtonPanelSingleUnit(), UpdateConstructionFrame(), UpdateForNewUnit(), and UpdateUnitVariables().
Owner of this unit.
Definition at line 570 of file unit.h.
Referenced by AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AiAssignHarvester(), AiCanNotBuild(), AiCanNotMove(), AiCanNotReach(), AiEnemyUnitsInDistance(), AiFindBuildingPlace2(), AiHelpMe(), AiMoveUnitInTheWay(), AiNeedMoreSupply(), AiTrainingComplete(), AiUnitKilled(), AiWorkComplete(), AssignToPlayer(), AttackUnitsInDistance(), AttackUnitsInReactRange(), AutoCastSpell(), ButtonCheckUnitsAnd(), ButtonCheckUnitsOr(), CalculateCosts(), CanBuildUnitType(), Summon::Cast(), Capture::Cast(), Polymorph::Cast(), CclGetNumUnitsAt(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclKillUnitAt(), CclOrderUnit(), CclUnit(), ChangeOwner(), CheckAlreadyBuilding(), CheckCanBuild(), CheckForDeadGoal(), CommandCancelTraining(), CommandTrainUnit(), CostMoveTo(), CreateGame(), DoActionMove(), DoRepair(), DoRightButton(), CButtonPanel::Draw(), DrawConstruction(), DrawDecoration(), DrawInformations(), DrawPieMenu(), DrawTrainingUnits(), DrawTransportingUnits(), DrawUnitInfo(), DrawUnitOn(), DrawUnitSelection(), EditorRemoveUnit(), EnemyOnMapTile(), EnterTransporter(), FindRangeAttack(), GatherResource(), HandleActionBuilt(), HandleActionDie(), HandleActionFollow(), HandleActionSpellCast(), HandleActionTrain(), HitUnit(), IsAllied(), CPlayer::IsAllied(), IsBothSharedVision(), CPlayer::IsBothSharedVision(), IsButtonAllowed(), IsEnemy(), CPlayer::IsEnemy(), IsSharedVision(), CPlayer::IsSharedVision(), IsTeamed(), CPlayer::IsTeamed(), LetUnitDie(), MapMarkUnitSight(), MapMarkUnitSightRec(), MapUnmarkUnitSight(), MaxRate(), MoveToLocation(), MoveToResource(), PassCondition(), CPlayer::RebuildUnitsConsumingResourcesList(), RepairUnit(), RescueUnits(), SaveUnit(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectOrganicUnitsInTable(), SelectTargetUnitsOfAutoCast(), SelectUnitsByType(), SelectUnitsInRectangle(), SendRepair(), ShowUnitInfo(), StartBuilding(), StartGathering(), TargetOnMap(), ToggleUnitsByType(), UIHandleButtonUp(), UIHandleMouseMove(), UnitActions(), UnitFindResource(), UnitLost(), UnitRemoveConsumingResources(), UnitShowAnimationScaled(), UnitToRepairInRange(), UnitVisibleOnRadar(), CButtonPanel::Update(), UpdateForNewUnit(), and WaitForTransporter().
Current unit stats.
Definition at line 571 of file unit.h.
Referenced by AiCheckRepair(), AssignToPlayer(), AttackTarget(), AttackUnitsInDistance(), AttackUnitsInRange(), CalculateDamage(), AdjustVitals::Cast(), CclUnit(), ChangeOwner(), CheckForTargetInRange(), CommandAttack(), CommandAttackGround(), DoRepair(), DrawInformations(), FindRangeAttack(), HandleActionBuilt(), HandleRegenerations(), MapMarkUnitSight(), MapUnmarkUnitSight(), MoveToTarget(), SaveUnit(), UiDrawManaBar(), UpdateUnitSightRange(), and UpdateUnitVariables().
Unit's Current Sight Range.
Definition at line 572 of file unit.h.
Referenced by CclUnit(), HandleActionBuilt(), HandleActionDie(), LetUnitDie(), MapMarkUnitSightRec(), SaveUnit(), StartBuilding(), and UpdateUnitSightRange().
Player colors.
Definition at line 575 of file unit.h.
Referenced by AssignToPlayer(), CclUnit(), and CreateGame().
| signed char CUnit::IX |
X image displacement to map position.
Definition at line 576 of file unit.h.
Referenced by CalculateStereo(), CclUnit(), DoActionMove(), Draw(), DrawUnitSelection(), GetMapArea(), GetOrderPosition(), IsVisibleInViewport(), LetUnitDie(), SaveUnit(), SelectSpritesInsideRectangle(), ShowOrder(), StartGathering(), UnitActions(), UnitFillSeenValues(), and UnitOnScreen().
| signed char CUnit::IY |
Y image displacement to map position.
Definition at line 577 of file unit.h.
Referenced by ActionStillGeneric(), CclUnit(), DoActionMove(), Draw(), DrawLevelCompare(), DrawUnitSelection(), GetMapArea(), GetOrderPosition(), IsVisibleInViewport(), LetUnitDie(), SaveUnit(), SelectSpritesInsideRectangle(), ShowOrder(), StartGathering(), UnitActions(), UnitFillSeenValues(), and UnitOnScreen().
| int CUnit::Frame |
Image frame: <0 is mirrored.
Definition at line 578 of file unit.h.
Referenced by AttackTarget(), CclUnit(), DoActionMove(), Draw(), HandleActionBuilt(), HandleActionDie(), HandleActionFollow(), Init(), SaveUnit(), UnitFillSeenValues(), UnitShowAnimationScaled(), UnitUpdateHeading(), and UpdateConstructionFrame().
| unsigned CUnit::Direction |
angle (0-255) unit looking
Definition at line 580 of file unit.h.
Referenced by CclUnit(), DoActionMove(), HandleActionBuilt(), Init(), SaveUnit(), StartBuilding(), UnitHeadingFromDeltaXY(), UnitRotate(), and UnitUpdateHeading().
| unsigned long CUnit::Attacked |
gamecycle unit was last attacked
Definition at line 582 of file unit.h.
Referenced by AiCheckRepair(), CclUnit(), DrawUnitOn(), HitUnit(), and SaveUnit().
| unsigned CUnit::Burning |
unit is burning
Definition at line 584 of file unit.h.
Referenced by MissileFire::Action(), CclUnit(), HitUnit(), and SaveUnit().
| unsigned CUnit::Destroyed |
unit is destroyed pending reference
Definition at line 585 of file unit.h.
Referenced by MissileFire::Action(), AiCleanForce(), CclUnit(), CheckForTargetInRange(), ClearGroup(), CommandAttack(), CommandBoard(), CommandFollow(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandUnload(), FireMissile(), HandleActionMove(), HandleActionTrain(), HandleRegenerations(), IsAliveOnMap(), IsUnusable(), IsVisibleAsGoal(), IsVisibleInViewport(), IsVisibleOnMap(), IsVisibleOnMinimap(), LeaveTransporter(), MissileHit(), MoveToTarget(), NetworkSendCommands(), ParseCommand(), PassCondition(), RefsDecrease(), RefsIncrease(), Release(), SaveOrder(), SaveUnit(), ShowOrder(), SpellMoveToTarget(), and UnitGoesUnderFog().
| unsigned CUnit::Removed |
unit is removed (not on map)
Definition at line 586 of file unit.h.
Referenced by ActionStillGeneric(), AiAssignHarvester(), AiEnemyUnitsInDistance(), AutoAttack(), CclUnit(), CheckForTargetInRange(), CommandAttack(), CommandAttackGround(), CommandAutoRepair(), CommandAutoSpellCast(), CommandBoard(), CommandBuildBuilding(), CommandFollow(), CommandMove(), CommandPatrolUnit(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandTrainUnit(), CommandUnload(), DropOutNearest(), EnemyOnMapTile(), FindIdleWorker(), FindRangeAttack(), FireMissile(), GetOrderPosition(), HandleRegenerations(), HandleUnitAction(), HitUnit(), Init(), CUnitCache::Insert(), IsAliveOnMap(), IsUnusable(), IsVisibleAsGoal(), IsVisibleOnMap(), IsVisibleOnMinimap(), LetUnitDie(), LoadGame(), MoveToTarget(), Place(), Release(), CUnitCache::Remove(), Remove(), RescueUnits(), SaveUnit(), CUnitCache::Select(), SelectUnit(), SelectUnitsByType(), SelectUnitsInRectangle(), ToggleUnitsByType(), and UnloadUnit().
| unsigned CUnit::Selected |
unit is selected
Definition at line 587 of file unit.h.
Referenced by CclUnit(), ChangeSelectedUnits(), CommandCancelTraining(), DoActionMove(), DrawDecoration(), DrawInformations(), DrawUnitOn(), DrawUnitSelection(), Remove(), RestoreSelection(), SaveUnit(), SelectUnit(), SelectUnitsByType(), ToggleSelectUnit(), UnSelectAll(), and UnSelectUnit().
| unsigned CUnit::Constructed |
Unit is in construction.
Definition at line 589 of file unit.h.
Referenced by CclGetNumUnitsAt(), CclUnit(), Draw(), HandleActionBuilt(), SaveUnit(), StartBuilding(), UnitFillSeenValues(), and UpdateUnitSightRange().
| unsigned CUnit::Boarded |
Unit is on board a transporter.
Definition at line 590 of file unit.h.
Referenced by CclUnit(), EnterTransporter(), LeaveTransporter(), SaveUnit(), UIHandleButtonDown(), and UnloadUnit().
| unsigned CUnit::TeamSelected |
unit is selected by a team member.
Definition at line 591 of file unit.h.
Referenced by AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), ChangeTeamSelectedUnits(), DrawUnitSelection(), Remove(), RestoreSelection(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectOrganicUnitsInTable(), SelectUnitsByType(), ToggleUnitsByType(), and UnSelectUnit().
The original owner of a rescued unit. NULL if the unit was not rescued.
Definition at line 592 of file unit.h.
Referenced by CclIfRescuedNearUnit(), CclUnit(), CreateGame(), DrawConstruction(), RescueUnits(), and SaveUnit().
| int CUnit::VisCount[PlayerMax] |
Unit visibility counts.
Definition at line 595 of file unit.h.
Referenced by DrawInformations(), IsVisible(), UnitCountSeen(), UnitsOnTileMarkSeen(), and UnitsOnTileUnmarkSeen().
| struct CUnit::_unit_seen_ CUnit::Seen |
array of User Defined variables.
Definition at line 610 of file unit.h.
Referenced by MissileFire::Action(), AiCheckRepair(), AssignToPlayer(), AttackUnitsInDistance(), AutoCastSpell(), Summon::Cast(), Capture::Cast(), Polymorph::Cast(), AdjustVitals::Cast(), AdjustVariable::Cast(), AreaAdjustVitals::Cast(), CclGetUnitVariable(), CclSetUnitVariable(), CclUnit(), DoRepair(), DoRightButton(), CDecoVarSpriteBar::Draw(), DrawDecoration(), DrawUnitInfo(), DrawUnitStats(), FindRangeAttack(), GatherResource(), HandleActionBuilt(), HandleActionSpellCast(), HandleBuffs(), HandleRegenerations(), HitUnit(), Init(), MoveToLocation(), PassCondition(), Release(), SaveUnit(), SendRepair(), SpellCast(), StartBuilding(), UiDrawLifeBar(), UiDrawManaBar(), UnitToRepairInRange(), and UpdateUnitVariables().
| unsigned long CUnit::TTL |
time to live
Definition at line 612 of file unit.h.
Referenced by CclUnit(), HandleActionTrain(), HandleBuffs(), LetUnitDie(), and SaveUnit().
| int CUnit::GroupId |
unit belongs to this group id
Definition at line 614 of file unit.h.
Referenced by AddToGroup(), CclUnit(), ClearGroup(), DrawDecoration(), RemoveUnitFromGroups(), SaveUnit(), and UnitLost().
| int CUnit::LastGroup |
unit belongs to this last group
Definition at line 615 of file unit.h.
Referenced by AddGroupFromUnitToSelection(), CclUnit(), ChangeSelectedUnits(), SaveUnit(), SelectGroupFromUnit(), SelectUnit(), SelectUnitsByType(), UIHandleButtonUp(), and UnSelectUnit().
| int CUnit::ResourcesHeld[MaxCosts] |
Resources held by a unit.
Definition at line 617 of file unit.h.
Referenced by CclSetResourcesHeld(), CclUnit(), DrawUnitInfo(), EditorActionPlaceUnit(), GatherResource(), Init(), LetUnitDie(), SaveUnit(), ShowUnitInfo(), StartBuilding(), UnitHoldsResources(), UnitLost(), and UpdateUnitVariables().
| unsigned CUnit::ProductionEfficiency |
Production efficiency.
Definition at line 618 of file unit.h.
Referenced by CclUnit(), LetUnitDie(), SaveUnit(), StartBuilding(), and UpdateForNewUnit().
| unsigned CUnit::SubAction |
sub-action of unit
Definition at line 620 of file unit.h.
Referenced by ActionStillGeneric(), AttackTarget(), AutoAttack(), CclUnit(), CheckCanBuild(), CheckForTargetInRange(), DropOutAll(), FindNewResource(), HandleActionAttack(), HandleActionBoard(), HandleActionBuild(), HandleActionDie(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionRepair(), HandleActionResource(), HandleActionSpellCast(), HandleActionTrain(), HandleActionUnload(), HandleUnitAction(), LeaveTransporter(), LetUnitDie(), MoveToLocation(), MoveToTarget(), CPlayer::RebuildUnitsConsumingResourcesList(), RemoveOrder(), RepairUnit(), RestoreSavedOrder(), SaveUnit(), ShowSingleOrder(), SpellMoveToTarget(), StartBuilding(), StartGathering(), UnitActions(), UnitClearOrders(), UnitRemoveConsumingResources(), and WaitForTransporter().
| unsigned CUnit::Wait |
action counter
Definition at line 621 of file unit.h.
Referenced by AiAttackWithForce(), AiAttackWithForceAt(), AutoAttack(), CclUnit(), CheckCanBuild(), DoActionMove(), HandleActionAttack(), HandleActionBoard(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionResource(), HandleActionSpellCast(), HandleActionTrain(), HandleUnitAction(), MoveToLocation(), MoveToTarget(), SaveUnit(), and WaitForTransporter().
| unsigned CUnit::State |
action state
Definition at line 622 of file unit.h.
Referenced by AttackTarget(), AutoAttack(), CclUnit(), CheckForDeadGoal(), FindNewResource(), HandleActionAttack(), HandleActionFollow(), HandleActionMove(), HandleUnitAction(), LetUnitDie(), MoveToLocation(), MoveToTarget(), RepairUnit(), SaveUnit(), SpellMoveToTarget(), UnitActions(), and UnitClearOrders().
| unsigned CUnit::Blink |
Let selection rectangle blink.
Definition at line 623 of file unit.h.
Referenced by CclUnit(), DoRightButton(), DrawUnitSelection(), RescueUnits(), SaveUnit(), SendAttack(), SendMove(), SendResource(), UIHandleButtonDown(), and UnitActions().
| unsigned CUnit::Moving |
The unit is moving.
Definition at line 624 of file unit.h.
Referenced by CclUnit(), CostMoveTo(), DoActionMove(), LetUnitDie(), and SaveUnit().
| unsigned CUnit::ReCast |
Recast again next cycle.
Definition at line 625 of file unit.h.
Referenced by CclUnit(), HandleActionSpellCast(), SaveUnit(), and UnitShowAnimationScaled().
| struct CUnit::_unit_anim_ CUnit::Anim |
Referenced by ActionStillGeneric(), AttackTarget(), CclUnit(), DoActionMove(), GatherResource(), HandleActionDie(), HandleActionFollow(), HandleActionPatrol(), HandleActionSpellCast(), HandleUnitAction(), LetUnitDie(), MoveToLocation(), MoveToResource(), MoveToTarget(), RepairUnit(), SaveUnit(), SpellMoveToTarget(), and UnitShowAnimationScaled().
| char CUnit::OrderCount |
how many orders in queue
Definition at line 634 of file unit.h.
Referenced by AiBuildBuilding(), AiRepairBuilding(), CclParseOrders(), CclUnit(), CommandCancelTraining(), DrawTrainingUnits(), EnterTransporter(), GatherResource(), GetNextOrder(), HandleActionFollow(), HandleActionTrain(), HandleMouseOn(), HandleUnitAction(), Init(), Release(), ReleaseOrders(), RemoveOrder(), SaveUnit(), ShowOrder(), and UnitClearOrders().
| char CUnit::OrderFlush |
cancel current order, take next
Definition at line 635 of file unit.h.
Referenced by CclUnit(), HandleActionTrain(), HandleUnitAction(), ReleaseOrders(), SaveUnit(), and ShowOrder().
| std::vector<COrder *> CUnit::Orders |
orders to process
Definition at line 636 of file unit.h.
Referenced by MissileFire::Action(), AiBuildBuilding(), AiCanNotMove(), AiCheckRepair(), AiCleanForce(), AiEnemyUnitsInDistance(), AiForceAttacks(), AiRepairBuilding(), AiUnitKilled(), AssignToPlayer(), AttackTarget(), AutoAttack(), AutoRepair(), ButtonCheckNoWork(), CanTransport(), Summon::Cast(), Demolish::Cast(), CclParseOrders(), CclUnit(), CheckCanBuild(), CheckForDeadGoal(), CheckForTargetInRange(), CommandAttack(), CommandAttackGround(), CommandAutoRepair(), CommandAutoSpellCast(), CommandBoard(), CommandBuildBuilding(), CommandCancelTraining(), CommandDismiss(), CommandFollow(), CommandMove(), CommandMoveOrder(), CommandPatrolUnit(), CommandRepair(), CommandResource(), CommandSpellCast(), CommandTrainUnit(), CommandUnload(), DoRepair(), DoRightButton(), Draw(), DrawInformations(), DrawLevelCompare(), DrawShadow(), DrawTrainingUnits(), DrawUnitInfo(), DrawUnitSelection(), DropOutAll(), EnemyOnMapTile(), EnterTransporter(), FindIdleWorker(), FindNewResource(), FireMissile(), GatherResource(), GetNextOrder(), HandleActionAttack(), HandleActionBoard(), HandleActionDie(), HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), HandleActionResource(), HandleActionSpellCast(), HandleActionTrain(), HandleActionUnload(), HandleRegenerations(), HandleUnitAction(), HitUnit(), Init(), IsAliveOnMap(), IsButtonAllowed(), IsUnusable(), IsVisibleAsGoal(), IsVisibleOnMap(), IsVisibleOnMinimap(), LeaveTransporter(), LetUnitDie(), MissileHitsGoal(), MoveToDropZone(), MoveToLocation(), MoveToResource(), MoveToTarget(), MoveToTransporter(), NewPath(), NextPathElement(), PassCondition(), CPlayer::RebuildUnitsConsumingResourcesList(), Release(), ReleaseOrders(), RemoveOrder(), RepairUnit(), ResourceGiveUp(), RestoreSavedOrder(), SaveUnit(), SelectUnitsByType(), SelectUnitsInRectangle(), ShowOrder(), SpellMoveToTarget(), StartBuilding(), StartGathering(), SwapPatrolPoints(), ToggleUnitsByType(), UnitActions(), UnitClearOrders(), UnitFillSeenValues(), UnitLost(), UnitRemoveConsumingResources(), UnitShowAnimationScaled(), UnmarkUnitFieldFlags(), UpdateButtonPanelSingleUnit(), UpdateUnitVariables(), and WaitForTransporter().
order to continue after current
Definition at line 637 of file unit.h.
Referenced by AttackTarget(), AutoAttack(), AutoRepair(), CclUnit(), CheckForDeadGoal(), CheckForTargetInRange(), ClearSavedAction(), CommandStopUnit(), HandleActionAttack(), HandleActionFollow(), HandleActionPatrol(), HitUnit(), Init(), MoveToTarget(), RestoreSavedOrder(), SaveUnit(), and UnitClearOrders().
order for new trained units
Definition at line 638 of file unit.h.
Referenced by CclUnit(), CommandAttack(), CommandAttackGround(), CommandBoard(), CommandBuildBuilding(), CommandFollow(), CommandMove(), CommandPatrolUnit(), CommandRepair(), CommandResource(), CommandStandGround(), CommandStopUnit(), HandleActionTrain(), Init(), SaveUnit(), ShowOrder(), and UnitClearOrders().
| char* CUnit::AutoCastSpell |
spells to auto cast
Definition at line 639 of file unit.h.
Referenced by AutoCast(), CclUnit(), CommandAutoSpellCast(), Init(), Release(), and SaveUnit().
| unsigned CUnit::AutoRepair |
True if unit tries to repair on still action.
Definition at line 640 of file unit.h.
Referenced by AutoRepair(), CclUnit(), CommandAutoRepair(), and SaveUnit().
Storage room for different commands.
Referenced by CclParseBuilt(), CclParseHarvest(), CclParseMove(), CclParseTrain(), CommandCancelTraining(), CommandDismiss(), DoActionMove(), DoRepair(), Draw(), GatherResource(), HandleActionBuilt(), HandleActionResource(), HandleActionTrain(), LetUnitDie(), MoveToLocation(), NewPath(), NextPathElement(), SaveUnit(), StartBuilding(), UnitFillSeenValues(), UnitRemoveConsumingResources(), UpdateConstructionFrame(), and UpdateUnitVariables().
Generic goal pointer.
Definition at line 666 of file unit.h.
Referenced by SpawnPortal::Cast(), CclUnit(), Init(), NextPathElement(), Release(), and SaveUnit().
1.5.6