Advanced Strategic Command
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
ContainerBase Class Referenceabstract

The parent class of Vehicle and Building; The name Container originates from Battle Isle, where everything that could load units was a container. More...

#include <containerbase.h>

Inheritance diagram for ContainerBase:
Inheritance graph
[legend]

Classes

class  Work
 
class  WorkClassFactory
 

Public Types

typedef vector< const
VehicleType * > 
Production
 

Public Member Functions

virtual bool isBuilding () const =0
 
virtual Surface getImage () const =0
 returns an image for the Container. More...
 
const ProductiongetProduction () const
 
Resources getProductionCost (const VehicleType *unit) const
 
void deleteProductionLine (const VehicleType *type)
 
void deleteAllProductionLines ()
 
void addProductionLine (const VehicleType *type)
 
bool hasProductionLine (const VehicleType *type)
 
void setProductionLines (const Production &production)
 
virtual int getArmor () const =0
 
int getOwner () const
 returns the number of the player this vehicle/building belongs to More...
 
PlayergetOwningPlayer () const
 returns the player this vehicle/building belongs to More...
 
virtual void registerForNewOwner (int player)=0
 this is a low level functions that changes the registration in the map. It's called by convert(int,bool) More...
 
virtual void write (tnstream &stream, bool includeLoadedUnits=true) const =0
 
virtual void read (tnstream &stream)=0
 
virtual void addview (void)=0
 registers the containers view (=radar) on the map More...
 
virtual void removeview (void)=0
 removes the containers view (=radar) on the map More...
 
GameMapgetMap () const
 
virtual int getIdentification () const =0
 
virtual int getHeight () const =0
 returns the bitmapped level of height. Only one bit will be set, of course More...
 
virtual ASCString getName () const =0
 
ASCString getPrivateName () const
 
virtual void setName (const ASCString &name)
 
virtual int getAmmo (int type, int num, bool queryOnly)=0
 
virtual int getAmmo (int type, int num) const =0
 
virtual int putAmmo (int type, int num, bool queryOnly)=0
 
virtual int maxAmmo (int type) const =0
 
virtual void endOwnTurn (void)
 hook that is called when a player ends his turn More...
 
virtual void endAnyTurn (void)
 hook that is called when any player (including owner) ends turn More...
 
virtual void endRound (void)
 hook that is called the next round begins ( active player switching from player8 to player1 ) More...
 
WorkspawnWorkClasses (bool justQuery)
 
virtual MapCoordinate3D getPosition () const =0
 
virtual ~ContainerBase ()
 
virtual vector< MapCoordinategetCoveredFields ()=0
 
Repairing related functions
virtual const ResourceMatrixgetRepairEfficiency () const =0
 when a ContainerBase is repair by this ContainerBase, the default cost can be customized with this matrix. More...
 
virtual void postRepair (int oldDamage, bool autoRepair)=0
 is called after a repair is performed. Vehicles use this to reduce their experience. More...
 
virtual bool canRepair (const ContainerBase *item) const =0
 checks whether the item can be repaired provided that it is in range More...
 
int getMaxRepair (const ContainerBase *item) const
 returns the maximum amount of damage that the given item can be repaired More...
 
int getMaxRepair (const ContainerBase *item, int newDamage, Resources &cost, bool ignoreCost=false) const
 
int repairItem (ContainerBase *item, int newDamage=0, bool autoRepair=false)
 
virtual int repairableDamage () const =0
 returns the amount of damage that can still be repaired this turn More...
 

Static Public Member Functions

static int calcShadowDist (int binaryHeight)
 
static bool registerWorkClassFactory (WorkClassFactory *wcf, bool ASCmode=true)
 

Public Attributes

const ContainerBaseTypebaseType
 the type descriping all non-instance specific properties of the container More...
 
int damage
 Damage. 0 is no damage, when damage reaches 100 the container is destroyed. More...
 
int color
 The owner of the container. More...
 
sigc::signal< void > conquered
 
sigc::signal< void > destroyed
 
int researchpoints
 the current amount of research that the building conducts every turn More...
 
int maxresearchpoints
 
int view
 

Static Public Attributes

static sigc::signal< void,
ContainerBase * > 
anyContainerDestroyed
 
static sigc::signal< void,
ContainerBase * > 
anyContainerConquered
 

Protected Member Functions

void paintField (const Surface &src, Surface &dest, SPoint pos, int dir, bool shaded, int shadowDist=-1) const
 displays an image of this container on the surface. More...
 
 ContainerBase (const ContainerBaseType *bt, GameMap *map, int player)
 

Protected Attributes

int repairedThisTurn
 the percantage that this container has already been repaired this turn. More...
 
GameMapgamemap
 the map that this container is placed on More...
 
ContainerBasecargoParent
 if this container is transported inside a carrier, this is carrier More...
 
Production internalUnitProduction
 

Friends

class ConvertContainer
 
class ChangeContainerProperty
 

Cargo related functions

typedef vector< Vehicle * > Cargo
 
Cargo cargo
 
sigc::signal< void > cargoChanged
 
ASCString name
 a name given by the user or the map creator More...
 
ASCString privateName
 a name given by the user which is only visible to him and his allies. More...
 
const CargogetCargo () const
 
int getCargoCount () const
 
