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

Vehicle Class Reference

#include <vehicle.h>

Inheritance diagram for Vehicle:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Vehicle (const Vehicletype *t, GameMap *actmap, int player)
int repairableDamage ()
 returns the amount of damate that can still be repaired this turn
bool isBuilding () const
void setAttacked ()
 the the unit and all cargo to attacked = true
int getArmor () const
void setNewHeight (int bitmappedheight)
 changes a units height and adjusts the movement so that the percentage of used movepoints remains constant
bool spawnMoveObjects (const MapCoordinate &start, const MapCoordinate &dest)
 add the objects like tracks or broken ice
int getHeight () const
 returns the bitmapped level of height. Only one bit will be set, of course
ASCString getName () const
 returns the units name or, if it does not exist, the unit type's name or description
int getAmmo (int type, int num, bool queryOnly)
int getAmmo (int type, int num) const
int putAmmo (int type, int num, bool queryOnly)
int maxAmmo (int type) const
int size (void)
 Returns the size of a unit. A size is equal to the weight of the unit without any cargo or carried resources.
void endOwnTurn (void)
 hook that is called when a player ends his turn
void endAnyTurn (void)
 hook that is called when any player (including owner) ends turn
void endRound (void)
 hook that is called the next round begins ( active player switching from player8 to player1 )
int getIdentification ()
void setnewposition (int x, int y)
 sets the unit (and its cargo) the a new position (the unit will not be chained to a field)
void setnewposition (const MapCoordinate &mc)
void convert (int player)
 converts the unit so it is owned by 'player'.
void setGeneratorStatus (bool status)
 sets the status of the unit's energy generator
bool getGeneratorStatus () const
void postAttack (bool reactionFire)
 callback that is called after the unit has attacked
void addview ()
 adds the units view to the map.
void removeview ()
 removes the units view to the map.
bool isViewing () const
 returns true if the units view is currently added to the maps global visibility.
const SingleWeapongetWeapon (unsigned weaponNum)
 Returns the SingleWeapon corresponding to the weaponNum for this vehicle.
int searchForMineralResources () const
 searches for mineral resources.
MapCoordinate3D getPosition () const
 returns the units position
MapCoordinate3D getPosition3D () const
 returns the units position; if inside building then Height is -1
bool canRepair (const ContainerBase *item) const
 can the unit repair anything? This does not necessarily mean that the unit can repair other units, because a service weapon is additionally needed for that.
void fillMagically (bool ammo=true, bool resources=true)
 fills a unit with all resources it can carry and sets it class to "to be determined on map load".
void read (tnstream &stream)
 replaces the parameters of the unit by the ones form the stream.
void write (tnstream &stream, bool includeLoadedUnits=true)
void paint (Surface &s, SPoint pos, int shadowDist=-1) const
 displays the unit at position spos on s
void paint (Surface &s, SPoint pos, bool shaded, int shadowDist=-1) const
virtual Surface getImage () const
int getValueType (int uheight) const
 For the AI: calculating the ValueType if the unit was on the height uheight.
int getValueType () const
 For the AI: calculating the ValueType.
void transform (const Vehicletype *type)
 to be used with EXTREME caution, and only in the mapeditor !!
const Vehicletype::HeightChangeMethodgetHeightChange (int dir, int height=0) const
 returns the method for changing the height in the specified direction, or none if there is none.
bool weapexist (void)
 Is the unit able to shoot ?
void prepareForCleanRemove ()
 ~Vehicle ()
int getMemoryFootprint () const
Movement related functions
bool canMove (void) const
 can the unit move from its current position (does not check neighbouring fields)
int getMovement (bool checkFuel=true, bool checkRF=true) const
 returns the movement points the unit has left for this turn. CheckFuel should almost always be true.
void setMovement (int newmove, double cargoDivisor=-1)
 sets a new distance that the unit can move
bool hasMoved (void) const
 did the unit move this turn
int maxMovement () const
 the maximum distance that the unit can drive in a single turn on the current level of height
