Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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 (tfield *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 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 [] = { "ReplaceTerrain", "AddToTerrain", "UnNamed", NULL }
static const int namingMethodNum = 3
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
 

Enumeration values:
ReplaceTerrain 
AddToTerrain 
UnNamed 

Definition at line 127 of file objecttype.h.

enum ObjectType::NetBehaviour
 

Enumeration values:
NetToBuildings 
NetToBuildingEntry 
NetToSelf 
NetToBorder 
SpecialForest 
AutoBorder 
KeepOrientation 

Definition at line 136 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

bool ObjectType::buildable tfield fld  )  const
 

can the object be build on the field fld

Definition at line 77 of file objecttype.cpp.

References TerrainAccess::accessible(), tfield::bdt, tfield::building, getFieldModification(), tfield::getweather(), growOnUnits, and ObjectType::FieldModification::terrainaccess.

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

Definition at line 166 of file objecttype.cpp.

References getWeather().

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

displays the objecttype at x/y on the screen

Definition at line 284 of file objecttype.cpp.

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

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.

Referenced by tunitattacksobject::setup().

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

Definition at line 72 of file objecttype.cpp.

References fieldModification, and getWeather().

Referenced by buildable(), and GuiFunctions::ObjectBuildingGui::checkObject().

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

Implements MapItemType.

Definition at line 132 of file objecttype.h.

References id.

int ObjectType::getMemoryFootprint  )  const
 

Definition at line 827 of file objecttype.cpp.

References cwettertypennum.

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

Implements MapItemType.

Definition at line 125 of file objecttype.h.

References name.

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

Definition at line 111 of file objecttype.cpp.

References getWeather().

Referenced by Object::getOverviewMapImage().

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(), and s2.

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

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

Definition at line 96 of file objecttype.cpp.

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

void ObjectType::read tnstream stream  )  [virtual]
 

reads the objecttype from a stream

Implements LoadableItemType.

Definition at line 842 of file objecttype.cpp.

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

void ObjectType::runTextIO PropertyContainer pc  )  [virtual]
 

reads or writes the objecttype to the text stream pc

Implements LoadableItemType.

Definition at line 1109 of file objecttype.cpp.

References armor, attackbonus_abs, attackbonus_plus, basicjamming_abs, basicjamming_plus, build_movecost, buildcost, canExistBeneathBuildings, cwettertypennum, defensebonus_abs, defensebonus_plus, displayMethod, extractFileName_withoutSuffix(), fieldModification, LoadableItemType::filename, graphicOperationNum, graphicOperations, groupID, growOnUnits, growthDuration, growthRate, imageHeight, KeepOrientation, lifetime, linkableObjects, linkableTerrain, name, namingMethod, namingMethodNames, namingMethodNum, netBehaviour, netBehaviourNum, NetToSelf, objectDisplayingMethodNum, objectDisplayingMethodTags, objectNetMethod, physicalHeight, remove_movecost, removecost, TechAdapterDependency::runTextIO(), Resources::runTextIO(), ObjectType::FieldModification::runTextIO(), secondaryIDs, snowify(), strrr(), techDependency, ASCString::toString(), viewbonus_abs, viewbonus_plus, visibleago, weatherAbbrev, and weatherTags.

Referenced by execaction_pg().

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

write the objecttype from a stream

Implements LoadableItemType.

Definition at line 989 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, 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, ObjectType::FieldModification::terrainaccess, viewbonus_abs, viewbonus_plus, visibleago, TechAdapterDependency::write(), Resources::write(), TerrainType::MoveMalus::write(), TerrainBits::write(), TerrainAccess::write(), writeClassContainer(), and tnstream::writeInt().


Member Data Documentation

int ObjectType::armor
 

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

Definition at line 57 of file objecttype.h.

Referenced by read(), runTextIO(), tunitattacksobject::setup(), 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 82 of file objecttype.h.

Referenced by 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 80 of file objecttype.h.

Referenced by 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 92 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::execute(), 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 90 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::execute(), read(), runTextIO(), and write().

int ObjectType::build_movecost
 

The movement points that are needed to build this object.

Definition at line 114 of file objecttype.h.

Referenced by GuiFunctions::ObjectBuildingGui::execute(), GuiFunctions::ObjectBuildingGui::getName(), 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 108 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::execute(), GuiFunctions::ObjectBuildingGui::getName(), 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 120 of file objecttype.h.

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

struct ObjectType::WeatherPicture ObjectType::cwettertypennum
 

the images of the objects

Referenced by getMemoryFootprint(), 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 87 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 85 of file objecttype.h.

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

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

Referenced by getFieldModification(), PipeLayer::PipeLayer(), 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 42 of file objecttype.h.

Referenced by ObjectType(), read(), runTextIO(), GuiFunctions::ObjectBuildingGui::search(), 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::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().

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

int ObjectType::id
 

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

Definition at line 35 of file objecttype.h.

Referenced by GuiFunctions::ObjectBuildingGui::execute(), getID(), ItemFiltrationSystem::isFiltered(), and GuiFunctions::ObjectBuildingGui::search().

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 102 of file objecttype.h.

Referenced by compareObjectHeight(), 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 Object::Object(), ObjectType(), read(), tspfldloaders::readfields(), 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 51 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 54 of file objecttype.h.

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

ASCString ObjectType::name
 

The name of the object.

Definition at line 123 of file objecttype.h.

Referenced by getName(), GuiFunctions::ObjectBuildingGui::getName(), objectComp(), ObjectStorage< T >::print(), read(), runTextIO(), and write().

int ObjectType::namingMethod
 

Definition at line 128 of file objecttype.h.

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

const char * ObjectType::namingMethodNames = { "ReplaceTerrain", "AddToTerrain", "UnNamed", NULL } [static]
 

Definition at line 67 of file objecttype.cpp.

Referenced by runTextIO().

const int ObjectType::namingMethodNum = 3 [static]
 

Definition at line 65 of file objecttype.cpp.

Referenced by runTextIO().

int ObjectType::netBehaviour
 

specifies how the object is going to connect to other things

Definition at line 139 of file objecttype.h.

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

const int ObjectType::netBehaviourNum = 7 [static]
 

Definition at line 135 of file objecttype.h.

Referenced by runTextIO().

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 105 of file objecttype.h.

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

int ObjectType::remove_movecost
 

The movement points that are needed to remove this object.

Definition at line 117 of file objecttype.h.

Referenced by GuiFunctions::ObjectBuildingGui::execute(), GuiFunctions::ObjectBuildingGui::getName(), 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 111 of file objecttype.h.

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

vector<int> ObjectType::secondaryIDs
 

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

Definition at line 39 of file objecttype.h.

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

TechAdapterDependency ObjectType::techDependency
 

Definition at line 143 of file objecttype.h.

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

int ObjectType::viewbonus_abs
 

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

Definition at line 97 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::execute(), ObjectType(), read(), runTextIO(), and write().

int ObjectType::viewbonus_plus
 

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

Definition at line 95 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), GuiFunctions::ObjectBuildingGui::execute(), ObjectType(), read(), runTextIO(), and write().

bool ObjectType::visibleago
 

is the object displayed under fog of war

Definition at line 48 of file objecttype.h.

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

BitSet ObjectType::weather
 

bitmapped variable containing the different weather types the objects exist for

Definition at line 45 of file objecttype.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:18:40 2008 for Advanced Strategic Command by  doxygen 1.4.2