Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Power.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: Power.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Power generation and usage classes
13 */
14 
15 #ifndef Power_h
16 #define Power_h
17 
18 #include "Types.h"
19 #include "System.h"
20 #include "List.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class PowerSource : public System
25 {
26 public:
27  enum SUBTYPE { BATTERY, AUX, FUSION };
28 
29  PowerSource(SUBTYPE s, double max_output, double fuel_ratio=0);
30  PowerSource(const PowerSource& rhs);
31 
32  virtual void ExecFrame(double seconds);
33 
34  void AddClient(System* client);
35  void RemoveClient(System* client);
36 
37  List<System>& Clients() { return clients; }
38 
39  virtual int Charge() const;
40 
41  virtual void SetFuelRange(double hours);
42 
43  bool RouteChanged() const { return route_changed; }
44  void RouteScanned() { route_changed = false; }
45 
46  // override from System:
47  virtual void SetPowerLevel(double level);
48  virtual void SetOverride(bool over);
49 
50  // for power drain damage:
51  virtual void DrainPower(double to_level);
52 
53 protected:
54  float max_output;
55  float fuel_ratio;
59 };
60 
61 #endif Power_h
62