VehiclegetCargo (int i)
 returns the cargo slot with index i Warning: the cargo may contain NULL items. More...
 
void clearCargo ()
 removes ALL units from cargo More...
 
void addToCargo (Vehicle *veh, int position=-1)
 adds the unit to the cargo More...
 
void moveToCargo (Vehicle *veh)
 adds the unit to the cargo, and removes its from its current position More...
 
bool removeUnitFromCargo (Vehicle *veh, bool recursive=false)
 removes the given unit from the container. More...
 
bool removeUnitFromCargo (int nwid, bool recursive=false)
 
int vehiclesLoaded (void) const
 returns the number of loaded units More...
 
ContainerBasegetCarrier () const
 if this is a unit and it is inside a building or transport, returns the transport. NULL otherwise. More...
 
VehiclefindUnit (int nwid, bool recursive=true) const
 searches for a the unit in carrier and optionally all inner carriers More...
 
bool vehicleLoadable (const Vehicle *vehicle, int uheight=-1, const bool *attacked=NULL) const
 can the vehicle be loaded. More...
 
int vehicleUnloadable (const VehicleType *vehicleType, int carrierHeight=-1) const
 checks the unloading of a unit type More...
 
const
ContainerBaseType::TransportationIO
vehicleUnloadSystem (const VehicleType *vehicle, int height)
 returns the unloading system More...
 
int vehicleDocking (const Vehicle *vehicle, bool out) const
 returns the levels of height on which this unit can be transfered by docking; or 0 if no unloading is possible More...
 
bool doesVehicleFit (const Vehicle *vehicle) const
 Does the vehicle fit into the container? This does not include checking if it can reach the entry. More...
 
int cargoWeight () const
 weight of all loaded units More...
 
int cargoNestingDepth ()
 returns the nesting depth of the cargo. The unit standing on the field is 0, its cargo is 1, the cargo's cargo 2 ... More...
 

Resource related functions

Resources plus
 the Resources that are produced each turn More...
 
Resources maxplus
 the maximum amount of Resources that the building can produce each turn in the ASC resource mode ; see also bi_resourceplus More...
 
Resources bi_resourceplus
 the maximum amount of Resources that the building can produce each turn in the BI resource mode ; see also maxplus More...
 
virtual int putResource (int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)=0
 scope: 0 = local 1 = resource network 2 = global in all buildings 3 = map wide pool( used only internally! ) More...
 
virtual int getResource (int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)=0
 
virtual int getAvailableResource (int amount, int resourcetype, int scope=1) const =0
 
Resources putResource (const Resources &res, bool queryonly, int scope=1, int player=-1)
 
Resources getResource (const Resources &res, bool queryonly, int scope=1, int player=-1)
 
Resources getResource (const Resources &res) const
 
Resources getResourceUsage ()
 returns the resource that the building consumes for its operation. More...
 
Resources getResourcePlus ()
 
Resources getStorageCapacity () const
 returns the local storage capacity for the given resource, which depends on the resource mode of the map. More...
 
Resources netResourcePlus () const
 returns the amount of resources that the net which the building is connected to produces each turn More...
 
void setInternalResourcePlus (const Resources &res)
 The ResourcePlus is used for different purposes by different building or vehicle functions, or not at all. More...
 
void setInternalResourceMaxPlus (const Resources &res)
 The ResourceMaxPlus is used for different purposes by different building or vehicle functions, or not at all. More...
 
Resources getInternalResourcePlus () const
 The ResourcePlus is used for different purposes by different building or vehicle functions, or not at all. More...
 
Resources getInternalResourceMaxPlus () const
 The ResourceMaxPlus is used for different purposes by different building or vehicle functions, or not at all. More...
 

Detailed Description

The parent class of Vehicle and Building; The name Container originates from Battle Isle, where everything that could load units was a container.

Definition at line 40 of file containerbase.h.

Member Typedef Documentation

typedef vector<Vehicle*> ContainerBase::Cargo

Definition at line 106 of file containerbase.h.

typedef vector<const VehicleType*> ContainerBase::Production

Definition at line 87 of file containerbase.h.

Constructor & Destructor Documentation

ContainerBase::ContainerBase ( const ContainerBaseType bt,
GameMap map,
int  player 
)
protected
ContainerBase::~ContainerBase ( )
virtual

Member Function Documentation

void ContainerBase::addProductionLine ( const VehicleType type)
void ContainerBase::addToCargo ( Vehicle veh,
int  position = -1 
)

adds the unit to the cargo

Parameters
vehthe unit to add
positionspecifies a specific cargo slot. -1 assigns slot automatically. The automatic mode should be used in almost all cases

Definition at line 363 of file containerbase.cpp.

References cargo, cargoChanged, cargoParent, fatalError(), getPosition(), and Vehicle::setnewposition().

Referenced by copyBuildingData(), copyVehicleData(), trunreplay::execnextreplaymove(), CargoItemFactory::itemSelected(), moveToCargo(), UnitFieldRegistration::runAction(), UnitFieldRegistration::undoAction(), and DestructContainer::undoAction().

virtual void ContainerBase::addview ( void  )
pure virtual

registers the containers view (=radar) on the map

Implemented in Vehicle, and Building.

Referenced by ViewRegistration::runAction(), and ViewRegistration::undoAction().

