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]
List of all members.

Public Types

typedef multimap< LocalCoordinate,
int > 
DestructionObjects

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.
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
 BuildingType (void)
MapCoordinate getFieldCoordinate (const MapCoordinate &entryOnMap, const LocalCoordinate &localCoordinate) const
 returns the Mapcoordinate of a buildings field
LocalCoordinate getLocalCoordinate (const MapCoordinate &entryOnMap, const MapCoordinate &field) const
 converts a global coordinate into a local coordinate.
void read (tnstream &stream)
 read the binary representation of this item from the given stream
void write (tnstream &stream) const
 write the binary representation of this item to the given stream
void runTextIO (PropertyContainer &pc)
 registers the properties of this item for loading/writing into asctxt files
int getMemoryFootprint () const

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
LocalCoordinate entry
 the position of the entrance, which is the field of the building where units can enter and leave
int _armor
 the armor of the buildingtype.
int technologylevel
 not used at the moment
TerrainAccess terrainaccess
 the terrain properties which are necessary for the building to be constructed there
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
int externalloadheight
 bitmapped: units on these levels of height may be refuelled when standing next to the buildings entry
bool buildingNotRemovable
 if true, this building can not be removed by the player with his construction vehicles

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

Classes

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

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

typedef multimap<LocalCoordinate,int> BuildingType::DestructionObjects

Definition at line 69 of file buildingtype.h.


Constructor & Destructor Documentation

BuildingType::BuildingType ( void   ) 

Definition at line 68 of file buildingtype.cpp.

References bi_picture, buildingNotRemovable, cwettertypennum, field_Exists, maxbuildingpicnum, and ContainerBaseType::productionEfficiency.


Member Function Documentation

void BuildingType::convertOldFunctions ( int  abilities,
const ASCString location 
)

the method for specifying a building's abilility was change at some point in time.

This method converts an old legacy ability specification to the new one

See also:
ContainerBaseType::ContainerFunctions

Definition at line 709 of file buildingtype.cpp.

References ContainerBaseType::AmmoProduction, ContainerBaseType::ExternalAmmoTransfer, ContainerBaseType::ExternalFuelTransfer, ContainerBaseType::ExternalMaterialTransfer, ContainerBaseType::features, ContainerBaseType::InternalUnitRepair, ContainerBaseType::InternalVehicleProduction, LoadableItemType::location, ContainerBaseType::NoObjectChaining, ContainerBaseType::ProduceNonLeavableUnits, ContainerBaseType::RecycleUnits, ContainerBaseType::SatelliteView, ContainerBaseType::SelfDestructOnConquer, ContainerBaseType::SolarPowerPlant, ContainerBaseType::Sonar, ContainerBaseType::TrainingCenter, warningMessage(), and ContainerBaseType::WindPowerPlant.

Referenced by read(), and runTextIO().

int BuildingType::getMoveMalusType (  )  const [inline, virtual]

Implements ContainerBaseType.

Definition at line 91 of file buildingtype.h.

