ObjectType Class Reference

An object that can be placed on fields. Roads, pipelines and ditches are examples of objects. More...

#include <objecttype.h>

Inheritance diagram for ObjectType:

Inheritance graph
[legend]
List of all members.

Public Types

enum  NamingMethod { ReplaceTerrain, AddToTerrain, UnNamed }
enum  NetBehaviour {
  NetToBuildings = 1, NetToBuildingEntry = 2, NetToSelf = 4, NetToBorder = 8,
  SpecialForest = 0x10, AutoBorder = 0x20, KeepOrientation = 0x40
}

Public Member Functions

const FieldModificationgetFieldModification (int weather) const
ASCString getName () const
int getID () const
 ObjectType (void)
const OverviewMapImagegetOverviewMapImage (int picnum, int weather) const
void display (Surface &surface, const SPoint &pos) const
 displays the objecttype at x/y on the screen
void display (Surface &surface, const SPoint &pos, int dir, int weather=0) const
const SurfacegetPicture (int i=0, int weather=0) const
 returns the pointer to the image i
bool buildable (MapField *fld) const
 can the object be build on the field fld
void read (tnstream &stream)
 reads the objecttype from a stream
void write (tnstream &stream) const
 write the objecttype from a stream
void runTextIO (PropertyContainer &pc)
 reads or writes the objecttype to the text stream pc
int getEffectiveHeight () const
 returns the level of height of this object in the normal 8 level scheme of asc (deep submerged, submerged, ... )
int getMemoryFootprint () const

Public Attributes

int id
 the id of the object, used when referencing objects in files
vector< int > secondaryIDs
 when loading a file and these IDs are encountered, this object will be used.
int groupID
 the group ID allows units to specify whole groups of objects to be buildable / removable without specifying each individual object.
BitSet weather
 bitmapped variable containing the different weather types the objects exist for
bool visibleago
 is the object displayed under fog of war
vector< IntRangelinkableObjects
 some objects are graphically linked with others on neighbouring fields.
vector< IntRangelinkableTerrain
 objects can be graphically linked to terrain, as if the terrain was an object of the same type.
int armor
 if an object should not be attackable, set armor to 0
ObjectType::FieldModification fieldModification [cwettertypennum]
int attackbonus_plus
 this is added to the current attackbonus of the field to form the new attackbonus.
int attackbonus_abs
 The attackbonus_abs replaces the current attackbonus of the field by a new one. A value of -1 won't affect the attackbonus of the field.
int defensebonus_plus
 this is added to the current defensebonus of the field to form the new defensebonus.
int defensebonus_abs
 The defensebonus_abs replaces the current defensebonus of the field by a new one. A value of -1 won't affect the attackbonus of the field.
int basicjamming_plus
 this is added to the current basicjamming of the field to form the new jamming.
int basicjamming_abs
 basicjamming_abs replaces the current basicjamming of the field by a new one. A value < 0 won't affect the jamming of the field
int viewbonus_plus
 units standing on this object will get a bonus to their view
int viewbonus_abs
 units standing on this object will get a bonus to their view
int imageHeight
 the level of height the object is on. This is not the simple system of 8 levels used for units and building, but one with 255 levels to allow a fine grained specification of the order in which different objects are painted
int physicalHeight
 the 'real' height of the object, which evaluated for construction and attack. The destinction between imageHeight and physicalHeight was made because of compatibility reasons
Resources buildcost
 The resources required to construct the object with a unit; Note that units usually don't have any energy available.
Resources removecost
 The resources required to remove the object with a unit; Note that units usually don't have any energy available.
int build_movecost
 The movement points that are needed to build this object.
int remove_movecost
 The movement points that are needed to remove this object.
bool canExistBeneathBuildings
 if a building is constructed on the field containing the object, will the object be removed or will it stay beneath the building.
ASCString name
 The name of the object.
int namingMethod
int netBehaviour
 specifies how the object is going to connect to other things