void decreaseMovement (int movement)
 reduces the movement by the given amount.
void resetMovement (void)
 resets a units movement. This is called at the beginning of each turn.
Resource related functions
int putResource (int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)
 scope: 0 = local 1 = resource network 2 = global in all buildings 3 = map wide pool( used only internally! )
int getResource (int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)
int getAvailableResource (int amount, int resourcetype, int scope=1) const
Resources getResource (const Resources &res) const
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 getTank () const
 returns the resources that the unit is carrying
Cargo related functions
int weight (void) const
 weight of unit including cargo
int freeWeight ()
 returns the free weight that can be used for cargo
Construction related functions
Vehicleconstructvehicle (Vehicletype *tnk, int x, int y)
 constructs a vehicle at the given position.
bool vehicleconstructable (Vehicletype *tnk, int x, int y)
 checks whether the unit can construct a vehicle of the given type at the given position.
bool buildingconstructable (const BuildingType *bld, bool checkResources=true)
 checks whether the unit can construct a building of the given type.

Static Public Member Functions

static VehiclenewFromStream (GameMap *gamemap, tnstream &stream, int forceNetworkID=-1)
 generates a new unit, loads its parameters from the stream (where they have been previously written with write) and returns this new unit.

Public Attributes

const Vehicletypetyp
int ammo [16]
int weapstrength [16]
int experience
bool attacked
 did the unit already attack this turn
int height
 the current level of height ( BITMAPPED ! )
char direction
 the direction in which the unit is facing
int xpos
 the position on the map
int ypos
 the position on the map
int connection
 if events are triggered by this unit (if it is lost for example), this will set connection != 0
int networkid
 a unique identification of the unit that is used everywhere in ASC (and not only the network protocols where is was first used, hence the name)
ASCString name
Vehicle::ReactionFire reactionfire
 The class that manages the reaction fire which causes a unit to attack approaching enemies even if it is not the unit's turn.
AiParameteraiparam [8]

Protected Member Functions

const ResourceMatrixgetRepairEfficiency (void)
virtual void postRepair (int oldDamage)
 is called after a repair is perfored. Vehicles use this to reduce their experience.
vector< MapCoordinategetCoveredFields ()

Classes

class  ReactionFire
 The class that manages the reaction fire which causes a unit to attack approaching enemies even if it is not the unit's turn. More...

Constructor & Destructor Documentation

Vehicle::Vehicle const Vehicletype t,
GameMap actmap,
int  player
 

Definition at line 55 of file vehicle.cpp.

References fatalError(), ContainerBase::gamemap, GameMap::getNewNetworkID(), networkid, GameMap::player, Player::vehicleList, and GameMap::vehicleLookupCache.

Vehicle::~Vehicle  ) 
 

Definition at line 94 of file vehicle.cpp.

References aiparam, ContainerBase::color, GameMap::Destruction, direction, ContainerBase::gamemap, GameMap::getField(), ContainerBase::getMap(), getPosition(), networkid, GameMap::player, removeview(), GameMap::state, typ, tfield::vehicle, Player::vehicleList, GameMap::vehicleLookupCache, Vehicletype::wreckageObject, xpos, and ypos.


Member Function Documentation

void Vehicle::addview  )  [virtual]
 

adds the units view to the map.

The view must then be evaluated by functions like evaluateviewcalculation ( GameMap*, int)

See also:
viewcalculation.cpp

Implements ContainerBase.

Definition at line 1006 of file vehicle.cpp.

References fatalError(), ContainerBase::gamemap, tcomputevehicleview::init(), and SearchFields::startsearch().

Referenced by computeview(), constructvehicle(), trunreplay::execnextreplaymove(), and FindUnitPlacementPos::testfield().

bool Vehicle::buildingconstructable const BuildingType bld,
bool  checkResources = true
 

checks whether the unit can construct a building of the given type.

This method does not check if there is enough space around the unit to place the building

Definition at line 910 of file vehicle.cpp.

