Advanced Strategic Command
Classes | Macros | Enumerations | Functions | Variables
typen.h File Reference
#include <time.h>
#include <list>
#include <bitset>
#include <map>
#include <SDL_types.h>
#include "global.h"
#include <limits.h>
#include "basictypes.h"
#include "basestrm.h"
#include "util/messaginghub.h"
Include dependency graph for typen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Resources
 Resources are basically the currency of ASC. More...
 
class  ResourceMatrix
 A mathematical matrix for transforming Resources instance (which is mathematically a vector) into a different Resources . More...
 
struct  GameTime
 the time in ASC, measured in turns and moves More...
 
class  MapCoodinateVector
 represents a change of a MapCoordinate More...
 
class  MapCoordinate
 Coordinate on the twodimensional map. More...
 
class  MapCoordinate3D
 Coordinate on the map including height. More...
 
class  Properties
 a class for storing general key/values pairs. Intended as a mechanism to persist data from Lua scripts More...
 
class  LoadableItemType
 An abstract base class that provides the interface for all kinds of items that ASC loads from disk. More...
 
class  deallocating_vector< T >
 a container that stores pointers and deletes the pointed-to objects on destruction More...
 
class  deallocating_map< T, U >
 a map that stores pointers as values and deletes the pointed-to objects on destruction More...
 
class  IntRange
 Represents a range of numbers, with a lower and upper boundary. More...
 
class  MoveMalusType
 The MoveMalusType categorizes the different units (Vehicle) Originally, these types were only used to determine the speed of their movement on the ground, hence the name, But now they are also used to specify production, weapon effectiveness, cargo loading capabilities and things like that. More...
 

Macros

#define chtiefgetaucht   1
 
#define chgetaucht   2
 
#define chschwimmend   4
 
#define chfahrend   8
 
#define chtieffliegend   16
 
#define chfliegend   32
 
#define chhochfliegend   64
 
#define chsatellit   128
 
#define maxmalq   10
 Constants that specify the layout of ASC. More...
 
#define minmalq   10
 
#define fieldxsize   48 /* Breite eines terrainbildes */
 
#define fieldysize   48
 
#define fielddistx   64
 
#define fielddisty   24
 
#define fielddisthalfx   32
 
#define fieldsizex   fieldxsize
 
#define fieldsizey   fieldysize
 
#define maxint   INT_MAX
 
#define minint   INT_MIN
 
#define maxfloat   FLT_MAX
 
#define minfloat   FLT_MIN
 
#define cnet_storeenergy   0x001
 
#define cnet_storematerial   0x002
 
#define cnet_storefuel   0x004
 
#define cnet_moveenergyout   0x008
 
#define cnet_movematerialout   0x010
 
#define cnet_movefuelout   0x020
 
#define cnet_stopenergyinput   0x040
 
#define cnet_stopmaterialinput   0x080
 
#define cnet_stopfuelinput   0x100
 
#define cnet_stopenergyoutput   0x200
 
#define cnet_stopmaterialoutput   0x400
 
#define cnet_stopfueloutput   0x800
 
#define destruct_building_fuel_usage   10
 
#define dissectunitresearchpointsplus   2
 
#define dissectunitresearchpointsplus2   3
 

Enumerations

enum  VisibilityStates { visible_not, visible_ago, visible_now, visible_all }
 the different states that a player's view on a field can have More...
 

Functions

Resources operator- (const Resources &res1, const Resources &res2)
 
Resources operator- (const Resources &res1)
 
Resources operator+ (const Resources &res1, const Resources &res2)
 
Resources operator* (const Resources &res1, float a)
 
Resources operator/ (const Resources &res1, float a)
 
MapCoordinate operator- (const MapCoordinate &a, const MapCoordinate &b)
 
MapCoordinate operator+ (const MapCoordinate &a, const MapCoordinate &b)
 
int getheightdelta (int height1, int height2)
 calculate the height difference between two levels of height. More...
 
vector< IntRangeString2IntRangeVector (const ASCString &t)
 parses a string repesenting a number of int ranges Example input: "10-20; 25 ; 30-125" More...
 
ASCString heightToString (int bitmappedHeight)
 

Variables

const int gamemapPixelSize = 4
 the color depth of the gamemap More...
 
const int playerNum = 9
 the maximum number of players that ASC can manage. More...
 
const int waffenanzahl = 8
 The number of different weapon types. More...
 
const int cwettertypennum = 6
 The number of different weather. More...
 
const char * cwettertypen [cwettertypennum]
 the names of the different weather More...
 
const int choehenstufennum = 8
 The number of levels of height. More...
 
const int maxbuildingpicnum = 8
 The maximum number of number of different images for a building and a weather. For example, A wind power plant might have 6 different images, depending on the direction of the wind. More...
 
