Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MissionTemplate.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: MissionTemplate.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Simulation Universe and Region classes
13 */
14 
15 #ifndef MissionTemplate_h
16 #define MissionTemplate_h
17 
18 #include "Types.h"
19 #include "Mission.h"
20 
21 // +--------------------------------------------------------------------+
22 
23 class MissionTemplate;
24 class MissionAlias;
25 class MissionCallsign;
26 class MissionEvent;
27 
28 // +--------------------------------------------------------------------+
29 
30 class MissionTemplate : public Mission
31 {
32 public:
33  static const char* TYPENAME() { return "MissionTemplate"; }
34 
35  MissionTemplate(int id, const char* filename=0, const char* path=0);
36  virtual ~MissionTemplate();
37 
38  virtual bool Load(const char* filename=0, const char* path=0);
39 
40  // accessors/mutators:
41  virtual MissionElement* FindElement(const char* name);
42  virtual void AddElement(MissionElement* elem);
43  virtual bool MapElement(MissionElement* elem);
44  virtual Text MapShip(Text name);
45  virtual CombatGroup* GetPlayerSquadron() const { return player_squadron; }
46  virtual void SetPlayerSquadron(CombatGroup* ps) { player_squadron = ps; }
47  virtual Text MapCallsign(const char* name, int iff);
48  virtual bool MapEvent(MissionEvent* event);
49 
50 
51 protected:
52  CombatGroup* FindCombatGroup(int iff, const ShipDesign* dsn);
53  void ParseAlias(TermStruct* val);
54  void ParseCallsign(TermStruct* val);
55  bool ParseOptional(TermStruct* val);
56  void CheckObjectives();
57 
61 };
62 
63 // +--------------------------------------------------------------------+
64 
66 {
67  friend class MissionTemplate;
68 
69 public:
70  static const char* TYPENAME() { return "MissionAlias"; }
71 
72  MissionAlias() : elem(0) { }
73  MissionAlias(const char* n, MissionElement* e) : name(n), elem(e) { }
74  virtual ~MissionAlias() { }
75 
76  int operator == (const MissionAlias& a) const { return name == a.name; }
77 
78  Text Name() const { return name; }
79  MissionElement* Element() const { return elem; }
80 
81  void SetName(const char* n) { name = n; }
82  void SetElement(MissionElement* e) { elem = e; }
83 
84 protected:
87 };
88 
89 // +--------------------------------------------------------------------+
90 
92 {
93  friend class MissionTemplate;
94 
95 public:
96  static const char* TYPENAME() { return "MissionCallsign"; }
97 
99  MissionCallsign(const char* c, const char* n) : call(c), name(n) { }
100  virtual ~MissionCallsign() { }
101 
102  int operator == (const MissionCallsign& a)const { return call == a.call; }
103 
104  Text Callsign() const { return call; }
105  Text Name() const { return name; }
106 
107  void SetCallsign(const char* c) { call = c; }
108  void SetName(const char* n) { name = n; }
109 
110 protected:
113 };
114 
115 
116 #endif MissionTemplate_h
117