Advanced Strategic Command
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
BuildingType Class Reference

The class describing properties that are common to all buildings of a certain kind. More...

#include <buildingtype.h>

Inheritance diagram for BuildingType:
Inheritance graph
[legend]

Classes

class  LocalCoordinate
 A local coordinate referencing a single field that a building covers. More...
 

Public Types

typedef multimap
< LocalCoordinate, int > 
DestructionObjects
 
- Public Types inherited from ContainerBaseType
enum  ContainerFunctions {
  TrainingCenter, InternalVehicleProduction, AmmoProduction, InternalUnitRepair,
  RecycleUnits, Research, Sonar, SatelliteView,
  MineView, WindPowerPlant, SolarPowerPlant, MatterConverter,
  MiningStation, ProduceNonLeavableUnits, ResourceSink, ExternalEnergyTransfer,
  ExternalMaterialTransfer, ExternalFuelTransfer, ExternalAmmoTransfer, ExternalRepair,
  NoObjectChaining, SelfDestructOnConquer, Paratrooper, PlaceMines,
  CruiserLanding, ConquerBuildings, MoveAfterAttack, ExternalVehicleProduction,
  ConstructBuildings, IceBreaker, NoInairRefuelling, MakesTracks,
  DetectsMineralResources, NoReactionfire, AutoRepair, KamikazeOnly,
  ImmuneToMines, JamsOnlyOwnField, MoveWithReactionFire, OnlyMoveToAndFromTransports,
  AutoHarvestObjects, NoProductionCustomization, ManualSelfDestruct, NoMineRemoval,
  NoImageRotation
}
 
typedef vector< TransportationIOEntranceSystems
 

Public Member Functions

void convertOldFunctions (int abilities, const ASCString &location)
 the method for specifying a building's abilility was change at some point in time. More...
 
int getMoveMalusType () const
 
const SurfacegetPicture (const LocalCoordinate &localCoordinate, int weather=0, int constructionStep=0) const
 
void paint (Surface &s, SPoint pos, const PlayerColor &player, int weather=0, int constructionStep=0) const
 
void paint (Surface &s, SPoint pos) const
 
void paintSingleField (Surface &s, SPoint pos, const LocalCoordinate &localCoordinate, const PlayerColor &player, int weather=0, int constructionStep=0) const
 
void paintSingleField (Surface &s, SPoint pos, const LocalCoordinate &localCoordinate, int weather=0, int constructionStep=0) const
 
int getBIPicture (const LocalCoordinate &localCoordinate, int weather=0, int constructionStep=0) const
 
bool fieldExists (const LocalCoordinate &localCoordinate) const
 returns whether this building covers the given field More...
 
 BuildingType (void)
 
MapCoordinate getFieldCoordinate (const MapCoordinate &entryOnMap, const LocalCoordinate &localCoordinate) const
 returns the Mapcoordinate of a buildings field More...
 
LocalCoordinate getLocalCoordinate (const MapCoordinate &entryOnMap, const MapCoordinate &field) const
 converts a global coordinate into a local coordinate. More...
 
void read (tnstream &stream)
 read the binary representation of this item from the given stream More...
 
void write (tnstream &stream) const
 write the binary representation of this item to the given stream More...
 
void runTextIO (PropertyContainer &pc)
 registers the properties of this item for loading/writing into asctxt files More...
 
int getMemoryFootprint () const
 
- Public Member Functions inherited from ContainerBaseType
 ContainerBaseType ()
 
bool hasFunction (ContainerFunctions function) const
 
bool hasAnyFunction (std::bitset< 64 > functions) const
 
ASCString getName () const
 
int getID () const
 
int getHeight () const
 
virtual ~ContainerBaseType ()
 
void runTextIO (PropertyContainer &pc)
 registers the properties of this item for loading/writing into asctxt files More...
 
bool vehicleFit (const VehicleType *type) const
 can units of the given type be moved into this buildtype? This is a prerequisite - but not the only requirement - for a real unit to move into a real building More...
 
int vehicleUnloadable (const VehicleType *vehicleType, int carrierHeight) const
 checks the unloading of a unit type More...
 
void read (tnstream &stream)
 read the binary representation of this item from the given stream More...
 
void write (tnstream &stream) const
 write the binary representation of this item to the given stream More...
 
Resources getStorageCapacity (int mode) const
 returns the Storage capacity of the unit More...
 
- Public Member Functions inherited from MapItemType
virtual ~MapItemType ()
 