const int maxunitexperience = 1000000
 The maximum experience value of a Vehicle. More...
 
const int resourceTypeNum = 3
 The number of different resources that ASC uses. More...
 
const int resourceNum = resourceTypeNum
 The number of different resources that ASC uses. More...
 
const char * resourceNames [3]
 the names of the different resources. Redundent, as we already have Resources::name More...
 
const int cmovemalitypenum = 18
 The number of vehicle categories; Each category has its own move malus. More...
 
const int cmm_building = 11
 The movemalus type for a building. It is used for SingleWeapon::targetingAccuracy . More...
 
const int cmm_trooper = 7
 the movemalus type of a trooper. More...
 
const char * cmovemalitypes [cmovemalitypenum]
 the names of the different MoveMalusTypes More...
 
const char * moveMaliTypeIcons [cmovemalitypenum]
 filenames of icons representing the varios movemalus types More...
 
const char * choehenstufen [8]
 the names of the different levels of height More...
 
const int sidenum = 6
 the number of sides that a field has; is now fixed at 6; More...
 
const int directionangle [sidenum]
 
const int attackmovecost = 0
 Constants that define the behaviour of units and buildings. More...
 
const int submarineMovement = 11
 the movemalus for all submerged units More...
 
const int mineputmovedecrease = 10
 the movement cost for putting mines on the map More...
 
const int mineremovemovedecrease = 10
 the movement cost for removing mines from the map More...
 