TechAdapterDependency techDependency
ObjectType::WeatherPicture weatherPicture [cwettertypennum]
 the images of the objects
int displayMethod
 some objects require special displaying methods, for example shading the terrain they are build on
double growthRate
 the probability that an object of this type spawns another object on a neighbouring field
bool growOnUnits
 is the object growth stopped by units and buildings
int lifetime
 the object is removed when it is lifetime turns old. -1 disables removal
int growthDuration
 the time after which any growth stops.

Static Public Attributes

static const char * namingMethodNames []
static const int namingMethodNum
static const int netBehaviourNum = 7

Protected Member Functions

int getWeather (int weather) const

Classes

struct  FieldModification
struct  WeatherPicture
 the images of the objects More...

Detailed Description

An object that can be placed on fields. Roads, pipelines and ditches are examples of objects.

See also:
Object

Definition at line 30 of file objecttype.h.


Member Enumeration Documentation

enum ObjectType::NamingMethod

Enumerator:
ReplaceTerrain 
AddToTerrain 
UnNamed 

Definition at line 126 of file objecttype.h.

enum ObjectType::NetBehaviour

Enumerator:
NetToBuildings 
NetToBuildingEntry 
NetToSelf 
NetToBorder 
SpecialForest 
AutoBorder 
KeepOrientation 

Definition at line 135 of file objecttype.h.


Constructor & Destructor Documentation

ObjectType::ObjectType ( void   ) 

Definition at line 47 of file objecttype.cpp.

References AddToTerrain, canExistBeneathBuildings, displayMethod, groupID, growOnUnits, growthDuration, growthRate, imageHeight, lifetime, namingMethod, netBehaviour, physicalHeight, viewbonus_abs, and viewbonus_plus.


Member Function Documentation

const ObjectType::FieldModification & ObjectType::getFieldModification ( int  weather  )  const

Definition at line 72 of file objecttype.cpp.

References fieldModification, and getWeather().

Referenced by buildable().

ASCString ObjectType::getName (  )  const [inline, virtual]

Implements MapItemType.

Definition at line 124 of file objecttype.h.

References name.

Referenced by SpawnObject::getDescription().

int ObjectType::getID (  )  const [inline, virtual]

Implements MapItemType.

Definition at line 131 of file objecttype.h.

References id.

const OverviewMapImage * ObjectType::getOverviewMapImage ( int  picnum,
int  weather 
) const

Definition at line 111 of file objecttype.cpp.

References getWeather(), ObjectType::WeatherPicture::overviewMapImage, ObjectType::WeatherPicture::resize(), and weatherPicture.

Referenced by Object::getOverviewMapImage().

void ObjectType::display ( Surface surface,
const SPoint pos 
) const

displays the objecttype at x/y on the screen

Definition at line 289 of file objecttype.cpp.

Referenced by Object::display(), ObjectItem::display(), PipeLayer::paintSingleField(), and GetTargetImage::visit().

void ObjectType::display ( Surface surface,
const SPoint pos,
int  dir,
int  weather = 0 
) const

Definition at line 166 of file objecttype.cpp.

References getWeather().

const Surface & ObjectType::getPicture ( int  i = 0,
int  weather = 0 
) const

returns the pointer to the image i

Definition at line 132 of file objecttype.cpp.

References IconRepository::getIcon(), getWeather(), ObjectType::WeatherPicture::images, s2, and weatherPicture.

Referenced by GuiFunctions::ObjectBuildingGui::getImage().

bool ObjectType::buildable ( MapField fld  )  const

can the object be build on the field fld

Definition at line 77 of file objecttype.cpp.

References MapField::bdt, MapField::building, getFieldModification(), MapField::getWeather(), and growOnUnits.

Referenced by MapField::addobject().

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

reads the objecttype from a stream

Implements LoadableItemType.

Definition at line 847 of file objecttype.cpp.