int ContainerBase::calcShadowDist ( int  binaryHeight)
static
virtual bool ContainerBase::canRepair ( const ContainerBase item) const
pure virtual

checks whether the item can be repaired provided that it is in range

Implemented in Vehicle, and Building.

Referenced by getMaxRepair(), and repairItem().

int ContainerBase::cargoNestingDepth ( )

returns the nesting depth of the cargo. The unit standing on the field is 0, its cargo is 1, the cargo's cargo 2 ...

Definition at line 188 of file containerbase.cpp.

References cargoNestingDepth(), and getCarrier().

Referenced by cargoNestingDepth(), and Vehicle::setMovement().

int ContainerBase::cargoWeight ( ) const
void ContainerBase::clearCargo ( )

removes ALL units from cargo

Definition at line 351 of file containerbase.cpp.

References cargo, and cargoChanged.

Referenced by TemporaryContainerStorage::restore().

void ContainerBase::deleteAllProductionLines ( )

Definition at line 575 of file containerbase.cpp.

References internalUnitProduction.

Referenced by copyBuildingData(), and copyVehicleData().

void ContainerBase::deleteProductionLine ( const VehicleType type)
bool ContainerBase::doesVehicleFit ( const Vehicle vehicle) const
void ContainerBase::endAnyTurn ( void  )
virtual

hook that is called when any player (including owner) ends turn

Reimplemented in Vehicle.

Definition at line 655 of file containerbase.cpp.

Referenced by Vehicle::endAnyTurn().

void ContainerBase::endOwnTurn ( void  )
virtual

hook that is called when a player ends his turn

Reimplemented in Vehicle.

Definition at line 651 of file containerbase.cpp.

Referenced by Vehicle::endOwnTurn().

void ContainerBase::endRound ( void  )
virtual

hook that is called the next round begins ( active player switching from player8 to player1 )

Reimplemented in Vehicle, and Building.

Definition at line 659 of file containerbase.cpp.

References baseType, ContainerBaseType::view, and view.

Referenced by Building::endRound(), and Vehicle::endRound().

Vehicle * ContainerBase::findUnit ( int  nwid,
bool  recursive = true 
) const

searches for a the unit in carrier and optionally all inner carriers

Definition at line 224 of file containerbase.cpp.

References cargo, and findUnit().

Referenced by RecycleUnitCommand::avail(), TrainUnitCommand::avail(), doesVehicleFit(), findUnit(), and GameMap::getUnit().

virtual int ContainerBase::getAmmo ( int  type,
int  num,
bool  queryOnly 
)
pure virtual
virtual int ContainerBase::getAmmo ( int  type,
int  num 
) const
pure virtual

Implemented in Vehicle, and Building.

virtual int ContainerBase::getArmor ( ) const
pure virtual

Implemented in Vehicle, and Building.

Referenced by CargoDialog::updateVariables().

virtual int ContainerBase::getAvailableResource ( int  amount,
int  resourcetype,
int  scope = 1 
) const
pure virtual
const Cargo& ContainerBase::getCargo ( ) const
inline
Vehicle * ContainerBase::getCargo ( int  i)

returns the cargo slot with index i Warning: the cargo may contain NULL items.

This was done deliberately, to allow easier navigation when the user moves items successivly out of a carrier

Definition at line 208 of file containerbase.cpp.

References cargo.

int ContainerBase::getCargoCount ( ) const
inline

Definition at line 117 of file containerbase.h.

References cargo.

ContainerBase * ContainerBase::getCarrier ( ) const
virtual vector<MapCoordinate> ContainerBase::getCoveredFields ( )
pure virtual

Implemented in Vehicle, and Building.

Referenced by SolarPowerplant::getPlus().

virtual int ContainerBase::getHeight ( ) const
pure virtual

returns the bitmapped level of height. Only one bit will be set, of course

Implemented in Vehicle, and Building.

Referenced by ServiceChecker::check(), getheightdelta(), and paintField().

virtual int ContainerBase::getIdentification ( ) const
pure virtual
virtual Surface ContainerBase::getImage ( ) const
pure virtual

returns an image for the Container.

Note
Buildings have a size of several fields. The image returned here is therefore not suited to be painted on the map, as map-painting is done on a per-field basis

Implemented in Vehicle, and Building.

Referenced by AmmoTransferWindow::AmmoTransferWindow().

Resources ContainerBase::getInternalResourceMaxPlus ( ) const

The ResourceMaxPlus is used for different purposes by different building or vehicle functions, or not at all.

Definition at line 700 of file containerbase.cpp.

References maxplus.

Resources ContainerBase::getInternalResourcePlus ( ) const

The ResourcePlus is used for different purposes by different building or vehicle functions, or not at all.

Definition at line 695 of file containerbase.cpp.

References plus.

GameMap* ContainerBase::getMap ( void  ) const
inline

Definition at line 302 of file containerbase.h.

References gamemap.

