Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CombatZone.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: CombatZone.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  CombatZone is used by the dynamic campaign strategy
13  and logistics algorithms to assign forces to locations
14  within the campaign. A CombatZone is a collection of
15  closely related sectors, and the assets contained
16  within them.
17 */
18 
19 #ifndef CombatZone_h
20 #define CombatZone_h
21 
22 #include "Types.h"
23 #include "Geometry.h"
24 #include "Text.h"
25 #include "List.h"
26 
27 // +--------------------------------------------------------------------+
28 
29 class CombatGroup;
30 class CombatUnit;
31 class ZoneForce;
32 
33 // +--------------------------------------------------------------------+
34 
36 {
37 public:
38  static const char* TYPENAME() { return "CombatZone"; }
39 
40  CombatZone();
41  ~CombatZone();
42 
43  int operator == (const CombatZone& g) const { return this == &g; }
44 
45  const Text& Name() const { return name; }
46  const Text& System() const { return system; }
47  void AddGroup(CombatGroup* g);
48  void RemoveGroup(CombatGroup* g);
49  bool HasGroup(CombatGroup* g);
50  void AddRegion(const char* rgn);
51  bool HasRegion(const char* rgn);
52  List<Text>& GetRegions() { return regions; }
53  List<ZoneForce>& GetForces() { return forces; }
54 
55  ZoneForce* FindForce(int iff);
56  ZoneForce* MakeForce(int iff);
57 
58  void Clear();
59 
60  static List<CombatZone>&
61  Load(const char* filename);
62 
63 private:
64  // attributes:
65  Text name;
66  Text system;
67  List<Text> regions;
68  List<ZoneForce> forces;
69 };
70 
71 // +--------------------------------------------------------------------+
72 
73 class ZoneForce
74 {
75 public:
76  ZoneForce(int i);
77 
78  int GetIFF() { return iff; }
79  List<CombatGroup>& GetGroups() { return groups; }
80  List<CombatGroup>& GetTargetList() { return target_list; }
81  List<CombatGroup>& GetDefendList() { return defend_list; }
82 
83  void AddGroup(CombatGroup* g);
84  void RemoveGroup(CombatGroup* g);
85  bool HasGroup(CombatGroup* g);
86 
87  int GetNeed(int group_type) const;
88  void SetNeed(int group_type, int needed);
89  void AddNeed(int group_type, int needed);
90 
91 private:
92  // attributes:
93  int iff;
94  List<CombatGroup> groups;
95  List<CombatGroup> defend_list;
96  List<CombatGroup> target_list;
97  int need[8];
98 };
99 
100 // +--------------------------------------------------------------------+
101 
102 #endif CombatZone_h
103