const int minimumBuildingDamageForConquering = 80
 if a building has at least this amount of damage, then any unit can conquer the build (and not only units having the '#conquer building' ability More...
 
const int recyclingoutput = 90
 the percentage of a units production cost that is reclaimed when the unit is recycled More...
 
const int destructoutput = 20
 the percentage of a units production cost that is reclaimed when the unit is salvaged More...
 
const int maxwindspeed = 60
 Wind with its maximum strength of 255 is moving this distance per turn. More...
 
const int generatortruckefficiency = 2
 the amount of fuel that a generator vehicle needs to produce one unit of energy More...
 
const int mine_movemalus_increase = 50
 every mine on a field increases the field's movemalus by this amount (percent) More...
 
const int resource_fuel_factor = 80
 the conversion factor between mineral resources in the ground and the normal game Resources at nominal mining station efficiency More...
 
const int resource_material_factor = 80
 
const int destruct_building_material_get = 2
 when pulling down a building, this fraction of the buildings construction cost is reclaimed More...
 
const int maxminingrange = 10
 The maximum number of fields a mining station can extract mineral resources from; Counted from its entry. More...
 
const double productionLineConstructionCostFactor = 0.5
 
const double productionLineRemovalCostFactor = 0.2
 
const int csolarkraftwerkleistung []
 
const int cnetcontrolnum = 12
 The number of netcontrol actions ; see cnetcontrol. More...
 
const char * cnetcontrol [cnetcontrolnum]
 The actions that can be used to control a ResourceNet. More...
 
const char * cgeneralnetcontrol []
 
const int maxViewRange = 255
 

Macro Definition Documentation

#define chfahrend   8
#define chfliegend   32
#define chgetaucht   2
#define chhochfliegend   64
#define chsatellit   128
#define chschwimmend   4
#define chtieffliegend   16
#define chtiefgetaucht   1

Definition at line 410 of file typen.h.

Referenced by PBPUnitCostCalculator::productionCost(), stu_height(), and terrainaccessible2().

#define cnet_moveenergyout   0x008

Definition at line 513 of file typen.h.

Referenced by Building::execnetcontrol().

#define cnet_movefuelout   0x020

Definition at line 515 of file typen.h.

#define cnet_movematerialout   0x010

Definition at line 514 of file typen.h.

#define cnet_stopenergyinput   0x040
#define cnet_stopenergyoutput   0x200

Definition at line 521 of file typen.h.

Referenced by GetResource::checkbuilding(), and Building::execnetcontrol().

#define cnet_stopfuelinput   0x100

Definition at line 519 of file typen.h.

#define cnet_stopfueloutput   0x800

Definition at line 523 of file typen.h.

#define cnet_stopmaterialinput   0x080

Definition at line 518 of file typen.h.

#define cnet_stopmaterialoutput   0x400

Definition at line 522 of file typen.h.

#define cnet_storeenergy   0x001

Definition at line 509 of file typen.h.

Referenced by Building::execnetcontrol().

#define cnet_storefuel   0x004

Definition at line 511 of file typen.h.

#define cnet_storematerial   0x002

Definition at line 510 of file typen.h.

#define destruct_building_fuel_usage   10

Definition at line 533 of file typen.h.

Referenced by DestructBuildingCommand::avail().

#define dissectunitresearchpointsplus   2

Definition at line 536 of file typen.h.

#define dissectunitresearchpointsplus2   3

Definition at line 538 of file typen.h.

#define fielddisthalfx   32
#define fielddistx   64
#define fielddisty   24
#define fieldsizex   fieldxsize
#define fieldsizey   fieldysize
#define fieldxsize   48 /* Breite eines terrainbildes */

Definition at line 431 of file typen.h.

Referenced by GuiFunctions::generate_gui_build_icon(), rotatepict(), and rotatepict_grw().

#define fieldysize   48
#define maxfloat   FLT_MAX

Definition at line 465 of file typen.h.

#define maxint   INT_MAX
#define maxmalq   10
#define minfloat   FLT_MIN

Definition at line 466 of file typen.h.

#define minint   INT_MIN
#define minmalq   10

Enumeration Type Documentation

the different states that a player's view on a field can have

Enumerator
visible_not 
visible_ago 
visible_now 
visible_all 

Definition at line 403 of file typen.h.

Function Documentation

int getheightdelta ( int  height1,
int  height2 
)

calculate the height difference between two levels of height.

Since floating and ground based are assumed to be the same effective height, a simple subtraction isn't sufficient. Height is a numeric (and not bitmapped) value

Definition at line 92 of file typen.cpp.

ASCString heightToString ( int  bitmappedHeight)

Definition at line 396 of file typen.cpp.

References choehenstufen.

Referenced by JumpDriveCommand::available().

Resources operator* ( const Resources res1,
float  a 
)

Definition at line 228 of file typen.cpp.

References Resources::resource(), and resourceTypeNum.

Resources operator+ ( const Resources res1,
const Resources res2 
)

Definition at line 221 of file typen.cpp.

MapCoordinate operator+ ( const MapCoordinate a,
const MapCoordinate b 
)
inline

Definition at line 231 of file typen.h.

References MapCoordinate::x, and MapCoordinate::y.

Resources operator- ( const Resources res1,
const Resources res2 
)

Definition at line 208 of file typen.cpp.

Resources operator- ( const Resources res1)

Definition at line 215 of file typen.cpp.

References Resources::energy, Resources::fuel, and Resources::material.

MapCoordinate operator- ( const MapCoordinate a,
const MapCoordinate b 
)
inline

Definition at line 226 of file typen.h.

References MapCoordinate::x, and MapCoordinate::y.

Resources operator/ ( const Resources res1,
float  a 
)

Definition at line 236 of file typen.cpp.

References Resources::resource(), and resourceTypeNum.

vector<IntRange> String2IntRangeVector ( const ASCString t)

parses a string repesenting a number of int ranges Example input: "10-20; 25 ; 30-125"

Definition at line 326 of file typen.cpp.

References atoi(), and StringSplit::getNextToken().

Referenced by IntRangeArrayProperty::operation_eq().

Variable Documentation

const int attackmovecost = 0

Constants that define the behaviour of units and buildings.

The movement decrease in percent of the total movemnt that is used for attacking; only used for units that can move after attacking

Definition at line 479 of file typen.h.

Referenced by Vehicle::postAttack().

const char* cgeneralnetcontrol[]

Definition at line 75 of file typen.cpp.

const char* choehenstufen[8]

the names of the different levels of height

the names of the different levels of height

Definition at line 39 of file typen.cpp.

Referenced by heightToString(), AI::showFieldInformation(), and VehiclePropertyEditor::VehiclePropertyEditor().

const int choehenstufennum = 8
const int cmm_building = 11

The movemalus type for a building. It is used for SingleWeapon::targetingAccuracy .

See Also
MoveMalusType

Definition at line 387 of file typen.h.

Referenced by attackpossible(), tunitattacksbuilding::setup(), and tunitattacksobject::setup().

const int cmm_trooper = 7

the movemalus type of a trooper.

See Also
MoveMalusType

Definition at line 390 of file typen.h.

Referenced by Mine::attacksunit(), and tmineattacksunit::setup().

const int cmovemalitypenum = 18
const char* cmovemalitypes[cmovemalitypenum]

the names of the different MoveMalusTypes

See Also
MoveMalusType

Definition at line 43 of file typen.cpp.

Referenced by DataTab::setData(), UnitInfoDialog::UnitInfoDialog(), CargoDialog::updateVariables(), CargoDialog::userHandler(), and viewterraininfo().

const char* cnetcontrol[cnetcontrolnum]

The actions that can be used to control a ResourceNet.

Definition at line 71 of file typen.cpp.

const int cnetcontrolnum = 12

The number of netcontrol actions ; see cnetcontrol.

Definition at line 551 of file typen.h.

const int csolarkraftwerkleistung[]

Definition at line 87 of file typen.cpp.

Referenced by SolarPowerplant::getPlus().

const char* cwettertypen[cwettertypennum]
const int cwettertypennum = 6
const int destruct_building_material_get = 2

when pulling down a building, this fraction of the buildings construction cost is reclaimed

Definition at line 532 of file typen.h.

const int destructoutput = 20

the percentage of a units production cost that is reclaimed when the unit is salvaged

Definition at line 498 of file typen.h.

Referenced by RecycleUnitCommand::getOutput().

const int directionangle[sidenum]

Definition at line 81 of file typen.cpp.

Referenced by ContainerBase::paintField().

const int gamemapPixelSize = 4

the color depth of the gamemap

Definition at line 46 of file typen.h.

const int generatortruckefficiency = 2

the amount of fuel that a generator vehicle needs to produce one unit of energy

Definition at line 504 of file typen.h.

Referenced by Vehicle::endRound().

const int maxbuildingpicnum = 8

The maximum number of number of different images for a building and a weather. For example, A wind power plant might have 6 different images, depending on the direction of the wind.

Definition at line 70 of file typen.h.

Referenced by BuildingType::BuildingType(), BuildingType::getMemoryFootprint(), BuildingType::read(), and BuildingType::write().

const int maxminingrange = 10

The maximum number of fields a mining station can extract mineral resources from; Counted from its entry.

Definition at line 542 of file typen.h.

Referenced by MiningGraph::MiningGraph(), GetMiningInfo::MiningInfo::MiningInfo(), and MiningStation::run().

const int maxunitexperience = 1000000

The maximum experience value of a Vehicle.

Definition at line 73 of file typen.h.

Referenced by TrainUnitCommand::avail(), tfight::calc(), AttackFormula::getIconIndex(), TrainUnitCommand::go(), and ConstructUnitCommand::go().

const int maxViewRange = 255
const int maxwindspeed = 60
const int mine_movemalus_increase = 50

every mine on a field increases the field's movemalus by this amount (percent)

Definition at line 507 of file typen.h.

Referenced by MapField::getmovemalus().

const int mineputmovedecrease = 10

the movement cost for putting mines on the map

Definition at line 485 of file typen.h.

Referenced by PutMineCommand::go(), and PutMineCommand::searchFields().

const int mineremovemovedecrease = 10

the movement cost for removing mines from the map

Definition at line 488 of file typen.h.

const int minimumBuildingDamageForConquering = 80

if a building has at least this amount of damage, then any unit can conquer the build (and not only units having the '#conquer building' ability

Definition at line 492 of file typen.h.

Referenced by ContainerBase::vehicleLoadable().

const char* moveMaliTypeIcons[cmovemalitypenum]

filenames of icons representing the varios movemalus types

See Also
MoveMalusType

Definition at line 51 of file typen.cpp.

Referenced by CargoDialog::updateVariables(), and CargoDialog::userHandler().

const int playerNum = 9

the maximum number of players that ASC can manage.

This includes the neutral semi-player (color: grey), who doesn't play, but who may own buildings on the map. The maximum number of active players is playerNum-1

See Also
GameMap::getPlayerCount()

Definition at line 54 of file typen.h.

Referenced by AllianceSetupWidget::AllianceSetupWidget(), checkunitsforremoval(), evaluateviewcalculation(), ClipBoardBase::place(), and ColorTransform_PlayerTrueColHSV< pixelsize >::setPlayer().

const double productionLineConstructionCostFactor = 0.5

Definition at line 544 of file typen.h.

Referenced by BuildProductionLineCommand::resourcesNeeded().

const double productionLineRemovalCostFactor = 0.2

Definition at line 545 of file typen.h.

Referenced by RemoveProductionLineCommand::resourcesNeeded().

const int recyclingoutput = 90

the percentage of a units production cost that is reclaimed when the unit is recycled

Definition at line 495 of file typen.h.

Referenced by RecycleUnitCommand::getOutput().

const int resource_fuel_factor = 80

the conversion factor between mineral resources in the ground and the normal game Resources at nominal mining station efficiency

Definition at line 528 of file typen.h.

Referenced by MiningStation::testfield(), and GetMiningInfo::testfield().

const int resource_material_factor = 80

Definition at line 529 of file typen.h.

Referenced by MiningStation::testfield(), and GetMiningInfo::testfield().

const char* resourceNames[3]
const int resourceNum = resourceTypeNum

The number of different resources that ASC uses.

Definition at line 79 of file typen.h.

Referenced by ContainerBase::getResource(), and ContainerBase::putResource().

const int resourceTypeNum = 3
const int sidenum = 6
const int submarineMovement = 11

the movemalus for all submerged units

Definition at line 482 of file typen.h.

Referenced by calcMoveMalus().

const int waffenanzahl = 8

The number of different weapon types.

Definition at line 58 of file typen.h.

Referenced by Building::Building(), copyBuildingData(), BuildingValues::init(), tnetworkloaders::loadnwgame(), and Building::write().