#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) |
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).
| Energy::Energy | ( | ) |
Definition at line 63 of file Energy.cpp.
|
protected |
Definition at line 241 of file Energy.cpp.
| 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.
|
protected |
Definition at line 228 of file Energy.cpp.
Definition at line 111 of file Energy.cpp.
|
protectedvirtual |
|
inline |
| 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.
|
inline |
| Int Energy::getProduction | ( | ) | const |
return current energy production in kilowatts
Definition at line 72 of file Energy.cpp.
| Bool Energy::hasSufficientPower | ( | void | ) | const |
Definition at line 100 of file Energy.cpp.
|
protectedvirtual |
| 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.
| 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.
| void Energy::removePowerBonus | ( | Object * | obj | ) |
Removed an energy bonus
Definition at line 208 of file Energy.cpp.
|
inline |
|
protectedvirtual |
Xfer method Version Info: 1: Initial version
Implements Snapshot.
Definition at line 264 of file Energy.cpp.