Advanced Strategic Command
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
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]

Classes

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

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 More...
 
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 More...
 
bool buildable (MapField *fld) const
 can the object be build on the field fld More...
 
void read (tnstream &stream)
 reads the objecttype from a stream More...
 
void write (tnstream &stream) const
 write the objecttype from a stream More...
 
void runTextIO (PropertyContainer &pc)
 reads or writes the objecttype to the text stream pc More...
 
int getEffectiveHeight () const
 returns the level of height of this object in the normal 8 level scheme of asc (deep submerged, submerged, ... ) More...
 
int getMemoryFootprint () const
 
- Public Member Functions inherited from MapItemType
virtual ~MapItemType ()
 
- Public Member Functions inherited from LoadableItemType
virtual ~LoadableItemType ()
 

Public Attributes

int id
 the id of the object, used when referencing objects in files More...
 
vector< int > secondaryIDs
 when loading a file and these IDs are encountered, this object will be used. More...
 
int groupID
 the group ID allows units to specify whole groups of objects to be buildable / removable without specifying each individual object. More...
 
BitSet weather
 bitmapped variable containing the different weather types the objects exist for More...
 
bool visibleago
 is the object displayed under fog of war More...
 
vector< IntRangelinkableObjects
 some objects are graphically linked with others on neighbouring fields. More...
 
vector< IntRangelinkableTerrain
 objects can be graphically linked to terrain, as if the terrain was an object of the same type. More...
 
int armor
 if an object should not be attackable, set armor to 0 More...
 
struct
ObjectType::FieldModification 
fieldModification [cwettertypennum]
 
int attackbonus_plus
 this is added to the current attackbonus of the field to form the new attackbonus. More...
 
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. More...
 
int defensebonus_plus
 this is added to the current defensebonus of the field to form the new defensebonus. More...
 
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. More...
 
int basicjamming_plus
 this is added to the current basicjamming of the field to form the new jamming. More...
 
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 More...
 
int viewbonus_plus
 units standing on this object will get a bonus to their view More...
 
int viewbonus_abs
 units standing on this object will get a bonus to their view More...
 
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 More...
 
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 More...
 
Resources buildcost
 The resources required to construct the object with a unit; Note that units usually don't have any energy available. More...
 
Resources removecost
 The resources required to remove the object with a unit; Note that units usually don't have any energy available. More...
 
int build_movecost
 The movement points that are needed to build this object. More...
 
int remove_movecost
 The movement points that are needed to remove this object. More...
 
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. More...
 
ASCString name
 The name of the object. More...
 
int namingMethod
 
int netBehaviour
 specifies how the object is going to connect to other things More...
 
TechAdapterDependency techDependency
 
struct ObjectType::WeatherPicture weatherPicture [cwettertypennum]
 
int displayMethod
 some objects require special displaying methods, for example shading the terrain they are build on More...
 
double growthRate
 the probability that an object of this type spawns another object on a neighbouring field More...
 
bool growOnUnits
 is the object growth stopped by units and buildings More...
 
int lifetime
 the object is removed when it is lifetime turns old. -1 disables removal More...
 
int growthDuration
 the time after which any growth stops. More...
 
- 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 char * namingMethodNames [] = { "ReplaceTerrain", "AddToTerrain", "UnNamed", NULL }
 
static const int namingMethodNum = 3
 
static const int netBehaviourNum = 7
 

Protected Member Functions

int getWeather (int weather) const
 

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

Enumerator
ReplaceTerrain 
AddToTerrain 
UnNamed 

Definition at line 126 of file objecttype.h.

Enumerator
NetToBuildings 
NetToBuildingEntry 
NetToSelf 
NetToBorder 
SpecialForest 
AutoBorder 
KeepOrientation 

Definition at line 135 of file objecttype.h.

Constructor & Destructor Documentation

ObjectType::ObjectType ( void  )

Member Function Documentation

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

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

int ObjectType::getID ( ) const
inlinevirtual

Implements MapItemType.

Definition at line 131 of file objecttype.h.

References id.

int ObjectType::getMemoryFootprint ( ) const
ASCString ObjectType::getName ( ) const
inlinevirtual

Implements MapItemType.

Definition at line 124 of file objecttype.h.

References name.

const OverviewMapImage * ObjectType::getOverviewMapImage ( int  picnum,
int  weather 
) const
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, and weatherPicture.

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

int ObjectType::getWeather ( int  weather) const
protected

Definition at line 96 of file objecttype.cpp.

References weather.

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

void ObjectType::read ( tnstream stream)
virtual
void ObjectType::runTextIO ( PropertyContainer pc)
virtual

reads or writes the objecttype to the text stream pc

Implements LoadableItemType.

Definition at line 1113 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, ObjectType::FieldModification::runTextIO(), TechAdapterDependency::runTextIO(), Resources::runTextIO(), secondaryIDs, snowify(), strrr(), techDependency, ASCString::toString(), viewbonus_abs, viewbonus_plus, visibleago, weatherAbbrev, weatherPicture, and weatherTags.

Referenced by execaction_pg().

void ObjectType::write ( tnstream stream) const
virtual

Member Data Documentation

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(), 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 81 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 79 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 91 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), 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::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().

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

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

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

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 getID(), ItemFiltrationSystem::isFiltered(), ActionObjectRemovalStrategy::removeObject(), tunitattacksobject::setresult(), and testObjectRemoval().

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

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 calculateobject(), 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 calculateobject(), read(), runTextIO(), and write().

ASCString ObjectType::name
int ObjectType::namingMethod

Definition at line 127 of file objecttype.h.

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

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

Definition at line 128 of file objecttype.h.

Referenced by runTextIO().

const int ObjectType::namingMethodNum = 3
static

Definition at line 129 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().

const int ObjectType::netBehaviourNum = 7
static

Definition at line 134 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 104 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 116 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().

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

TechAdapterDependency ObjectType::techDependency

Definition at line 142 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 96 of file objecttype.h.

Referenced by trunreplay::execnextreplaymove(), PutObjectCommand::go(), ObjectType(), 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().

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

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(), getOverviewMapImage(), getWeather(), and ForestCalculation::Smoothing::SmoothIt().

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

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