Referenced by attack(), tsearchreactionfireingunits::attack(), attackpossible(), attackpossible2n(), attackpossible2u(), Mine::attacksunit(), autoTrainer(), ConstructBuildingCommand::avail(), DestructUnitCommand::avail(), PowerGenerationSwitchCommand::avail(), PutObjectCommand::avail(), PutMineCommand::avail(), ReactionFireSwitchCommand::avail(), TransferControlCommand::avail(), TrainUnitCommand::avail(), DestructBuildingCommand::avail(), CargoGuiFunctions::Movement::available(), CargoGuiFunctions::UnitProduction::available(), CargoGuiFunctions::UnitTraining::available(), CargoGuiFunctions::OpenContainer::available(), CargoGuiFunctions::RecycleUnitCommandButton::available(), CargoGuiFunctions::TransferUnitControl::available(), GuiFunctions::OpenContainer::available(), GuiFunctions::InternalAmmoTransferDialog::available(), VehicleCounterFactory::calcCargoSummary(), UnitHooveringLogic::calcFuelUsage(), calcMoveMalus(), Vehicle::canMove(), ServiceChecker::check(), checkModificationConstraints(), compareMapResources(), DashboardPanel::containerRenamed(), countPlayers(), MapDisplayPG::displayMovementStep(), doesVehicleFit(), Building::execnetcontrol(), trunreplay::execnextreplaymove(), CargoGuiFunctions::Movement::execute(), CargoGuiFunctions::UnitProduction::execute(), CargoGuiFunctions::UnitTraining::execute(), CargoGuiFunctions::RefuelUnitCommand::execute(), CargoGuiFunctions::RepairUnit::execute(), CargoGuiFunctions::MoveUnitUp::execute(), CargoGuiFunctions::MoveUnitIntoInnerContainer::execute(), CargoGuiFunctions::RecycleUnitCommandButton::execute(), CargoGuiFunctions::TransferUnitControl::execute(), GuiFunctions::RefuelUnitCommand::execute(), GuiFunctions::BuildVehicleCommand::execute(), ConstructUnitCommand::externalConstructionAvail(), ServiceTargetSearcher::externallyAvailable(), fieldAccessible(), AStar3D::findPath(), Building::getAvailableResource(), VehicleProduction_SelectionItemFactory::getCost(), ConstructUnitCommand::getFields(), CargoDialog::getMap(), getmaxwindspeedforunit(), getOwningPlayer(), WindPowerplant::getPlus(), SolarPowerplant::getPlus(), ConstructUnitCommand::getProduceableVehicles(), Building::getResource(), Vehicle::getResource(), CargoDialog::getResourceValue(), getTransferLimitation(), giveunitaway(), TrainUnitCommand::go(), tcomputevehicleview::init(), tcomputebuildingview::init(), ConstructUnitCommand::internalConstructionAvail(), log(), move(), MoveUnitCommand::MoveUnitCommand(), moveUnitTest(), netResourcePlus(), DashboardPanel::painter(), InternalAmmoTransferHandler::performTransfer(), BuildProductionLineCommand::productionLinesBuyable(), Building::putResource(), Vehicle::putResource(), ResearchGraph::recalc(), VehicleProduction_SelectionWindow::removeProductionLine(), Building::repairableDamage(), DashboardPanel::reset(), ServiceTargetSearcher::ServiceTargetSearcher(), ResearchGraph::setResearch(), tunitattacksunit::setresult(), tmineattacksunit::setresult(), tunitattacksobject::setresult(), tunitattacksunit::setup(), tunitattacksbuilding::setup(), tmineattacksunit::setup(), tunitattacksobject::setup(), DashboardPanel::showUnitData(), Vehicle::spawnMoveObjects(), spawnWorkClasses(), ServiceTargetSearcher::startSearch(), StatisticsCalculator::strength(), testHeightChangeAI(), testHeightChangeGUI(), testMapResizeWithMovement(), testMovementFieldsReachable(), TransferHandler::TransferHandler(), DestructContainer::undoAction(), UnitInfoPanel::unitNaming(), ContainerConstControls::unitProductionAvailable(), Vehicle::unregisterPosition(), ResourceInfoWindow::update(), ResearchWindow::update(), CargoDialog::updateVariables(), vehicleLoadable(), VehiclePropertyEditor::VehiclePropertyEditor(), AddProductionLine_SelectionItemFactory::vehicleTypeSelected(), and WindMovement::WindMovement().

int ContainerBase::getMaxRepair ( const ContainerBase item) const

returns the maximum amount of damage that the given item can be repaired

Returns
a value in the range 0 .. item->damage

Definition at line 118 of file containerbase.cpp.

Referenced by RepairBuildingCommand::getCost(), CargoGuiFunctions::RepairUnit::getName(), GuiFunctions::RepairUnit::getName(), RepairUnitCommand::go(), and repairItem().

int ContainerBase::getMaxRepair ( const ContainerBase item,
int  newDamage,
Resources cost,
bool  ignoreCost = false 
) const
virtual ASCString ContainerBase::getName ( ) const
pure virtual
int ContainerBase::getOwner ( ) const
inline

returns the number of the player this vehicle/building belongs to

Definition at line 206 of file containerbase.h.

References color.