- Public Member Functions inherited from LoadableItemType
virtual ~LoadableItemType ()
 
- Public Member Functions inherited from MemorySizeQueryInterface
virtual ~MemorySizeQueryInterface ()
 

Public Attributes

bool field_Exists [xdimension][ydimension]
 
Surface w_picture [cwettertypennum][maxbuildingpicnum][4][6]
 
int bi_picture [cwettertypennum][maxbuildingpicnum][4][6]
 
BitSet weatherBits
 
DestructionObjects destructionObjects
 when the building is destroyed, it can leave rubble objects behind. If set to 0 no objects are being created More...
 
LocalCoordinate entry
 the position of the entrance, which is the field of the building where units can enter and leave More...
 
int _armor
 the armor of the buildingtype. More...
 
int technologylevel
 not used at the moment More...
 
TerrainAccess terrainaccess
 the terrain properties which are necessary for the building to be constructed there More...
 
int construction_steps
 the number of stages that are required to construct a building using a construction unit. Each stage has a separate picture. Range is 1 to 8 More...
 
int externalloadheight
 bitmapped: units on these levels of height may be refuelled when standing next to the buildings entry More...
 
bool buildingNotRemovable
 if true, this building can not be removed by the player with his construction vehicles More...
 
- Public Attributes inherited from ContainerBaseType
int id
 
vector< int > secondaryIDs
 when loading a file and these IDs are encountered, this object will be used. More...
 
ASCString name
 a short name, for example B-52 More...
 
ASCString description
 short description of the units role, for example "strategic bomber" More...
 
ASCString infotext
 an extensive information about the unit/building which may be several paragraphs long More...
 
int jamming
 the radar jamming power More...
 
int view
 the visibility range More...
 
int height
 the levels of height which this unit can enter More...
 
Resources productionCost
 
int maxLoadableUnits
 the maximum number of units that can be loaded More...
 
int maxLoadableUnitSize
 the maximum size of a unit that may enter the building More...
 
int maxLoadableWeight
 the maximum total weight of all loaded units More...
 
int vehicleCategoriesStorable
 bitmapped: vehicle categories that can be stored the container More...
 
int vehicleCategoriesProduceable
 bitmapped: vehicle categories that can be produced in the container More...
 
vector< IntRangevehiclesInternallyProduceable
 the default production capabilities of this container. More...
 
EntranceSystems entranceSystems
 
TechAdapterDependency techDependency
 
ASCString infoImageFilename
 the filename of an image that is shown in info dialogs More...
 
ASCString infoImageSmallFilename
 
int efficiencyfuel
 currently only used by mining stations: the efficiency of the resource extraction from the ground. Base is 1024 More...
 
int efficiencymaterial
 currently only used by mining stations: the efficiency of the resource extraction from the ground. Base is 1024 More...
 
int maxresearchpoints
 the maximum number of research points a research center may produce More...
 
int defaultMaxResearchpoints
 when a building of this type is placed on a map, its maxResearch property will be set to this value More...
 
int nominalresearchpoints
 the number of reseach points for which the plus settings apllies More...
 
int minFieldRepairDamage
 if the unit is repaired in the field (that is, not inside a transport or building), it can only be repaired up to this level 0 would result in a complete repair being possible, 20 that it can only be restored to 20% damage (80% health). More...
 
Resources maxplus
 
Resources defaultProduction
 if a new building is constructed, this will be the resource production of the building More...
 
ResourceMatrix productionEfficiency
 
struct {
   int   range
 
   int   maxFieldsPerTurn
 
   vector< IntRange >   objectsHarvestable
 the ids of objects this unit can construct More...
 