References armor, attackbonus_abs, attackbonus_plus, basicjamming_abs, basicjamming_plus, ObjectType::WeatherPicture::bi3pic, build_movecost, buildcost, canExistBeneathBuildings, cwettertypennum, defensebonus_abs, defensebonus_plus, displayMethod, fatalError(), fieldModification, ObjectType::WeatherPicture::flip, tnstream::getLocation(), groupID, growOnUnits, growthDuration, growthRate, imageHeight, ObjectType::WeatherPicture::images, lifetime, linkableObjects, linkableTerrain, ObjectType::FieldModification::movemalus_abs, ObjectType::FieldModification::movemalus_plus, name, namingMethod, netBehaviour, ObjectType::WeatherPicture::originalFilename, physicalHeight, TechAdapterDependency::read(), Surface::read(), Resources::read(), TerrainType::MoveMalus::read(), TerrainBits::read(), readClassContainer(), tnstream::readFloat(), tnstream::readInt(), tnstream::readString(), remove_movecost, removecost, secondaryIDs, techDependency, ObjectType::FieldModification::terrain_and, ObjectType::FieldModification::terrain_or, viewbonus_abs, viewbonus_plus, visibleago, and weatherPicture.

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

write the objecttype from a stream

Implements LoadableItemType.

Definition at line 996 of file objecttype.cpp.

References armor, attackbonus_abs, attackbonus_plus, basicjamming_abs, basicjamming_plus, build_movecost, buildcost, canExistBeneathBuildings, cwettertypennum, defensebonus_abs, defensebonus_plus, displayMethod, fieldModification, groupID, growOnUnits, growthDuration, growthRate, imageHeight, ObjectType::WeatherPicture::images, lifetime, linkableObjects, linkableTerrain, ObjectType::FieldModification::movemalus_abs, ObjectType::FieldModification::movemalus_plus, name, namingMethod, netBehaviour, physicalHeight, remove_movecost, removecost, secondaryIDs, techDependency, ObjectType::FieldModification::terrain_and, ObjectType::FieldModification::terrain_or, viewbonus_abs, viewbonus_plus, visibleago, weatherPicture, TechAdapterDependency::write(), Resources::write(), TerrainType::MoveMalus::write(), TerrainBits::write(), writeClassContainer(), tnstream::writeFloat(), tnstream::writeInt(), and tnstream::writeString().

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

reads or writes the objecttype to the text stream pc

Implements LoadableItemType.

Definition at line 1117 of file objecttype.cpp.

References PropertyContainer::addBool(), PropertyContainer::addBreakpoint(), PropertyContainer::addDFloat(), PropertyContainer::addImageArray(), PropertyContainer::addInteger(), PropertyContainer::addIntegerArray(), PropertyContainer::addIntRangeArray(), PropertyContainer::addNamedInteger(), PropertyContainer::addString(), PropertyContainer::addTagArray(), PropertyContainer::addTagInteger(), armor, attackbonus_abs, attackbonus_plus, basicjamming_abs, basicjamming_plus, ObjectType::WeatherPicture::bi3pic, build_movecost, buildcost, canExistBeneathBuildings, PropertyContainer::closeBracket(), cwettertypennum, defensebonus_abs, defensebonus_plus, displayMethod, PropertyContainer::error(), extractFileName_withoutSuffix(), fieldModification, LoadableItemType::filename, PropertyContainer::find(), ObjectType::WeatherPicture::flip, graphicOperationNum, graphicOperations, groupID, growOnUnits, growthDuration, growthRate, imageHeight, ObjectType::WeatherPicture::images, PropertyContainer::isReading(), KeepOrientation, lifetime, linkableObjects, linkableTerrain, name, namingMethod, namingMethodNames, namingMethodNum, netBehaviour, netBehaviourNum, NetToSelf, objectDisplayingMethodNum, objectDisplayingMethodTags, objectNetMethod, PropertyContainer::openBracket(), physicalHeight, remove_movecost, removecost, TechAdapterDependency::runTextIO(), Resources::runTextIO(), ObjectType::FieldModification::runTextIO(), secondaryIDs, snowify(), strrr(), techDependency, ASCString::toString(), viewbonus_abs, viewbonus_plus, visibleago, weatherAbbrev, weatherPicture, and weatherTags.