References Vehicletype::buildingsBuildable, cgp_building_fuel_factor, cgp_building_material_factor, cgp_forbid_building_construction, ContainerBaseType::ConstructBuildings, Resources::fuel, ContainerBase::gamemap, GameMap::getgameparameter(), getheightdelta(), ContainerBase::getOwner(), ContainerBaseType::hasFunction(), height, log2(), Resources::material, GameMap::player, and typ.

Referenced by GuiFunctions::ConstructBuilding::execute(), GuiFunctions::BuildingConstruction::init(), and GuiFunctions::BuildingConstruction::setup().

bool Vehicle::canMove void   )  const
 

can the unit move from its current position (does not check neighbouring fields)

Definition at line 573 of file vehicle.cpp.

References Vehicle::ReactionFire::canMove(), cgp_movefrominvalidfields, ContainerBase::gamemap, tfield::getContainer(), GameMap::getField(), GameMap::getgameparameter(), getPosition(), reactionfire, terrainaccessible(), typ, and tfield::unitHere().

Referenced by BaseVehicleMovement::available(), CargoGuiFunctions::Movement::available(), CalculateThreat_Vehicle::calc_threat_vehicle(), AStar3D::findPath(), AStar::findPath(), and paint().

bool Vehicle::canRepair const ContainerBase item  )  const [virtual]
 

can the unit repair anything? This does not necessarily mean that the unit can repair other units, because a service weapon is additionally needed for that.

It may be the case that the unit can only repair itself.

Implements ContainerBase.

Definition at line 206 of file vehicle.cpp.

References Vehicletype::autorepairrate, ContainerBaseType::ExternalRepair, ContainerBaseType::hasFunction(), ContainerBaseType::InternalUnitRepair, and typ.

Referenced by VehicleService::FieldSearch::checkVehicle2Vehicle(), and VehicleService::getServices().

Vehicle * Vehicle::constructvehicle Vehicletype tnk,
int  x,
int  y
 

constructs a vehicle at the given position.

Definition at line 839 of file vehicle.cpp.

References addview(), attacked, ContainerBase::color, decreaseMovement(), Resources::fuel, ContainerBase::gamemap, GameMap::getField(), Vehicletype::height, height, Resources::material, maxMovement(), setMovement(), typ, Vehicletype::unitConstructionMoveCostPercentage, vehicleconstructable(), xpos, and ypos.

Referenced by GuiFunctions::VehicleBuildingGui::execute().

void Vehicle::convert int  player  )  [virtual]
 

converts the unit so it is owned by 'player'.

Note that the player is passed as parameter (values [0..8]), and not his color (which would be the values [0,8,16,..,64] )

Implements ContainerBase.

Definition at line 815 of file vehicle.cpp.

References ContainerBase::anyContainerConquered, ContainerBase::cargo, ContainerBase::color, ContainerBase::conquered, fatalError(), ContainerBase::gamemap, ContainerBase::getOwner(), GameMap::player, and Player::vehicleList.

Referenced by tunit::buttonpressed(), trunreplay::execnextreplaymove(), CargoGuiFunctions::TransferUnitControl::execute(), VehicleItem::place(), and tgiveunitawaydlg::run().

void Vehicle::decreaseMovement int  movement  ) 
 

reduces the movement by the given amount.

Negative values are possible. Don't use something like "setmovement ( getmovement() - amount )", because getmovement may return a lower amount due to lack of fuel.

Definition at line 546 of file vehicle.cpp.

References height, log2(), Vehicletype::movement, setMovement(), and typ.

Referenced by constructvehicle(), GuiFunctions::ObjectBuildingGui::execute(), postAttack(), and putMine().

void Vehicle::endAnyTurn void   )  [virtual]
 

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

Reimplemented from ContainerBase.

Definition at line 424 of file vehicle.cpp.

References Vehicle::ReactionFire::endAnyTurn(), ContainerBase::endAnyTurn(), and reactionfire.

void Vehicle::endOwnTurn void   )  [virtual]
 

hook that is called when a player ends his turn

