Emergency 20 Dokumentation  4.2.0
Objective-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Namespace ]
6 //[-------------------------------------------------------]
7 namespace em5
8 {
9 
10 
11  //[-------------------------------------------------------]
12  //[ Public methods ]
13  //[-------------------------------------------------------]
14  inline uint32 Objective::getId() const
15  {
16  return mUniqueId;
17  }
18 
20  {
21  return mTypeId;
22  }
23 
25  {
26  return mObjectiveType;
27  }
28 
29  inline void Objective::setObjectiveType(ObjectiveType objectiveType)
30  {
31  mObjectiveType = objectiveType;
32  }
33 
35  {
36  return mFreeplayEventId;
37  }
38 
39  inline const std::string& Objective::getText() const
40  {
41  return mText;
42  }
43 
44  inline void Objective::setText(const std::string& text)
45  {
46  mText = text;
47  }
48 
50  {
51  return mCurrentNumber;
52  }
53 
55  {
56  return mNeededNumber;
57  }
58 
60  {
61  return mCurrentEntities;
62  }
63 
65  {
66  return mNeededEntities;
67  }
68 
69  inline bool Objective::checkAccomplished() const
70  {
71  if (mObjectiveType == OBJECTIVETYPE_OPTIONAL_FAILED)
72  return false;
73 
74  if (mNeededNumber == 0)
75  {
76  // Special case: Needed number is 0
77  // -> For fail conditions, this counts as "not accomplished" (i.e. not failed)
78  // -> Otherwise, this counts as "accomplished" (because nothing left to do)
79  return (mObjectiveType != OBJECTIVETYPE_FAILCONDITION);
80  }
81 
82  return (mCurrentNumber >= mNeededNumber);
83  }
84 
86  {
87  return mPlayerCounter;
88  }
89 
90 
91 //[-------------------------------------------------------]
92 //[ Namespace ]
93 //[-------------------------------------------------------]
94 } // em5
Definition: ActionPriority.h:13
boost::container::flat_set< uint64 > EntityIdSet
Definition: Objective.h:66
std::array< uint16, 4 > PlayerCountMap
Definition: Objective.h:67
Objective is a fail condition, and will lead to a failure if accomplished.
Definition: Objective.h:73
uint32 getFreeplayEventId()
Get freeplay event ID.
Definition: Objective-inl.h:34
void setText(const std::string &text)
Set the objective text.
Definition: Objective-inl.h:44
unsigned int uint32
Definition: PlatformTypes.h:181
bool checkAccomplished() const
Definition: Objective-inl.h:69
const PlayerCountMap & getPlayerCountMap() const
Definition: Objective-inl.h:85
uint32 getNeededNumber() const
Definition: Objective-inl.h:54
ObjectiveType
Definition: Objective.h:70
const EntityIdSet & getCurrentEntityIdSet() const
Definition: Objective-inl.h:59
void setObjectiveType(ObjectiveType type)
Definition: Objective-inl.h:29
const EntityIdSet & getNeededEntityIdSet() const
Definition: Objective-inl.h:64
Objective is optional (irrelevant for success) and failed.
Definition: Objective.h:75
ObjectiveType getObjectiveType() const
Definition: Objective-inl.h:24
uint32 getCurrentNumber() const
Definition: Objective-inl.h:49
uint32 getTypeId() const
Definition: Objective-inl.h:19
uint32 getId() const
Definition: Objective-inl.h:14
const std::string & getText() const
Get the current objective text of this objective.
Definition: Objective-inl.h:39