int ObjectType::getEffectiveHeight (  )  const

returns the level of height of this object in the normal 8 level scheme of asc (deep submerged, submerged, ... )

Definition at line 90 of file objecttype.cpp.

References physicalHeight.

int ObjectType::getMemoryFootprint (  )  const

Definition at line 832 of file objecttype.cpp.

References cwettertypennum, ObjectType::WeatherPicture::images, ObjectType::WeatherPicture::overviewMapImage, and weatherPicture.

int ObjectType::getWeather ( int  weather  )  const [protected]

Definition at line 96 of file objecttype.cpp.

Referenced by display(), getFieldModification(), getOverviewMapImage(), and getPicture().


Member Data Documentation

int ObjectType::id

the id of the object, used when referencing objects in files

Definition at line 35 of file objecttype.h.

Referenced by ChangeObjectProperty::ChangeObjectProperty(), getID(), ItemFiltrationSystem::isFiltered(), ActionObjectRemovalStrategy::removeObject(), tunitattacksobject::setresult(), and testObjectRemoval().

vector<int> ObjectType::secondaryIDs

when loading a file and these IDs are encountered, this object will be used.

Definition at line 38 of file objecttype.h.

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

int ObjectType::groupID

the group ID allows units to specify whole groups of objects to be buildable / removable without specifying each individual object.

Definition at line 41 of file objecttype.h.

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

BitSet ObjectType::weather

bitmapped variable containing the different weather types the objects exist for

Definition at line 44 of file objecttype.h.

Referenced by ForestCalculation::Smoothing::GetNeighbourMask().

bool ObjectType::visibleago

is the object displayed under fog of war

Definition at line 47 of file objecttype.h.

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

vector<IntRange> ObjectType::linkableObjects

some objects are graphically linked with others on neighbouring fields.

See also:
no_autonet linkableTerrain

Definition at line 50 of file objecttype.h.

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

vector<IntRange> ObjectType::linkableTerrain

objects can be graphically linked to terrain, as if the terrain was an object of the same type.

See also:
no_autonet linkableObjects

Definition at line 53 of file objecttype.h.

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

int ObjectType::armor

if an object should not be attackable, set armor to 0

Definition at line 56 of file objecttype.h.

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

struct ObjectType::FieldModification ObjectType::fieldModification[cwettertypennum]

Referenced by getFieldModification(), PipeLayer::PipeLayer(), read(), runTextIO(), and write().

int ObjectType::attackbonus_plus

this is added to the current attackbonus of the field to form the new attackbonus.

Definition at line 79 of file objecttype.h.

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

int ObjectType::attackbonus_abs

The attackbonus_abs replaces the current attackbonus of the field by a new one. A value of -1 won't affect the attackbonus of the field.

Definition at line 81 of file objecttype.h.

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

int ObjectType::defensebonus_plus

this is added to the current defensebonus of the field to form the new defensebonus.

Definition at line 84 of file objecttype.h.

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

int ObjectType::defensebonus_abs

The defensebonus_abs replaces the current defensebonus of the field by a new one. A value of -1 won't affect the attackbonus of the field.

Definition at line 86 of file objecttype.h.

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

int ObjectType::basicjamming_plus

this is added to the current basicjamming of the field to form the new jamming.

Definition at line 89 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), read(), runTextIO(), and write().

int ObjectType::basicjamming_abs

basicjamming_abs replaces the current basicjamming of the field by a new one. A value < 0 won't affect the jamming of the field

Definition at line 91 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), read(), runTextIO(), and write().

int ObjectType::viewbonus_plus

units standing on this object will get a bonus to their view

