Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Energy Class Reference

#include <Energy.h>

Inherits Snapshot.

Public Member Functions

 Energy ()
 
void init (Player *owner)
 
Int getProduction () const
 return current energy production in kilowatts
 
Int getConsumption () const
 return current energy consumption in kilowatts
 
Bool hasSufficientPower (void) const
 
void adjustPower (Int powerDelta, Bool adding)
 
void objectEnteringInfluence (Object *obj)
 new 'obj' will now add/subtract from this energy construct
 
void objectLeavingInfluence (Object *obj)
 'obj' will now no longer add/subtrack from this energy construct
 
void addPowerBonus (Object *obj)
 
void removePowerBonus (Object *obj)
 
void setPowerSabotagedTillFrame (UnsignedInt frame)
 
UnsignedInt getPowerSabotagedTillFrame () const
 
Real getEnergySupplyRatio () const
 
- Public Member Functions inherited from Snapshot
 Snapshot (void)
 
 ~Snapshot (void)
 

Protected Member Functions

virtual void crc (Xfer *xfer)
 
virtual void xfer (Xfer *xfer)
 
virtual void loadPostProcess (void)
 
void addProduction (Int amt)
 
void addConsumption (Int amt)
 

Detailed Description

This class is used to encapsulate the Player's energy use and production. for consistent nomenclature, we'll arbitrarily call energy units "kilowatts" (though that may have no bearing on reality).

Definition at line 64 of file Energy.h.

Constructor & Destructor Documentation

◆ Energy()

Energy::Energy ( )

Definition at line 63 of file Energy.cpp.

Member Function Documentation

◆ addConsumption()

void Energy::addConsumption ( Int amt)
protected

Definition at line 241 of file Energy.cpp.

◆ addPowerBonus()

void Energy::addPowerBonus ( Object * obj)

Adds an energy bonus to the player's pool if the power bonus status bit is set

Adds an energy bonus to the player's pool of energy when the "Control Rods" upgrade is made to the American Cold Fusion Plant

Definition at line 189 of file Energy.cpp.

◆ addProduction()

void Energy::addProduction ( Int amt)
protected

Definition at line 228 of file Energy.cpp.

◆ adjustPower()

void Energy::adjustPower ( Int powerDelta,
Bool adding )

Definition at line 111 of file Energy.cpp.

◆ crc()

void Energy::crc ( Xfer * xfer)
protectedvirtual

CRC

Implements Snapshot.

Definition at line 254 of file Energy.cpp.

◆ getConsumption()

Int Energy::getConsumption ( ) const
inline

return current energy consumption in kilowatts

Definition at line 83 of file Energy.h.

◆ getEnergySupplyRatio()

Real Energy::getEnergySupplyRatio ( ) const

return the percentage of energy needed that we actually produce, as a 0.0 ... 1.0 fraction.

Definition at line 83 of file Energy.cpp.

◆ getPowerSabotagedTillFrame()

UnsignedInt Energy::getPowerSabotagedTillFrame ( ) const
inline

Definition at line 101 of file Energy.h.

◆ getProduction()

Int Energy::getProduction ( ) const

return current energy production in kilowatts

Definition at line 72 of file Energy.cpp.

◆ hasSufficientPower()

Bool Energy::hasSufficientPower ( void ) const

Definition at line 100 of file Energy.cpp.

◆ init()

void Energy::init ( Player * owner)
inline

Definition at line 72 of file Energy.h.

◆ loadPostProcess()

void Energy::loadPostProcess ( void )
protectedvirtual

Load post process

Implements Snapshot.

Definition at line 301 of file Energy.cpp.

◆ objectEnteringInfluence()

void Energy::objectEnteringInfluence ( Object * obj)

new 'obj' will now add/subtract from this energy construct

new 'obj' will now add/subtract from this energy construct

Definition at line 136 of file Energy.cpp.

◆ objectLeavingInfluence()

void Energy::objectLeavingInfluence ( Object * obj)

'obj' will now no longer add/subtrack from this energy construct

'obj' will now no longer add/subtrack from this energy construct

Definition at line 162 of file Energy.cpp.

◆ removePowerBonus()

void Energy::removePowerBonus ( Object * obj)

Removed an energy bonus

Definition at line 208 of file Energy.cpp.

◆ setPowerSabotagedTillFrame()

void Energy::setPowerSabotagedTillFrame ( UnsignedInt frame)
inline

Definition at line 100 of file Energy.h.

◆ xfer()

void Energy::xfer ( Xfer * xfer)
protectedvirtual

Xfer method Version Info: 1: Initial version

Implements Snapshot.

Definition at line 264 of file Energy.cpp.


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