Reimplemented from ContainerBase.

Definition at line 431 of file vehicle.cpp.

References ammo, attacked, Vehicletype::autorepairrate, SingleWeapon::count, cwlaserb, ContainerBase::damage, Vehicle::ReactionFire::endOwnTurn(), ContainerBase::endOwnTurn(), fatalError(), ContainerBase::gamemap, GameMap::getField(), getPosition(), ContainerBase::getResource(), SingleWeapon::gettype(), height, Vehicletype::height, SingleWeapon::laserRechargeCost, max(), Vehicletype::movement, reactionfire, ContainerBase::repairItem(), resetMovement(), Resources::resource(), typ, UnitWeapon::weapon, and Vehicletype::weapons.

void Vehicle::endRound void   )  [virtual]
 

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

Reimplemented from ContainerBase.

Definition at line 411 of file vehicle.cpp.

References ContainerBase::endRound(), Resources::energy, Resources::fuel, generatortruckefficiency, ContainerBase::getStorageCapacity(), ContainerBaseType::hasFunction(), ContainerBaseType::MatterConverter, and typ.

void Vehicle::fillMagically bool  ammo = true,
bool  resources = true
 

fills a unit with all resources it can carry and sets it class to "to be determined on map load".

This function should only be called in the mapeditor !

Definition at line 1129 of file vehicle.cpp.

References ammo, SingleWeapon::count, ContainerBase::getStorageCapacity(), SingleWeapon::maxstrength, typ, UnitWeapon::weapon, Vehicletype::weapons, and weapstrength.

Referenced by ASC_MainScreenWidget::eventKeyDown(), CargoItemFactory::itemSelected(), and VehicleItem::place().

int Vehicle::freeWeight  ) 
 

returns the free weight that can be used for cargo

Definition at line 987 of file vehicle.cpp.

References tfield::building, ContainerBase::gamemap, ContainerBase::getCargo(), GameMap::getField(), searchstackforfreeweight(), tfield::vehicle, xpos, and ypos.

int Vehicle::getAmmo int  type,
int  num
const [virtual]
 

Implements ContainerBase.

Definition at line 1603 of file vehicle.cpp.

References ammo, SingleWeapon::getScalarWeaponType(), min(), typ, UnitWeapon::weapon, and Vehicletype::weapons.

int Vehicle::getAmmo int  type,
int  num,
bool  queryOnly
[virtual]
 

Implements ContainerBase.

Definition at line 1618 of file vehicle.cpp.

References ammo, SingleWeapon::canRefuel(), SingleWeapon::getScalarWeaponType(), min(), putAmmo(), typ, UnitWeapon::weapon, and Vehicletype::weapons.

Referenced by putAmmo().

int Vehicle::getArmor  )  const [virtual]
 

Implements ContainerBase.

Definition at line 1700 of file vehicle.cpp.

References Vehicletype::armor, and typ.

Referenced by tunitattacksobject::setup(), tmineattacksunit::setup(), tunitattacksbuilding::setup(), and tunitattacksunit::setup().

int Vehicle::getAvailableResource int  amount,
int  resourcetype,
int  scope = 1
const [virtual]
 

Implements ContainerBase.

Definition at line 272 of file vehicle.cpp.

References getGeneratorStatus(), min(), and Resources::resource().

Referenced by getResource().

vector< MapCoordinate > Vehicle::getCoveredFields  )  [protected, virtual]
 

Implements ContainerBase.

Definition at line 1730 of file vehicle.cpp.

References getPosition().

bool Vehicle::getGeneratorStatus  )  const [inline]
 

Definition at line 289 of file vehicle.h.

Referenced by GuiFunctions::PowerOff::available(), GuiFunctions::PowerOn::available(), getAvailableResource(), and getResource().

int Vehicle::getHeight  )  const [inline, virtual]
 

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

Implements ContainerBase.

Definition at line 211 of file vehicle.h.

References height.

const Vehicletype::HeightChangeMethod * Vehicle::getHeightChange int  dir,
int  height = 0
const
 