const Surface & BuildingType::getPicture ( const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const

Definition at line 108 of file buildingtype.cpp.

References bi_picture, construction_steps, w_picture, weatherBits, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

Referenced by Building::getPicture(), and paintSingleField().

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

Definition at line 142 of file buildingtype.cpp.

References fielddisthalfx, fielddistx, fielddisty, getPicture(), megaBlitter(), nullParam, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

Referenced by BuildingTypeBaseWidget::display(), GuiFunctions::generate_gui_build_icon(), and paint().

void BuildingType::paintSingleField ( Surface s,
SPoint  pos,
const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const

Definition at line 157 of file buildingtype.cpp.

References fielddisthalfx, fielddistx, fielddisty, getPicture(), megaBlitter(), nullParam, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

int BuildingType::getBIPicture ( const LocalCoordinate localCoordinate,
int  weather = 0,
int  constructionStep = 0 
) const

Definition at line 102 of file buildingtype.cpp.

References bi_picture, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

bool BuildingType::fieldExists ( const LocalCoordinate localCoordinate  )  const [inline]

returns whether this building covers the given field

Definition at line 108 of file buildingtype.h.

References field_Exists, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

Referenced by ConstructBuildingCommand::buildingFits(), Building::chainbuildingtofield(), BuildingTypeBaseWidget::display(), GuiFunctions::generate_gui_build_icon(), BuildingTypeBaseWidget::getBuildingHeight(), Building::getCoveredFields(), Building::getImage(), getLocalCoordinate(), BuildingSeen::getState(), tcomputebuildingview::init(), paint(), BuildingItem::place(), ClipBoardBase::place(), putbuilding(), SpawnBuilding::runAction(), DestructContainer::runAction(), runTextIO(), and Building::unchainbuildingfromfield().

MapCoordinate BuildingType::getFieldCoordinate ( const MapCoordinate entryOnMap,
const LocalCoordinate localCoordinate 
) const

returns the Mapcoordinate of a buildings field

Parameters:
entryOnMap The location of the buildings entry on the map
localCoordinate The 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, MapCoordinate::y, and BuildingType::LocalCoordinate::y.

Referenced by ConstructBuildingCommand::buildingFits(), Reinforcements::execute(), Building::getFieldCoordinates(), BuildingItem::place(), ClipBoardBase::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().

void BuildingType::read ( tnstream stream  )  [virtual]

read the binary representation of this item from the given stream

Reimplemented from ContainerBaseType.

Definition at line 211 of file buildingtype.cpp.

References _armor, ContainerBaseType::asc_mode_tank, ContainerBaseType::bi_mode_tank, bi_picture, building_version, buildingNotRemovable, construction_steps, convertOldFunctions(), cwettertypennum, ContainerBaseType::defaultMaxResearchpoints, ContainerBaseType::defaultProduction, ContainerBaseType::description, destructionObjects, ContainerBaseType::efficiencyfuel, ContainerBaseType::efficiencymaterial, Resources::energy, entry, externalloadheight, field_Exists, Resources::fuel, getFirstBit(), tnstream::getLocation(), ContainerBaseType::height, ContainerBaseType::infotext, ContainerBaseType::jamming, Resources::material, maxbuildingpicnum, ContainerBaseType::maxplus, ContainerBaseType::maxresearchpoints, ContainerBaseType::name, ContainerBaseType::nominalresearchpoints, ContainerBaseType::productionCost, TechAdapterDependency::read(), ContainerBaseType::read(), TerrainAccess::read(), tnstream::readChar(), tnstream::readInt(), tnstream::readString(), ContainerBaseType::techDependency, technologylevel, terrainaccess, ContainerBaseType::view, w_picture, weatherBits, BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

void BuildingType::write ( tnstream stream  )  const [virtual]

write the binary representation of this item to the given stream

Reimplemented from ContainerBaseType.

Definition at line 378 of file buildingtype.cpp.

References _armor, ContainerBaseType::asc_mode_tank, ContainerBaseType::bi_mode_tank, bi_picture, building_version, buildingNotRemovable, construction_steps, cwettertypennum, ContainerBaseType::defaultMaxResearchpoints, ContainerBaseType::defaultProduction, ContainerBaseType::description, destructionObjects, ContainerBaseType::efficiencyfuel, ContainerBaseType::efficiencymaterial, Resources::energy, entry, externalloadheight, Resources::fuel, ContainerBaseType::height, ContainerBaseType::infotext, ContainerBaseType::jamming, Resources::material, maxbuildingpicnum, ContainerBaseType::maxplus, ContainerBaseType::maxresearchpoints, ContainerBaseType::name, ContainerBaseType::nominalresearchpoints, ContainerBaseType::productionCost, ContainerBaseType::techDependency, technologylevel, terrainaccess, ContainerBaseType::view, w_picture, TechAdapterDependency::write(), ContainerBaseType::write(), TerrainAccess::write(), tnstream::writeChar(), tnstream::writeInt(), tnstream::writeString(), BuildingType::LocalCoordinate::x, and BuildingType::LocalCoordinate::y.

void BuildingType::runTextIO ( PropertyContainer pc  )  [virtual]

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

Reimplemented from ContainerBaseType.

Definition at line 514 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, TechAdapterDependency::runTextIO(), Resources::runTextIO(), TerrainAccess::runTextIO(), ContainerBaseType::runTextIO(), strrr(), ContainerBaseType::techDependency, technologylevel, terrainaccess, BuildingType::LocalCoordinate::toString(), w_picture, weatherAbbrev, weatherBits, and weatherTags.

Referenced by execaction_pg().

int BuildingType::getMemoryFootprint (  )  const [virtual]

Implements MemorySizeQueryInterface.

Definition at line 89 of file buildingtype.cpp.

References cwettertypennum, maxbuildingpicnum, and w_picture.


Member Data Documentation

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().

bool BuildingType::field_Exists[xdimension][ydimension]

Definition at line 41 of file buildingtype.h.

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

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

Definition at line 42 of file buildingtype.h.

Referenced by getMemoryFootprint(), getPicture(), 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().

BitSet BuildingType::weatherBits

Definition at line 45 of file buildingtype.h.

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

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().

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::_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::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(), BuildingItem::place(), read(), runTextIO(), and write().

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 getPicture(), tcomputebuildingview::init(), BuildingItem::place(), placeBuilding(), putbuilding(), read(), SpawnBuilding::runAction(), runTextIO(), 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::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(), DestructBuildingCommand::getFields(), read(), runTextIO(), and write().


The documentation for this class was generated from the following files:
Generated on Mon Feb 6 01:47:24 2012 for Advanced Strategic Command by  doxygen 1.5.1