$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 <unittype.h>
Public Member Functions | |
Vec2i | GetHalfTileSize () const |
bool | CanTransport () const |
bool | CanSelect (GroupSelectionMode mode=SELECTABLE_BY_RECTANGLE_ONLY) const |
unittype.cpp - The unit types. | |
CUnitType () | |
~CUnitType () | |
PixelSize | GetPixelSize () const |
bool | CheckUserBoolFlags (const char *BoolFlags) const |
Shadow sprite image. | |
bool | CanMove () const |
Public Attributes | |
std::string | Ident |
std::string | Name |
Identifier. | |
int | Slot |
Pretty name shown from the engine. | |
std::string | File |
Type as number. | |
std::string | ShadowFile |
Sprite files. | |
int | Width |
Shadow file. | |
int | Height |
Sprite width. | |
int | OffsetX |
Sprite height. | |
int | OffsetY |
Sprite horizontal offset. | |
int | DrawLevel |
Sprite vertical offset. | |
int | ShadowWidth |
Level to Draw UnitType at. | |
int | ShadowHeight |
Shadow sprite width. | |
int | ShadowOffsetX |
Shadow sprite height. | |
int | ShadowOffsetY |
Shadow horizontal offset. | |
PixelPos | MissileOffsets [UnitSides][MaxAttackPos] |
Shadow vertical offset. | |
CAnimations * | Animations |
Attack offsets for missiles. | |
int | StillFrame |
Animation scripts. | |
IconConfig | Icon |
Still frame. | |
struct CUnitType::_portrait_ | Portrait |
Icon to display for this unit. | |
MissileConfig | Missile |
MissileConfig | Explosion |
Missile weapon. | |
MissileConfig | Impact [ANIMATIONS_DEATHTYPES+2] |
Missile for unit explosion. | |
LuaCallback * | DeathExplosion |
Missiles spawned if unit is hit(+shield). | |
LuaCallback * | OnHit |
LuaCallback * | OnEachCycle |
lua function called when unit is hit | |
LuaCallback * | OnEachSecond |
lua function called every cycle | |
std::string | DamageType |
lua function called every second | |
std::string | CorpseName |
DamageType (used for extra death animations and impacts). | |
CUnitType * | CorpseType |
Corpse type name. | |
CConstruction * | Construction |
Corpse unit-type. | |
int | RepairHP |
What is shown in construction phase. | |
int | RepairCosts [MaxCosts] |
Amount of HP per repair. | |
int | TileWidth |
How much it costs to repair. | |
int | TileHeight |
Tile size on map width. | |
int | BoxWidth |
Tile size on map height. | |
int | BoxHeight |
Selected box size width. | |
int | NumDirections |
Selected box size height. | |
int | MinAttackRange |
Number of directions unit can face. | |
int | ReactRangeComputer |
Minimal attack range. | |
int | ReactRangePerson |
Reacts on enemy for computer. | |
int | Priority |
Reacts on enemy for person player. | |
int | BurnPercent |
Priority value / AI Treatment. | |
int | BurnDamageRate |
Burning percent. | |
int | RepairRange |
HP burn rate per sec. | |
char * | CanCastSpell |
Units repair range. | |
char * | AutoCastActive |
Unit is able to use spells. | |
int | AutoBuildRate |
Default value for autocast. | |
int | RandomMovementProbability |
The rate at which the building builds itself. | |
int | ClicksToExplode |
Probability to move randomly. | |
int | MaxOnBoard |
Number of consecutive clicks until unit suicides. | |
int | StartingResources |
Number of Transporter slots. | |
UnitTypeType | UnitType |
originally only visual effect, we do more with this! | |
int | DecayRate |
Land / fly / naval. | |
int | AnnoyComputerFactor |
Decay rate in 1/6 seconds. | |
int | MouseAction |
How much this annoys the computer. | |
int | CanTarget |
unsigned | Flip: 1 |
unsigned | Revealer: 1 |
Flip image when facing left. | |
unsigned | LandUnit: 1 |
reveal the fog of war | |
unsigned | AirUnit: 1 |
Land animated. | |
unsigned | SeaUnit: 1 |
Air animated. | |
unsigned | ExplodeWhenKilled: 1 |
Sea animated. | |
unsigned | Building: 1 |
Death explosion animated. | |
unsigned | VisibleUnderFog: 1 |
Building. | |
unsigned | PermanentCloak: 1 |
Unit is visible under fog of war. | |
unsigned | DetectCloak: 1 |
Is only visible by CloakDetectors. | |
unsigned | Coward: 1 |
Can see Cloaked units. | |
unsigned | AttackFromTransporter: 1 |
Unit will only attack if instructed. | |
unsigned | Vanishes: 1 |
Can attack from transporter. | |
unsigned | GroundAttack: 1 |
Corpes & destroyed places. | |
unsigned | ShoreBuilding: 1 |
Can do command ground attack. | |
unsigned | CanAttack: 1 |
Building must be build on coast. | |
unsigned | BuilderOutside: 1 |
Unit can attack. | |
unsigned | BuilderLost: 1 |
The builder stays outside during the build. | |
unsigned | CanHarvest: 1 |
The builder is lost after the build. | |
unsigned | Harvester: 1 |
Resource can be harvested. | |
unsigned | Neutral: 1 |
unit is a resource harvester. | |
unsigned | SelectableByRectangle: 1 |
Unit is neutral, used by the editor. | |
unsigned | IsNotSelectable: 1 |
Selectable with mouse rectangle. | |
unsigned | Decoration: 1 |
Unit should not be selected during game. | |
unsigned | Indestructible: 1 |
Unit is a decoration (act as tile). | |
unsigned | Teleporter: 1 |
Unit is indestructible (take no damage). | |
unsigned | ShieldPiercing: 1 |
Can teleport other units. | |
unsigned | SaveCargo: 1 |
Can directly damage shield-protected units, without shield damaging. | |
unsigned | NonSolid: 1 |
Unit unloads his passengers after death. | |
unsigned | Wall: 1 |
Unit can be entered by other units. | |
CUnitStats | DefaultStat |
Use special logic for Direction field. | |
std::vector< BoolFlags > | BoolFlag |
int | CanStore [MaxCosts] |
int | GivesResource |
Resources that we can store here. | |
ResourceInfo * | ResInfo [MaxCosts] |
The resource this unit gives. | |
std::vector< CBuildRestriction * > | BuildingRules |
Resource information. | |
std::vector< CBuildRestriction * > | AiBuildingRules |
Rules list for building a building. | |
SDL_Color | NeutralMinimapColorRGB |
Rules list for for AI to build a building. | |
CUnitSound | Sound |
Minimap Color for Neutral Units. | |
int | Supply |
Sounds for events. | |
int | Demand |
Food supply. | |
int | ImproveIncomes [MaxCosts] |
Food demand. | |
unsigned | FieldFlags |
Gives player an improved income. | |
unsigned | MovementMask |
Unit map field flags. | |
CUnitStats | Stats [PlayerMax] |
Unit check this map flags for move. | |
CPlayerColorGraphic * | Sprite |
Unit status for each player. | |
CGraphic * | ShadowSprite |
Sprite images. | |
Classes | |
struct | _portrait_ |
Icon to display for this unit. More... | |
struct | BoolFlags |
This class contains the information that is shared between all units of the same type and determins if a unit is a building, a person, ...
The unit-type class members:
Unique identifier of the unit-type, used to reference it in config files and during startup. As convention they start with "unit-" fe. "unit-farm".
Pretty name shown by the engine. The name should be shorter than 17 characters and no word can be longer than 8 characters.
Path file name of the sprite file.
Path file name of shadow sprite file.
The Level/Order to draw this type of unit in. 0-255 usually.
CUnitType::Width CUnitType::Height
Size of a sprite frame in pixels. All frames of a sprite have the same size. Also all sprites (tilesets) must have the same size.
CUnitType::ShadowWidth CUnitType::ShadowHeight
Size of a shadow sprite frame in pixels. All frames of a sprite have the same size. Also all sprites (tilesets) must have the same size.
CUnitType::ShadowOffsetX CUnitType::ShadowOffsetY
Vertical offset to draw the shadow in pixels.
Animation scripts for the different actions. Currently the animations still, move, attack and die are supported.
Icon to display for this unit-type. Contains configuration and run time variable.
Configuration and run time variable of the missile weapon.
Configuration and run time variable of the missile explosion. This is the explosion that happens if unit is set to ExplodeWhenKilled
Corpse unit-type name, should only be used during setup.
Corpse unit-type pointer, only this should be used during run time. Many unit-types can share the same corpse.
What is shown in construction phase.
CUnitType::SightRange
Sight range
CUnitType::_HitPoints
Maximum hit points
CUnitType::_Costs[MaxCosts]
How many resources needed
The HP given to a unit each cycle it's repaired. If zero, unit cannot be repaired
CUnitType::RepairCosts[MaxCosts]
Costs per repair cycle to fix a unit.
Tile size on map width
Tile size on map height
Selected box size width
Selected box size height
Number of directions the unit can face
Minimal attack range
Reacts on enemy for computer
Reacts on enemy for person player
Priority value / AI Treatment
The burning limit in percents. If the unit has lees than this it will start to burn.
Burn rate in HP per second
Land / fly / naval
Decay rate in 1/6 seconds
CUnitType::AnnoyComputerFactor
How much this annoys the computer
Right click action
CUnitType::Points
How many points you get for unit. Used in the final score table.
Which units can it attack
Unit::Revealer
A special unit used to reveal the map for a time. This unit has active sight even when Removed. It's used for Reveal map type of spells.
Land animated
Air animated
Sea animated
Death explosion animated
CUnitType::RandomMovementProbability
When the unit is idle this is the probability that it will take a step in a random direction, in percents.
If this is non-zero, then after that many clicks the unit will commit suicide. Doesn't work with resource workers/resources.
Unit is a Building
Unit is visible under fog of war.
Unit is permanently cloaked.
These units can detect Cloaked units.
Unit is a coward, and acts defensively. it will not attack at will and auto-casters will not buff it(bloodlust).
CUnitType::Transporter
Can transport units
CUnitType::AttackFromTransporter
Units inside this transporter can attack with missiles.
Maximum units on board (for transporters), and resources
CUnitType::StartingResources Amount of Resources a unit has when It's Built
CUnitType::DamageType Unit's missile damage type (used for extra death animations)
This equals to the resource Id of the resource given or 0 (TimeCost) for other buildings.
Resource can be harvested. It's false for things like oil patches.
Unit is a resource worker. Faster than examining ResInfo
Information about resource harvesting. If NULL, it can't harvest it.
CUnitType::NeutralMinimapColorRGB
Says what color a unit will have when it's neutral and is displayed on the minimap.
What resource types we can store here.
Corpes & destroyed places
Can do command ground attack
Building must be build on coast
Unit is able to use spells
Unit is able to attack.
Unit can repair buildings. It will use the actack animation. It will heal 4 points for every repair cycle, and cost 1 of each resource, alternatively(1 cycle wood, 1 cycle gold)
Only valid for buildings. When building the worker will remain outside inside the building.
BuilderOutside flag must have the CanRepair flag.
Only valid for buildings without the BuilderOutside flag. The worker is lost when the building is completed.
CUnitType::SelectableByRectangle
Selectable with mouse rectangle
Can teleport other units.
Can directly damage shield-protected units, without shield damaging.
Unit unloads his passengers after death.
Sounds for events
CUnitType::Weapon
Current sound for weapon
How much food does this unit supply.
Food demand
CUnitType::ImproveIncomes[MaxCosts]
Gives the player an improved income.
Flags that are set, if a unit enters a map field or cleared, if a unit leaves a map field.
Movement mask, this value is and'ed to the map field flags, to see if a unit can enter or placed on the map field.
Unit status for each player
Type as number
Sprite images
Shadow sprite images
CUnitType::PlayerColorSprite
Sprite images of the player colors. This image is drawn over CUnitType::Sprite. Used with OpenGL only.
CUnitType::CUnitType | ( | ) |
CUnitType::~CUnitType | ( | ) |
Vec2i CUnitType::GetHalfTileSize | ( | ) | const [inline] |
PixelSize CUnitType::GetPixelSize | ( | ) | const |
bool CUnitType::CheckUserBoolFlags | ( | const char * | BoolFlags | ) | const |
Shadow sprite image.
bool CUnitType::CanTransport | ( | ) | const [inline] |
bool CUnitType::CanMove | ( | ) | const |
bool CUnitType::CanSelect | ( | GroupSelectionMode | mode = SELECTABLE_BY_RECTANGLE_ONLY |
) | const [inline] |
std::string CUnitType::Ident |
std::string CUnitType::Name |
Identifier.
int CUnitType::Slot |
Pretty name shown from the engine.
std::string CUnitType::File |
Type as number.
std::string CUnitType::ShadowFile |
Sprite files.
int CUnitType::Width |
Shadow file.
Sprite width.
Sprite height.
Sprite horizontal offset.
Sprite vertical offset.
Level to Draw UnitType at.
Shadow sprite width.
Shadow sprite height.
Shadow horizontal offset.
PixelPos CUnitType::MissileOffsets[UnitSides][MaxAttackPos] |
Shadow vertical offset.
Attack offsets for missiles.
Animation scripts.
Still frame.
Icon to display for this unit.
Missile weapon.
MissileConfig CUnitType::Impact[ANIMATIONS_DEATHTYPES+2] |
Missile for unit explosion.
Missiles spawned if unit is hit(+shield).
lua function called when unit is hit
lua function called every cycle
std::string CUnitType::DamageType |
lua function called every second
std::string CUnitType::CorpseName |
DamageType (used for extra death animations and impacts).
Corpse type name.
Corpse unit-type.
What is shown in construction phase.
int CUnitType::RepairCosts[MaxCosts] |
Amount of HP per repair.
How much it costs to repair.
Tile size on map width.
Tile size on map height.
Selected box size width.
Selected box size height.
Number of directions unit can face.
Minimal attack range.
Reacts on enemy for computer.
Reacts on enemy for person player.
Priority value / AI Treatment.
Burning percent.
HP burn rate per sec.
char* CUnitType::CanCastSpell |
Units repair range.
Unit is able to use spells.
Default value for autocast.
The rate at which the building builds itself.
Probability to move randomly.
Number of consecutive clicks until unit suicides.
Number of Transporter slots.
originally only visual effect, we do more with this!
Amount of Resources on build
Land / fly / naval.
Decay rate in 1/6 seconds.
How much this annoys the computer.
unsigned CUnitType::Flip |
unsigned CUnitType::Revealer |
Flip image when facing left.
unsigned CUnitType::LandUnit |
reveal the fog of war
unsigned CUnitType::AirUnit |
Land animated.
unsigned CUnitType::SeaUnit |
Air animated.
unsigned CUnitType::ExplodeWhenKilled |
Sea animated.
unsigned CUnitType::Building |
Death explosion animated.
unsigned CUnitType::VisibleUnderFog |
Building.
unsigned CUnitType::PermanentCloak |
Unit is visible under fog of war.
unsigned CUnitType::DetectCloak |
Is only visible by CloakDetectors.
unsigned CUnitType::Coward |
Can see Cloaked units.
unsigned CUnitType::AttackFromTransporter |
Unit will only attack if instructed.
unsigned CUnitType::Vanishes |
Can attack from transporter.
unsigned CUnitType::GroundAttack |
Corpes & destroyed places.
unsigned CUnitType::ShoreBuilding |
Can do command ground attack.
unsigned CUnitType::CanAttack |
Building must be build on coast.
unsigned CUnitType::BuilderOutside |
Unit can attack.
unsigned CUnitType::BuilderLost |
The builder stays outside during the build.
unsigned CUnitType::CanHarvest |
The builder is lost after the build.
unsigned CUnitType::Harvester |
Resource can be harvested.
unsigned CUnitType::Neutral |
unit is a resource harvester.
unsigned CUnitType::SelectableByRectangle |
Unit is neutral, used by the editor.
unsigned CUnitType::IsNotSelectable |
Selectable with mouse rectangle.
unsigned CUnitType::Decoration |
Unit should not be selected during game.
unsigned CUnitType::Indestructible |
Unit is a decoration (act as tile).
unsigned CUnitType::Teleporter |
Unit is indestructible (take no damage).
unsigned CUnitType::ShieldPiercing |
Can teleport other units.
unsigned CUnitType::SaveCargo |
Can directly damage shield-protected units, without shield damaging.
unsigned CUnitType::NonSolid |
Unit unloads his passengers after death.
unsigned CUnitType::Wall |
Unit can be entered by other units.
Use special logic for Direction field.
std::vector<BoolFlags> CUnitType::BoolFlag |
int CUnitType::CanStore[MaxCosts] |
Resources that we can store here.
ResourceInfo* CUnitType::ResInfo[MaxCosts] |
The resource this unit gives.
std::vector<CBuildRestriction *> CUnitType::BuildingRules |
Resource information.
std::vector<CBuildRestriction *> CUnitType::AiBuildingRules |
Rules list for building a building.
SDL_Color CUnitType::NeutralMinimapColorRGB |
Rules list for for AI to build a building.
Minimap Color for Neutral Units.
Sounds for events.
Food supply.
int CUnitType::ImproveIncomes[MaxCosts] |
Food demand.
unsigned CUnitType::FieldFlags |
Gives player an improved income.
unsigned CUnitType::MovementMask |
Unit map field flags.
CUnitStats CUnitType::Stats[PlayerMax] |
Unit status for each player.
Sprite images.