returns the method for changing the height in the specified direction, or none if there is none.

Parameters:
dir +1 is up; -1 is down
height if != 0: assume this level of height instead of the actual one

Definition at line 747 of file vehicle.cpp.

References Vehicle::ReactionFire::canMove(), Vehicletype::height, Vehicletype::heightChangeMethod, log2(), reactionfire, and typ.

Referenced by calcMoveMalus(), and ChangeVehicleHeight::execute().

int Vehicle::getIdentification  )  [inline, virtual]
 

Implements ContainerBase.

Definition at line 260 of file vehicle.h.

References networkid.

Surface Vehicle::getImage  )  const [virtual]
 

Implements ContainerBase.

Definition at line 1722 of file vehicle.cpp.

References Surface::createSurface(), fieldsizex, fieldsizey, paint(), and Surface::transparent.

Referenced by InternalAmmoTransferWindow::InternalAmmoTransferWindow().

int Vehicle::getMemoryFootprint  )  const
 

Definition at line 1738 of file vehicle.cpp.

int Vehicle::getMovement bool  checkFuel = true,
bool  checkRF = true
const
 

returns the movement points the unit has left for this turn. CheckFuel should almost always be true.

Definition at line 532 of file vehicle.cpp.

References Vehicle::ReactionFire::canMove(), Resources::fuel, Vehicletype::fuelConsumption, minmalq, reactionfire, and typ.

Referenced by UnitHooveringLogic::calcFuelUsage(), GuiFunctions::ObjectBuildingGui::checkObject(), ChangeVehicleHeight::execute(), VehicleMovement::execute(), StratAStar3D::getMoveCost(), StratAStar::getMoveCost(), tputmine::initpm(), BaseVehicleMovement::moveunitxy(), putMine(), SaveUnitMovement::SaveUnitMovement(), setNewHeight(), DashboardPanel::showUnitData(), and vehicleconstructable().

ASCString Vehicle::getName  )  const [virtual]
 

returns the units name or, if it does not exist, the unit type's name or description

Implements ContainerBase.

Definition at line 1594 of file vehicle.cpp.

References Vehicletype::getName(), name, and typ.

MapCoordinate3D Vehicle::getPosition  )  const [virtual]
 

returns the units position

Implements ContainerBase.

Definition at line 1577 of file vehicle.cpp.

References height, xpos, and ypos.

Referenced by AStar3D::AStar3D(), tsearchreactionfireingunits::attack(), canMove(), compareMapResources(), computeview(), MapDisplayPG::displayAddons(), endOwnTurn(), GuiFunctions::VehicleBuildingGui::eval(), GuiFunctions::ObjectBuildingGui::eval(), ChangeVehicleHeight::execute(), VehicleMovement::execute(), GuiFunctions::VehicleBuildingGui::execute(), CargoGuiFunctions::TransferUnitControl::execute(), JumpDrive::fieldReachable(), getCoveredFields(), BaseVehicleMovement::PathFinder::getMovementFields(), tcomputevehicleview::init(), GuiFunctions::VehicleBuildingGui::init(), GuiFunctions::ObjectBuildingGui::init(), tputmine::initpm(), JumpDrive::jump(), DashboardPanel::painter(), WeaponRange::run(), GuiFunctions::BuildingConstruction::setBuilding(), GuiFunctions::BuildingConstruction::setup(), tunitattacksunit::setup(), UnitAttacksUnit_FakeHemming::UnitAttacksUnit_FakeHemming(), and ~Vehicle().

MapCoordinate3D Vehicle::getPosition3D  )  const
 

returns the units position; if inside building then Height is -1

Definition at line 1582 of file vehicle.cpp.

References ContainerBase::gamemap, GameMap::getField(), height, MapCoordinate3D::setnum(), xpos, and ypos.

Referenced by AStar3D::findPath().

const ResourceMatrix& Vehicle::getRepairEfficiency void   )  [inline, protected, virtual]
 

Implements ContainerBase.

Definition at line 235 of file vehicle.h.