Definition at line 94 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), ObjectType(), read(), runTextIO(), and write().

int ObjectType::viewbonus_abs

units standing on this object will get a bonus to their view

Definition at line 96 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), ObjectType(), read(), runTextIO(), and write().

int ObjectType::imageHeight

the level of height the object is on. This is not the simple system of 8 levels used for units and building, but one with 255 levels to allow a fine grained specification of the order in which different objects are painted

Definition at line 101 of file objecttype.h.

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

int ObjectType::physicalHeight

the 'real' height of the object, which evaluated for construction and attack. The destinction between imageHeight and physicalHeight was made because of compatibility reasons

Definition at line 104 of file objecttype.h.

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

Resources ObjectType::buildcost

The resources required to construct the object with a unit; Note that units usually don't have any energy available.

Definition at line 107 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::getName(), PutObjectCommand::go(), read(), runTextIO(), and write().

Resources ObjectType::removecost

The resources required to remove the object with a unit; Note that units usually don't have any energy available.

Definition at line 110 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::getName(), PutObjectCommand::go(), read(), runTextIO(), and write().

int ObjectType::build_movecost

The movement points that are needed to build this object.

Definition at line 113 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::getName(), PutObjectCommand::go(), read(), runTextIO(), and write().

int ObjectType::remove_movecost

The movement points that are needed to remove this object.

Definition at line 116 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::getName(), PutObjectCommand::go(), read(), runTextIO(), and write().

bool ObjectType::canExistBeneathBuildings

if a building is constructed on the field containing the object, will the object be removed or will it stay beneath the building.

Definition at line 119 of file objecttype.h.

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

ASCString ObjectType::name

The name of the object.

Definition at line 122 of file objecttype.h.

Referenced by PutObjectCommand::getDescription(), getName(), GuiFunctions::ObjectBuildingGui::getName(), objectComp(), read(), runTextIO(), and write().

int ObjectType::namingMethod

Definition at line 127 of file objecttype.h.

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

const char * ObjectType::namingMethodNames [static]

Definition at line 128 of file objecttype.h.

Referenced by runTextIO().

const int ObjectType::namingMethodNum [static]

Definition at line 129 of file objecttype.h.

Referenced by runTextIO().

const int ObjectType::netBehaviourNum = 7 [static]

Definition at line 134 of file objecttype.h.

Referenced by runTextIO().

int ObjectType::netBehaviour

specifies how the object is going to connect to other things

Definition at line 138 of file objecttype.h.

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

TechAdapterDependency ObjectType::techDependency

Definition at line 142 of file objecttype.h.

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

struct ObjectType::WeatherPicture ObjectType::weatherPicture[cwettertypennum]

the images of the objects

Referenced by getMemoryFootprint(), ForestCalculation::Smoothing::GetNeighbourMask(), getOverviewMapImage(), getPicture(), read(), runTextIO(), and write().

int ObjectType::displayMethod

some objects require special displaying methods, for example shading the terrain they are build on

Definition at line 175 of file objecttype.h.

Referenced by ObjectType(), PipeLayer::PipeLayer(), read(), runTextIO(), and write().

double ObjectType::growthRate

the probability that an object of this type spawns another object on a neighbouring field

Definition at line 181 of file objecttype.h.

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

bool ObjectType::growOnUnits

is the object growth stopped by units and buildings

Definition at line 184 of file objecttype.h.

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

int ObjectType::lifetime

the object is removed when it is lifetime turns old. -1 disables removal

Definition at line 187 of file objecttype.h.

Referenced by MapField::addobject(), Object::Object(), ObjectType(), read(), tspfldloaders::readfields(), runTextIO(), and write().

int ObjectType::growthDuration

the time after which any growth stops.

This parameter is passed to all child-objects spawned through growth and should therefor be bigger than lifetime. Use -1 for unlimited

Definition at line 191 of file objecttype.h.

Referenced by Object::Object(), ObjectType(), read(), runTextIO(), and write().


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