Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Hangar.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: Hangar.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Everything needed to store and maintain space craft
13 
14  See Also: FlightDeck
15 */
16 
17 #ifndef Hangar_h
18 #define Hangar_h
19 
20 #include "Types.h"
21 #include "Geometry.h"
22 #include "SimObject.h"
23 #include "Text.h"
24 
25 // +--------------------------------------------------------------------+
26 
27 class Ship;
28 class ShipDesign;
29 class FlightDeck;
30 class FlightDeckSlot;
31 class Element;
32 class HangarSlot;
33 class InboundSlot;
34 class CombatGroup;
35 
36 // +--------------------------------------------------------------------+
37 
38 class Hangar : public SimObserver
39 {
40 public:
41  Hangar();
42  Hangar(const Hangar& rhs);
43  virtual ~Hangar();
44 
45  enum HANGAR_STATE { UNAVAIL = -2,
46  MAINT = -1,
47  STORAGE = 0,
56  };
57 
58  enum CONSTANTS { MAX_SQUADRONS=10 };
59 
60  virtual void ExecFrame(double seconds);
61  void SetShip(Ship* s) { ship = s; }
62 
63  virtual bool CreateSquadron(Text squadron, CombatGroup* g,
64  const ShipDesign* design, int count, int iff=-1,
65  int* def_load=0, int maint_count=0, int dead_count=0);
66 
67  // used only by net client to expedite creation of already active ships:
68  virtual bool GotoActiveFlight(int squadron, int slot, Element* elem, int* loadout);
69 
70  virtual bool GotoAlert(int squadron, int slot, FlightDeck* d, Element* elem=0, int* loadout=0, bool pkg=false, bool expedite=false);
71  virtual bool Ready(int squadron, int slot, FlightDeck* d);
72  virtual bool Launch(int squadron, int slot);
73  virtual bool StandDown(int squadron, int slot);
74  virtual bool CanStow(Ship* s);
75  virtual bool Stow(Ship* s);
76  virtual bool FindSlot(Ship* s, int& squadron, int& slot, int state=UNAVAIL);
77  virtual bool FindSquadronAndSlot(Ship* s, int& squadron, int& slot);
78  virtual bool FindAvailSlot(const ShipDesign* s, int& squadron, int& slot);
79  virtual bool FinishPrep(HangarSlot* slot);
80  virtual void SetAllIFF(int iff);
81 
82  virtual bool Update(SimObject* obj);
83  virtual const char* GetObserverName() const;
84 
85  // accessors:
86  int NumSquadrons() const { return nsquadrons; }
87  Text SquadronName(int n) const;
88  int SquadronSize(int n) const;
89  int SquadronIFF(int n) const;
90  const ShipDesign* SquadronDesign(int n) const;
91 
92  int NumShipsReady(int squadron) const;
93  int NumShipsMaint(int squadron) const;
94  int NumShipsDead(int squadron) const;
95  int NumSlotsEmpty() const;
96 
97  int GetActiveElements(List<Element>& active_list);
98 
99  const HangarSlot* GetSlot(int squadron, int index) const;
100  Ship* GetShip(const HangarSlot* s) const;
101  const ShipDesign* GetDesign(const HangarSlot* s) const;
102  FlightDeck* GetFlightDeck(const HangarSlot* s) const;
103  int GetFlightDeckSlot(const HangarSlot* s) const;
104  int GetState(const HangarSlot* s) const;
105  double TimeRemaining(const HangarSlot* s) const;
106  Element* GetPackageElement(const HangarSlot* s) const;
107  const int* GetLoadout(const HangarSlot* s) const;
108  Text StatusName(const HangarSlot* s) const;
109 
110  int PreflightQueue(FlightDeck* d) const;
111  DWORD GetLastPatrolLaunch() const;
112  void SetLastPatrolLaunch(DWORD t);
113 
114 protected:
121 };
122 
123 // +--------------------------------------------------------------------+
124 
125 
126 #endif Hangar_h
127