Referenced by tsearchreactionfireingunits::addunit(), attackpossible(), attackpossible2n(), attackpossible2u(), Mine::attacksunit(), autoTrainer(), ConstructBuildingCommand::avail(), PowerGenerationSwitchCommand::avail(), PutMineCommand::avail(), PutObjectCommand::avail(), DestructBuildingCommand::avail(), TransferControlCommand::avail(), GuiFunctions::MovementBase::available(), CargoGuiFunctions::Movement::available(), CargoGuiFunctions::UnitProduction::available(), CargoGuiFunctions::UnitTraining::available(), CargoGuiFunctions::OpenContainer::available(), CargoGuiFunctions::RecycleUnitCommandButton::available(), CargoGuiFunctions::TransferUnitControl::available(), GuiFunctions::Ascend::available(), GuiFunctions::Descend::available(), GuiFunctions::OpenContainer::available(), GuiFunctions::EnableReactionfire::available(), GuiFunctions::DisableReactionfire::available(), GuiFunctions::JumpDriveIcon::available(), GuiFunctions::RepairUnit::available(), GuiFunctions::RefuelUnitCommand::available(), GuiFunctions::BuildVehicleCommand::available(), GuiFunctions::ConstructBuilding::available(), calcMoveMalus(), calcvisibilityfield(), Vehicle::ReactionFire::canPerformAttack(), ServiceChecker::check(), checkModificationConstraints(), checkunitsforremoval(), DashboardPanel::containerRenamed(), Building::convert(), copyFieldStep2(), countPlayersBinary(), ReplayMapDisplay::displayMovingUnit(), PG_MapDisplay::displayMovingUnit(), trunreplay::execnextreplaymove(), executeUserAction(), ConstructUnitCommand::externalConstructionAvail(), fieldAccessible(), AnyUnitEntersPolygon::fieldOperator(), AStar3D::findPath(), UnitAttacksSomething::getAttackingPlayer(), tunitattacksbuilding::getAttackingPlayer(), tunitattacksobject::getAttackingPlayer(), tunitattacksunit::getDefendingPlayer(), tunitattacksbuilding::getDefendingPlayer(), tmineattacksunit::getDefendingPlayer(), Vehicle::getResource(), CargoDialog::getResourceValue(), getSelectedUnit(), UnitLost::getState(), UnitConquered::getState(), BuildingConquered::getState(), getTransferLimitation(), giveunitaway(), JumpDriveCommand::go(), tcomputevehicleview::init(), tcomputebuildingview::init(), ConstructUnitCommand::internalConstructionAvail(), CargoItemFactory::isFiltered(), CargoItemFactory::itemSelected(), log(), DashboardPanel::painter(), paintField(), ContainerInfoLayer::paintSingleField(), MapRenderer::paintSingleField(), ReactionFireLayer::paintSingleField(), UnitInfoLayer::paintSingleField(), UnitTrainingLayer::paintSingleField(), MapRenderer::paintUnitOntoField(), SelectionHolder::pickup(), ClipBoardBase::place(), Vehicle::putResource(), putResources(), tspfldloaders::readfields(), ResearchGraph::recalc(), Building::registerForNewOwner(), Vehicle::registerForNewOwner(), MapField::removeObject(), tsearchreactionfireingunits::removeunit(), MatterConverter::run(), ResourceSink::run(), RegenerativePowerPlant::run(), MiningStation::run(), ConvertContainer::runAction(), MoveUnit::runAction(), ResearchGraph::setResearch(), tunitattacksunit::setup(), tunitattacksbuilding::setup(), tmineattacksunit::setup(), DashboardPanel::showUnitData(), SpawnUnit::SpawnUnit(), PutTribute::start(), testAiMovement5(), testAiMovement6(), testAiMovement7(), SearchReconquerBuilding::testfield(), MiningStation::testfield(), testTransferControl(), TransferHandler::TransferHandler(), DestructContainer::undoAction(), UnitInfoPanel::unitNaming(), ContainerConstControls::unitProductionAvailable(), ResearchWindow::update(), OverviewMapHolder::updateField(), Vehicle::vehicleconstructable(), VehicleCounterFactory::VehicleCounterFactory(), vehicleLoadable(), VehiclePropertyEditor::VehiclePropertyEditor(), viewterraininfo(), and viewUnitSetinfo().

Player & ContainerBase::getOwningPlayer ( ) const

returns the player this vehicle/building belongs to

Definition at line 678 of file containerbase.cpp.

References getMap(), and GameMap::getPlayer().

Referenced by GuiFunctions::ConstructBuilding::execute(), Building::getImage(), DashboardPanel::painter(), and GetTargetImage::visit().

virtual MapCoordinate3D ContainerBase::getPosition ( ) const
pure virtual
ASCString ContainerBase::getPrivateName ( ) const

Definition at line 58 of file containerbase.cpp.

References getName(), and privateName.

const ContainerBase::Production & ContainerBase::getProduction ( ) const
Resources ContainerBase::getProductionCost ( const VehicleType unit) const
virtual const ResourceMatrix& ContainerBase::getRepairEfficiency ( ) const
pure virtual

when a ContainerBase is repair by this ContainerBase, the default cost can be customized with this matrix.

Note
This effects both reparing another ContainerBase as well as self-repsir

Implemented in Vehicle, and Building.

Referenced by getMaxRepair().

virtual int ContainerBase::getResource ( int  amount,
int  resourcetype,
bool  queryonly,
int  scope = 1,
int  player = -1 
)
pure virtual
Resources ContainerBase::getResource ( const Resources res,
bool  queryonly,
int  scope = 1,
int  player = -1 
)

Definition at line 80 of file containerbase.cpp.

References getResource(), Resources::resource(), and resourceNum.

Resources ContainerBase::getResource ( const Resources res) const

Definition at line 88 of file containerbase.cpp.

References getAvailableResource(), Resources::resource(), and resourceNum.

Resources ContainerBase::getResourcePlus ( )
Resources ContainerBase::getResourceUsage ( )

returns the resource that the building consumes for its operation.

Definition at line 719 of file containerbase.cpp.

References baseType, ContainerBase::Work::getUsage(), ContainerBaseType::hasFunction(), ContainerBaseType::Research, researchpoints, returnResourcenUseForResearch(), and spawnWorkClasses().

Referenced by GetResourceUsage::checkbuilding().

Resources ContainerBase::getStorageCapacity ( ) const
bool ContainerBase::hasProductionLine ( const VehicleType type)

Definition at line 588 of file containerbase.cpp.

References internalUnitProduction.

virtual bool ContainerBase::isBuilding ( ) const
pure virtual
virtual int ContainerBase::maxAmmo ( int  type) const
pure virtual
void ContainerBase::moveToCargo ( Vehicle veh)

adds the unit to the cargo, and removes its from its current position

Definition at line 384 of file containerbase.cpp.

References addToCargo(), and Vehicle::unregisterPosition().

Resources ContainerBase::netResourcePlus ( ) const

returns the amount of resources that the net which the building is connected to produces each turn

Definition at line 666 of file containerbase.cpp.

References color, getMap(), getPosition(), ResourceChangeNet::getresource(), Resources::resource(), and resourceTypeNum.

void ContainerBase::paintField ( const Surface src,
Surface dest,
SPoint  pos,
int  dir,
bool  shaded,
int  shadowDist = -1 
) const
protected

displays an image of this container on the surface.

The different shaders (like semi-transparency for submerged stuff) is processed here

Parameters
srcThe source surface, which is an image of the ContainerBase
destThe destination surface, onto which the src image is painted
posThe position within dest at which src is painted
dirRotation of the image. Valid range is 0..5, resuling in 0�, 60� 120�, etc
shadedIf true then the image will not be displayed in color, but in greyscale
shadowDistThe offset of the shadow of the unit in pixels. Shadowdist will be added to the x and y coordinates if the position, resulting in the shadow being in the lower right of the image 0 = no shadow will be drawn If -1, the shadowDist will be calculated depending on the container's current height

blitter.setPlayer( getOwner() );

Definition at line 280 of file containerbase.cpp.

References MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::blit(), calcShadowDist(), chfahrend, chgetaucht, directionangle, gamemap, getFirstBit(), getHeight(), getOwner(), megaBlitter(), nullParam, and GameMap::player.

Referenced by Vehicle::paint(), and Building::paintSingleField().

virtual void ContainerBase::postRepair ( int  oldDamage,
bool  autoRepair 
)
pure virtual

is called after a repair is performed. Vehicles use this to reduce their experience.

Implemented in Vehicle, and Building.

Referenced by repairItem().

virtual int ContainerBase::putAmmo ( int  type,
int  num,
bool  queryOnly 
)
pure virtual

Implemented in Vehicle, and Building.

Referenced by ConsumeAmmo::runAction(), and ConsumeAmmo::undoAction().

virtual int ContainerBase::putResource ( int  amount,
int  resourcetype,
bool  queryonly,
int  scope = 1,
int  player = -1 
)
pure virtual

scope: 0 = local 1 = resource network 2 = global in all buildings 3 = map wide pool( used only internally! )

Implemented in Vehicle, and Building.

Referenced by RecycleUnitCommand::go(), Building::putResource(), Vehicle::putResource(), putResource(), putResources(), ResourceWatch::ResourceWatch(), MatterConverter::run(), RegenerativePowerPlant::run(), MiningStation::run(), and ConsumeResource::undoAction().

Resources ContainerBase::putResource ( const Resources res,
bool  queryonly,
int  scope = 1,
int  player = -1 
)

Definition at line 71 of file containerbase.cpp.

References putResource(), Resources::resource(), and resourceNum.

virtual void ContainerBase::read ( tnstream stream)
pure virtual

Implemented in Vehicle, and Building.

Referenced by TemporaryContainerStorage::restore().

virtual void ContainerBase::registerForNewOwner ( int  player)
pure virtual

this is a low level functions that changes the registration in the map. It's called by convert(int,bool)

Implemented in Vehicle, and Building.

Referenced by ConvertContainer::runAction(), and ConvertContainer::undoAction().

bool ContainerBase::registerWorkClassFactory ( WorkClassFactory wcf,
bool  ASCmode = true 
)
static

Definition at line 745 of file containerbase.cpp.

bool ContainerBase::removeUnitFromCargo ( Vehicle veh,
bool  recursive = false 
)

removes the given unit from the container.

Returns
true if the unit was found, false otherwise

Definition at line 391 of file containerbase.cpp.

References cargoChanged, and Vehicle::networkid.

Referenced by trunreplay::execnextreplaymove(), UnitFieldRegistration::runAction(), UnitFieldRegistration::undoAction(), Vehicle::unregisterPosition(), and Vehicle::~Vehicle().

bool ContainerBase::removeUnitFromCargo ( int  nwid,
bool  recursive = false 
)

Definition at line 404 of file containerbase.cpp.

References baseType, cargo, cargoChanged, and ContainerBaseType::maxLoadableUnits.

virtual void ContainerBase::removeview ( void  )
pure virtual

removes the containers view (=radar) on the map

Implemented in Vehicle, and Building.

Referenced by ViewRegistration::runAction(), and ViewRegistration::undoAction().

virtual int ContainerBase::repairableDamage ( ) const
pure virtual

returns the amount of damage that can still be repaired this turn

Implemented in Building, and Vehicle.

Referenced by DamageBarWidget::eventBlit(), getMaxRepair(), and repairItem().

int ContainerBase::repairItem ( ContainerBase item,
int  newDamage = 0,
bool  autoRepair = false 
)
void ContainerBase::setInternalResourceMaxPlus ( const Resources res)

The ResourceMaxPlus is used for different purposes by different building or vehicle functions, or not at all.

Definition at line 689 of file containerbase.cpp.

References baseType, Resources::count, ContainerBaseType::maxplus, maxplus, min(), and Resources::resource().

void ContainerBase::setInternalResourcePlus ( const Resources res)

The ResourcePlus is used for different purposes by different building or vehicle functions, or not at all.

Definition at line 683 of file containerbase.cpp.

References baseType, Resources::count, ContainerBaseType::maxplus, maxplus, min(), plus, and Resources::resource().

void ContainerBase::setName ( const ASCString name)
virtual

Definition at line 601 of file containerbase.cpp.

References checkModificationConstraints(), and name.

Referenced by setLocalizedContainerName().

void ContainerBase::setProductionLines ( const Production production)

Definition at line 594 of file containerbase.cpp.

References internalUnitProduction.

Referenced by UnitTypeTransformation::run().

ContainerBase::Work * ContainerBase::spawnWorkClasses ( bool  justQuery)

Definition at line 765 of file containerbase.cpp.

References getMap().

Referenced by getResourcePlus(), and getResourceUsage().

int ContainerBase::vehicleDocking ( const Vehicle vehicle,
bool  out 
) const

returns the levels of height on which this unit can be transfered by docking; or 0 if no unloading is possible

Definition at line 526 of file containerbase.cpp.

References baseType, ContainerBaseType::TransportationIO::Docking, doesVehicleFit(), ContainerBaseType::entranceSystems, MapCoordinate3D::getNumericalHeight(), getPosition(), VehicleType::movemalustyp, Vehicle::typ, and ContainerBaseType::vehicleFit().

Referenced by Vehicle::canMove(), and AStar3D::findPath().

bool ContainerBase::vehicleLoadable ( const Vehicle vehicle,
int  uheight = -1,
const bool *  attacked = NULL 
) const
int ContainerBase::vehiclesLoaded ( void  ) const
int ContainerBase::vehicleUnloadable ( const VehicleType vehicleType,
int  carrierHeight = -1 
) const

checks the unloading of a unit type

Parameters
vehicleTypethe vehicletype for which the unloading is checked
carrierHeightassume the carrier ( = this) was on this height (numerical: 0 - 7). If -1, use current height
Returns
the levels of height on which this unit can be unloaded; or 0 if no unloading is possible

Definition at line 494 of file containerbase.cpp.

References baseType, getPosition(), and ContainerBaseType::vehicleUnloadable().

Referenced by Vehicle::canMove(), AStar3D::findPath(), getProduction(), BuildProductionLineCommand::productionLinesBuyable(), ContainerConstControls::unitProductionPrerequisites(), and ConstructUnitCommand::unitProductionPrerequisites().

const ContainerBaseType::TransportationIO * ContainerBase::vehicleUnloadSystem ( const VehicleType vehicle,
int  height 
)
virtual void ContainerBase::write ( tnstream stream,
bool  includeLoadedUnits = true 
) const
pure virtual

Friends And Related Function Documentation

friend class ChangeContainerProperty
friend

Definition at line 42 of file containerbase.h.

friend class ConvertContainer
friend

Definition at line 41 of file containerbase.h.

Member Data Documentation

sigc::signal< void, ContainerBase * > ContainerBase::anyContainerConquered
static
sigc::signal< void, ContainerBase * > ContainerBase::anyContainerDestroyed
static
const ContainerBaseType* ContainerBase::baseType

the type descriping all non-instance specific properties of the container

Definition at line 80 of file containerbase.h.

Referenced by ResearchGraph::addSecondaryLab(), TransferHandler::ammoProductionPossible(), RemoveProductionLineCommand::avail(), DestructUnitCommand::avail(), ReactionFireSwitchCommand::avail(), BuildProductionLineCommand::avail(), SetResourceProcessingRateCommand::avail(), TrainUnitCommand::avail(), ContextMenu::ContainerCargo::available(), ContextMenu::ContainerProduction::available(), SolarPowerWindow::available(), WindPowerWindow::available(), ResearchWindow::available(), RepairUnitCommand::availInternally(), CargoDialog::CargoDialog(), cargoEditor(), ServiceChecker::check(), ContainerBase(), doesVehicleFit(), endRound(), StoringPosition::eventDraw(), ServiceTargetSearcher::externallyAvailable(), VehicleProduction_SelectionItemFactory::getAmmoFilling(), AddProductionLine_SelectionItemFactory::getCost(), RenameContainerCommand::getDescription(), getMaxRepair(), RecycleUnitCommand::getOutput(), getProduction(), getProductionCost(), getResourceUsage(), getStorageCapacity(), DestructUnitCommand::go(), MatterConversionWindow::hasFunction(), MiningWindow::hasFunction(), ConstructUnitCommand::internalConstructionAvail(), CargoItemFactory::isFiltered(), ProductionItemFactory::isFiltered(), MiningStation::MiningStation(), BuildProductionLineCommand::productionLinesBuyable(), removeUnitFromCargo(), StatisticsCalculator::resource(), returnResourcenUseForResearch(), ConvertContainer::runAction(), DestructContainer::runAction(), setInternalResourceMaxPlus(), setInternalResourcePlus(), ResearchGraph::setResearch(), CargoDialog::setUnitInfoWidgets(), StoringPosition::setup(), StatisticsCalculator::unitCost(), ContainerConstControls::unitProductionAvailable(), ContainerConstControls::unitProductionPrerequisites(), ConstructUnitCommand::unitProductionPrerequisites(), CargoDialog::updateVariables(), CargoDialog::userHandler(), vehicleDocking(), vehicleLoadable(), VehicleProduction_SelectionWindow::VehicleProduction_SelectionWindow(), vehicleUnloadable(), and vehicleUnloadSystem().

Resources ContainerBase::bi_resourceplus

the maximum amount of Resources that the building can produce each turn in the BI resource mode ; see also maxplus

Definition at line 271 of file containerbase.h.

Referenced by BiResourceGeneration::getPlus(), BuildingValues::init(), Building::newFromStream(), Building::read(), SpawnBuilding::runAction(), Building::write(), and Vehicle::write().

Cargo ContainerBase::cargo
protected
sigc::signal<void> ContainerBase::cargoChanged
ContainerBase* ContainerBase::cargoParent
protected

if this container is transported inside a carrier, this is carrier

Note
Only vehicles can be transported, building can't

Definition at line 56 of file containerbase.h.

Referenced by addToCargo(), and getCarrier().

int ContainerBase::color
sigc::signal<void> ContainerBase::conquered
int ContainerBase::damage

Damage. 0 is no damage, when damage reaches 100 the container is destroyed.

Definition at line 199 of file containerbase.h.

Referenced by RepairBuildingCommand::avail(), CargoGuiFunctions::RepairUnit::available(), Building::Building(), ServiceChecker::check(), compareMapResources(), ContainerBase(), copyBuildingData(), copyVehicleData(), Vehicle::endOwnTurn(), GameMap::endTurn(), DamageBarWidget::eventBlit(), trunreplay::execnextreplaymove(), ChangeBuildingDamage::execute(), RepairBuildingCommand::getCost(), CalculateThreat_Vehicle::getdamage(), getMaxRepair(), RecycleUnitCommand::getOutput(), RepairUnitCommand::go(), MoveUnitCommand::go(), BuildingValues::init(), UnitInfoLayer::paintSingleField(), InflictDamage::postCheck(), Building::postRepair(), Vehicle::postRepair(), Vehicle::repairableDamage(), Building::repairableDamage(), repairItem(), AiParameter::reset(), InflictDamage::runAction(), tunitattacksunit::setresult(), tunitattacksbuilding::setresult(), tmineattacksunit::setresult(), tunitattacksobject::setresult(), tunitattacksunit::setup(), tunitattacksbuilding::setup(), tmineattacksunit::setup(), tunitattacksobject::setup(), DashboardPanel::showUnitData(), StatisticsCalculator::strength(), testAiHeliMovement1(), testAiMovement1(), testAiMovement2(), testAiMovement3(), testAiMovement4(), testAiMovement5(), testAiService1(), testAutoRepair(), testJumpdrive(), testManualRepair(), testMovementRF(), testSelfDamage(), testView2(), InflictDamage::undoAction(), CargoDialog::updateResourceDisplay(), vehicleLoadable(), VehiclePropertyEditor::VehiclePropertyEditor(), Building::write(), and Vehicle::write().

sigc::signal<void> ContainerBase::destroyed
GameMap* ContainerBase::gamemap
protected
Production ContainerBase::internalUnitProduction
protected
Resources ContainerBase::maxplus
int ContainerBase::maxresearchpoints
ASCString ContainerBase::name
Resources ContainerBase::plus
ASCString ContainerBase::privateName

a name given by the user which is only visible to him and his allies.

Definition at line 135 of file containerbase.h.

Referenced by getPrivateName(), RenameContainerCommand::go(), DashboardPanel::showUnitData(), RenameContainerCommand::undoAction(), UnitNaming::UnitNaming(), Building::write(), and Vehicle::write().

int ContainerBase::repairedThisTurn
protected

the percantage that this container has already been repaired this turn.

Currently only used for Buildings - and only buildings serialize this property to disk! The maximum percentage may be limited by a gameparameter

Definition at line 49 of file containerbase.h.

Referenced by ContainerBase(), Building::endRound(), Building::postRepair(), Building::repairableDamage(), and Building::write().

int ContainerBase::researchpoints
int ContainerBase::view

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