Resources Vehicle::getResource const Resources res,
bool  queryonly,
int  scope = 1,
int  player = -1
[inline]
 

Reimplemented from ContainerBase.

Definition at line 203 of file vehicle.h.

References ContainerBase::getResource().

Resources Vehicle::getResource const Resources res  )  const
 

Reimplemented from ContainerBase.

Definition at line 284 of file vehicle.cpp.

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

int Vehicle::getResource int  amount,
int  resourcetype,
bool  queryonly,
int  scope = 1,
int  player = -1
[virtual]
 

Implements ContainerBase.

Definition at line 244 of file vehicle.cpp.

References getGeneratorStatus(), ContainerBase::getMap(), ContainerBase::getOwner(), min(), putResource(), and Resources::resource().

Referenced by JumpDrive::available(), GuiFunctions::ObjectBuildingGui::checkObject(), GetResource::checkvehicle(), compareMapResources(), destructbuildinglevel2(), GuiFunctions::ConstructBuilding::execute(), GuiFunctions::BuildingConstruction::execute(), GuiFunctions::ObjectBuildingGui::execute(), ContainerControls::fillResource(), JumpDrive::jump(), and putResource().

Resources Vehicle::getTank  )  const
 

returns the resources that the unit is carrying

Definition at line 294 of file vehicle.cpp.

Referenced by GuiFunctions::DestructBuilding::available(), CargoGuiFunctions::RefuelUnit::available(), VehicleService::FieldSearch::checkVehicle2Vehicle(), copyVehicleData(), trunreplay::execnextreplaymove(), ContainerControls::fillResource(), getUnitResourceCargo(), and DashboardPanel::showUnitData().

int Vehicle::getValueType  )  const [inline]
 

For the AI: calculating the ValueType.

Definition at line 365 of file vehicle.h.

References height, and log2().

int Vehicle::getValueType int  uheight  )  const [inline]
 

For the AI: calculating the ValueType if the unit was on the height uheight.

Definition at line 362 of file vehicle.h.

References log2().

const SingleWeapon * Vehicle::getWeapon unsigned  weaponNum  ) 
 

Returns the SingleWeapon corresponding to the weaponNum for this vehicle.

Definition at line 1780 of file vehicle.cpp.

References typ, UnitWeapon::weapon, and Vehicletype::weapons.

Referenced by InternalAmmoTransferHandler::getMaxAmmo(), InternalAmmoTransferHandler::getName(), internalAmmoTransferAvailable(), InternalAmmoTransferHandler::InternalAmmoTransferHandler(), InternalAmmoTransferHandler::performTransfer(), tunitattacksunit::setup(), and InternalAmmoTransferHandler::weaponAmmoTransferBuffer().

bool Vehicle::hasMoved void   )  const
 

did the unit move this turn

Definition at line 526 of file vehicle.cpp.

References height, log2(), Vehicletype::movement, and typ.

Referenced by attackpossible2n(), JumpDrive::available(), GuiFunctions::ConstructBuilding::available(), GuiFunctions::DestructBuilding::available(), GuiFunctions::ConstructBuilding::execute(), and tsearchdestructbuildingfields::initdestructbuilding().

bool Vehicle::isBuilding  )  const [inline, virtual]
 

Implements ContainerBase.

Definition at line 80 of file vehicle.h.

bool Vehicle::isViewing  )  const [inline]
 

returns true if the units view is currently added to the maps global visibility.

See also:
viewcalculation.cpp

Definition at line 304 of file vehicle.h.

int Vehicle::maxAmmo int  type  )  const [virtual]
 

Implements ContainerBase.

Definition at line 1689 of file vehicle.cpp.

References ammo, SingleWeapon::count, SingleWeapon::getScalarWeaponType(), typ, UnitWeapon::weapon, and Vehicletype::weapons.

int Vehicle::maxMovement  )  const
 

the maximum distance that the unit can drive in a single turn on the current level of height

Definition at line 1117 of file vehicle.cpp.

References height, log2(), Vehicletype::movement, and typ.

Referenced by AStar3D::AStar3D(), UnitHooveringLogic::calcFuelUsage(), constructvehicle(), AStar::findPath(), paint(), postAttack(), setNewHeight(), and vehicleconstructable().

Vehicle * Vehicle::newFromStream GameMap gamemap,
tnstream stream,
int  forceNetworkID = -1
[static]
 

generates a new unit, loads its parameters from the stream (where they have been previously written with write) and returns this new unit.

Definition at line 1744 of file vehicle.cpp.

References ContainerBase::color, GameMap::getNewNetworkID(), GameMap::getvehicletype_byid(), networkid, tnstream::readChar(), readData(), tnstream::readInt(), tnstream::readWord(), and GameMap::vehicleLookupCache.

Referenced by Reinforcements::execute(), ClipBoardBase::pasteUnit(), and tspfldloaders::readfields().

void Vehicle::paint Surface s,
SPoint  pos,
bool  shaded,
int  shadowDist = -1
const
 

Definition at line 1717 of file vehicle.cpp.

References direction, Vehicletype::getImage(), ContainerBase::paintField(), and typ.

void Vehicle::paint Surface s,
SPoint  pos,
int  shadowDist = -1
const
 

displays the unit at position spos on s

Definition at line 1706 of file vehicle.cpp.

References GameMap::actplayer, attacked, canMove(), ContainerBase::color, UnitWeapon::count, direction, ContainerBase::gamemap, Vehicletype::getImage(), CGameOptions::Instance(), maxMovement(), ContainerBase::paintField(), typ, and Vehicletype::weapons.

Referenced by MapDisplayPG::displayAddons(), MapDisplayPG::displayMovementStep(), getImage(), and MapRenderer::paintSingleField().

void Vehicle::postAttack bool  reactionFire  ) 
 

callback that is called after the unit has attacked

Definition at line 1030 of file vehicle.cpp.

References attacked, attackmovecost, decreaseMovement(), Vehicle::ReactionFire::getStatus(), ContainerBaseType::hasFunction(), maxMovement(), ContainerBaseType::MoveAfterAttack, Vehicle::ReactionFire::off, reactionfire, setMovement(), and typ.

Referenced by tunitattacksobject::setresult(), tunitattacksbuilding::setresult(), and tunitattacksunit::setresult().

void Vehicle::postRepair int  oldDamage  )  [protected, virtual]
 

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

Implements ContainerBase.

Definition at line 339 of file vehicle.cpp.

References ContainerBase::damage, experience, experienceDecreaseDamageBoundaries, and experienceDecreaseDamageBoundaryNum.

void Vehicle::prepareForCleanRemove  )  [inline]
 

Definition at line 379 of file vehicle.h.

Referenced by execuseraction().

int Vehicle::putAmmo int  type,
int  num,
bool  queryOnly
[virtual]
 

Implements ContainerBase.

Definition at line 1655 of file vehicle.cpp.

References ammo, SingleWeapon::count, getAmmo(), SingleWeapon::getScalarWeaponType(), min(), SingleWeapon::shootable(), typ, UnitWeapon::weapon, and Vehicletype::weapons.

Referenced by getAmmo().

Resources Vehicle::putResource const Resources res,
bool  queryonly,
int  scope = 1,
int  player = -1
[inline]
 

Reimplemented from ContainerBase.

Definition at line 202 of file vehicle.h.

References ContainerBase::putResource().

int Vehicle::putResource int  amount,
int  resourcetype,
bool  queryonly,
int  scope = 1,
int  player = -1
[virtual]
 

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

Implements ContainerBase.

Definition at line 213 of file vehicle.cpp.

References ContainerBase::getMap(), ContainerBase::getOwner(), getResource(), ContainerBase::getStorageCapacity(), min(), PEACE, and Resources::resource().

Referenced by VehicleService::FieldSearch::checkVehicle2Vehicle(), VehicleService::execute(), ContainerControls::fillResource(), and getResource().