   vector< IntRange >   objectGroupsHarvestable
 the group-ids of objects this unit can construct More...
 
autoHarvest
 
- Public Attributes inherited from LoadableItemType
ASCString filename
 The name of the file from which the item was loaded. More...
 
ASCString location
 The filename and location on disk (including containerfiles) of the object. More...
 
ASCString archive
 

Static Public Attributes

static const int xdimension = 4
 
static const int ydimension = 6
 
static const int cbuildingfunctionnum = 24
 the number of legacy abilities that a building could be equipped with More...
 
- Static Public Attributes inherited from ContainerBaseType
static const int functionNum = 45
 

Additional Inherited Members

- Static Public Member Functions inherited from ContainerBaseType
static const char * getFunctionName (ContainerFunctions function)
 
- Protected Member Functions inherited from ContainerBaseType
void setFunction (ContainerFunctions function)
 
- Protected Attributes inherited from ContainerBaseType
std::bitset< 64 > features
 
Resources asc_mode_tank
 
Resources bi_mode_tank
 

Detailed Description

The class describing properties that are common to all buildings of a certain kind.

See Also
Building

Definition at line 35 of file buildingtype.h.

Member Typedef Documentation

Definition at line 69 of file buildingtype.h.

Constructor & Destructor Documentation

BuildingType::BuildingType ( void  )

Member Function Documentation

void BuildingType::convertOldFunctions ( int  abilities,
const ASCString location 
)
bool BuildingType::fieldExists ( const LocalCoordinate localCoordinate) const
inline
int BuildingType::getBIPicture ( const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const
MapCoordinate BuildingType::getFieldCoordinate ( const MapCoordinate entryOnMap,
const LocalCoordinate localCoordinate 
) const

returns the Mapcoordinate of a buildings field

Parameters
entryOnMapThe location of the buildings entry on the map
localCoordinateThe relative coordinate of the buildings segment for which is global MapCoordinate is going to be calculated and returned.

Definition at line 173 of file buildingtype.cpp.

References entry, BuildingType::LocalCoordinate::x, MapCoordinate::x, BuildingType::LocalCoordinate::y, and MapCoordinate::y.

Referenced by ConstructBuildingCommand::buildingFits(), Reinforcements::execute(), Building::getFieldCoordinates(), ClipBoardBase::place(), BuildingItem::place(), putbuilding(), and SpawnBuilding::runAction().

BuildingType::LocalCoordinate BuildingType::getLocalCoordinate ( const MapCoordinate entryOnMap,
const MapCoordinate field 
) const

converts a global coordinate into a local coordinate.

Definition at line 186 of file buildingtype.cpp.

References entry, fieldExists(), BuildingType::LocalCoordinate::x, MapCoordinate::x, BuildingType::LocalCoordinate::y, and MapCoordinate::y.

Referenced by Building::getLocalCoordinate().

int BuildingType::getMemoryFootprint ( ) const
virtual

Implements MemorySizeQueryInterface.

Definition at line 89 of file buildingtype.cpp.

References cwettertypennum, maxbuildingpicnum, and w_picture.

int BuildingType::getMoveMalusType ( ) const
inlinevirtual

Implements ContainerBaseType.

Definition at line 91 of file buildingtype.h.

const Surface & BuildingType::getPicture ( const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const
void BuildingType::paint ( Surface s,
SPoint  pos,
const PlayerColor player,
int  weather = 0,
int  constructionStep = 0 
) const

Definition at line 123 of file buildingtype.cpp.

References fieldExists(), and paintSingleField().

Referenced by BuildingItem::display(), and Building::getImage().

void BuildingType::paint ( Surface s,
SPoint  pos 
) const

Definition at line 132 of file buildingtype.cpp.

References fieldExists(), and paintSingleField().

void BuildingType::paintSingleField ( Surface s,
SPoint  pos,
const LocalCoordinate localCoordinate,
const PlayerColor player,
int  weather = 0,
int  constructionStep = 0 
) const
void BuildingType::paintSingleField ( Surface s,
SPoint  pos,
const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const
void BuildingType::read ( tnstream stream)
virtual
void BuildingType::runTextIO ( PropertyContainer pc)
virtual

registers the properties of this item for loading/writing into asctxt files

Implements LoadableItemType.

Definition at line 532 of file buildingtype.cpp.

References _armor, PropertyContainer::addBool(), PropertyContainer::addBreakpoint(), PropertyContainer::addImage(), PropertyContainer::addInteger(), PropertyContainer::addIntegerArray(), PropertyContainer::addString(), PropertyContainer::addTagArray(), PropertyContainer::addTagInteger(), applyFieldMask(), bi_picture, MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::blit(), buildingFunctionTags, buildingNotRemovable, cbuildingfunctionnum, choehenstufennum, PropertyContainer::closeBracket(), construction_steps, containerFunctionTags, convertOldFunctions(), Surface::createSurface(), cwettertypennum, destructionObjects, entry, PropertyContainer::error(), externalloadheight, extractFileName_withoutSuffix(), ContainerBaseType::features, field_Exists, fielddisthalfx, fielddistx, fielddisty, fieldExists(), fieldsizex, fieldsizey, LoadableItemType::filename, PropertyContainer::find(), ContainerBaseType::functionNum, PropertyContainer::getFileName(), StringTokenizer::getNextToken(), ContainerBaseType::height, heightTags, PropertyContainer::isReading(), megaBlitter(), ContainerBaseType::name, nullParam, PropertyContainer::openBracket(), ContainerBaseType::productionCost, TerrainAccess::runTextIO(), TechAdapterDependency::runTextIO(), Resources::runTextIO(), ContainerBaseType::runTextIO(), strrr(), ContainerBaseType::techDependency, technologylevel, terrainaccess, BuildingType::LocalCoordinate::toString(), w_picture, weatherAbbrev, weatherBits, weatherTags, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

Referenced by execaction_pg().

void BuildingType::write ( tnstream stream) const
virtual

Member Data Documentation

int BuildingType::_armor

the armor of the buildingtype.

This does not necessarily be equal to the armor of a specific building during the game, since the map may modify the armor of buildings with a map parameter. Use Building::getArmor() to query the effective armor.

Definition at line 80 of file buildingtype.h.

Referenced by Building::getArmor(), read(), runTextIO(), and write().

int BuildingType::bi_picture[cwettertypennum][maxbuildingpicnum][4][6]

Definition at line 43 of file buildingtype.h.

Referenced by BuildingType(), getBIPicture(), getPicture(), read(), runTextIO(), and write().

bool BuildingType::buildingNotRemovable

if true, this building can not be removed by the player with his construction vehicles

Definition at line 126 of file buildingtype.h.

Referenced by BuildingType(), read(), runTextIO(), and write().

const int BuildingType::cbuildingfunctionnum = 24
static

the number of legacy abilities that a building could be equipped with

Definition at line 54 of file buildingtype.h.

Referenced by runTextIO().

int BuildingType::construction_steps

the number of stages that are required to construct a building using a construction unit. Each stage has a separate picture. Range is 1 to 8

Definition at line 89 of file buildingtype.h.

Referenced by GuiFunctions::OpenContainer::available(), ConstructBuildingCommand::buildingFits(), getPicture(), tcomputebuildingview::init(), BuildingItem::place(), placeBuilding(), putbuilding(), read(), SpawnBuilding::runAction(), runTextIO(), and write().

DestructionObjects BuildingType::destructionObjects

when the building is destroyed, it can leave rubble objects behind. If set to 0 no objects are being created

Definition at line 71 of file buildingtype.h.

Referenced by read(), DestructContainer::runAction(), runTextIO(), and write().

LocalCoordinate BuildingType::entry

the position of the entrance, which is the field of the building where units can enter and leave

Definition at line 74 of file buildingtype.h.

Referenced by Building::chainbuildingtofield(), Building::getEntryField(), getFieldCoordinate(), getLocalCoordinate(), read(), runTextIO(), MapField::setparams(), GetTargetImage::visit(), and write().

int BuildingType::externalloadheight

bitmapped: units on these levels of height may be refuelled when standing next to the buildings entry

Definition at line 93 of file buildingtype.h.

Referenced by ServiceChecker::check(), read(), runTextIO(), and write().

bool BuildingType::field_Exists[xdimension][ydimension]

Definition at line 41 of file buildingtype.h.

Referenced by BuildingType(), fieldExists(), read(), and runTextIO().

int BuildingType::technologylevel

not used at the moment

Definition at line 83 of file buildingtype.h.

Referenced by read(), runTextIO(), and write().

TerrainAccess BuildingType::terrainaccess

the terrain properties which are necessary for the building to be constructed there

Definition at line 86 of file buildingtype.h.

Referenced by ConstructBuildingCommand::buildingFits(), checkunitsforremoval(), BuildingItem::place(), read(), runTextIO(), and write().

Surface BuildingType::w_picture[cwettertypennum][maxbuildingpicnum][4][6]

Definition at line 42 of file buildingtype.h.

Referenced by getMemoryFootprint(), getPicture(), read(), runTextIO(), and write().

BitSet BuildingType::weatherBits

Definition at line 45 of file buildingtype.h.

Referenced by getPicture(), read(), and runTextIO().

const int BuildingType::xdimension = 4
static

Definition at line 39 of file buildingtype.h.

Referenced by DestructContainer::runAction().

const int BuildingType::ydimension = 6
static

Definition at line 40 of file buildingtype.h.

Referenced by DestructContainer::runAction().


The documentation for this class was generated from the following files: