Debian Codegraph @

plugins/dm.objectives/Objective.h

raw
1 #ifndef OBJECTIVE_H_
2 #define OBJECTIVE_H_
3
4 #include "Component.h"
5 #include "Logic.h"
6
7 #include "i18n.h"
8 #include <string>
9 #include <map>
10 #include <list>
11
12 namespace objectives
13 {
14
15 /**
16 * Data object representing a single mission objective.
17 */
18 class Objective
19 {
20 public:
21 // Description of objective
22 std::string description;
23
24 // Objective state enum
25 enum State {
26 INCOMPLETE = 0,
27 COMPLETE = 1,
28 INVALID = 2,
29 FAILED = 3,
30 NUM_STATES
31 } state;
32
33 // Boolean flags
34 bool mandatory;
35 bool visible;
36 bool ongoing;
37 bool irreversible;
38
39 // The difficulty levels this objective applies to (space-delimited integers)
40 std::string difficultyLevels;
41
42 // The prerequisites of this objective (a space-delimited index list for now)
43 std::string enablingObjs;
44
45 // Success/failure logic
46 Logic logic;
47
48 // The scripts that are called when this objective completes/fails
49 std::string completionScript;
50 std::string failureScript;
51
52 // These entities are triggered when this objective completes/fails
53 std::string completionTarget;
54 std::string failureTarget;
55
56 // Map of indexed components
57 typedef std::map<int, Component> ComponentMap;
58 ComponentMap components;
59
60 // Constructor
61 Objective() :
62 state(INCOMPLETE),
63 mandatory(true),
64 visible(true),
65 ongoing(false),
66 irreversible(false)
67 {}
68
69 static std::string getStateText(State state)
70 {
71 switch (state)
72 {
73 case INCOMPLETE: return _("INCOMPLETE");
74 case COMPLETE: return _("COMPLETE");
75 case FAILED: return _("FAILED");
76 case INVALID: return _("INVALID");
77 default: return "-";
78 };
79 }
80 };
81
82 /**
83 * Objective map type.
84 */
85 typedef std::map<int, Objective> ObjectiveMap;
86
87 }
88
89 #endif /*OBJECTIVE_H_*/