Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ModInfo.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: ModInfo.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Information block for describing and deploying third party mods
13 */
14 
15 
16 #ifndef ModInfo_h
17 #define ModInfo_h
18 
19 #include "Types.h"
20 #include "Bitmap.h"
21 #include "Text.h"
22 #include "List.h"
23 
24 // +-------------------------------------------------------------------+
25 
26 class ModInfo;
27 class ModCampaign;
28 class ModCatalog;
29 
30 // +-------------------------------------------------------------------+
31 
32 class ModInfo
33 {
34 public:
35  static const char* TYPENAME() { return "ModInfo"; }
36 
37  ModInfo();
38  ModInfo(const char* filename);
39  ModInfo(const char* name, const char* version, const char* url);
40  ~ModInfo();
41 
42  int operator == (const ModInfo& m) const { return name.length() && name == m.name; }
43 
44  const Text& Name() const { return name; }
45  const Text& Description() const { return desc; }
46  const Text& Author() const { return author; }
47  const Text& URL() const { return url; }
48  const Text& Filename() const { return filename; }
49  const Text& Copyright() const { return copyright; }
50  Bitmap* LogoImage() const { return logo; }
51  const Text& Version() const { return version; }
52  bool Distribute() const { return distribute; }
53  bool IsEnabled() const { return enabled; }
54 
55  List<ModCampaign>& GetCampaigns() { return campaigns; }
56 
57  bool Load(const char* filename);
58  bool ParseModInfo(const char* buffer);
59 
60  bool Enable();
61  bool Disable();
62 
63 private:
64  Text name;
65  Text desc;
66  Text author;
67  Text url;
68  Text filename;
69  Text copyright;
70  Bitmap* logo;
71  Text logoname;
72  Text version;
73  bool distribute;
74  bool enabled;
75 
76  List<ModCampaign> campaigns;
77  ModCatalog* catalog;
78 };
79 
80 // +-------------------------------------------------------------------+
81 
83 {
84  friend class ModInfo;
85 
86 public:
87  static const char* TYPENAME() { return "ModCampaign"; }
88 
89  ModCampaign() : dynamic(false) { }
91 
92  const Text& Name() const { return name; }
93  const Text& Path() const { return path; }
94  bool IsDynamic() const { return dynamic; }
95 
96 private:
97  Text name;
98  Text path;
99  bool dynamic;
100 };
101 
102 // +-------------------------------------------------------------------+
103 
105 {
106  friend class ModInfo;
107 
108 public:
109  static const char* TYPENAME() { return "ModCatalog"; }
110 
113 
114  const Text& File() const { return file; }
115  const Text& Path() const { return path; }
116 
117 private:
118  Text file;
119  Text path;
120 };
121 
122 #endif ModInfo_h