Emergency 20 Dokumentation  4.2.0
FairVisitorsWithFoodPoisoningEvent.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
15 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
31  {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Public definitions ]
36  //[-------------------------------------------------------]
37  public:
38  static const uint32 FREEPLAY_EVENT_ID;
39 
40 
41  //[-------------------------------------------------------]
42  //[ Public methods ]
43  //[-------------------------------------------------------]
44  public:
50 
56 
61  uint32 getDeadPersonsToFail() const;
62 
67  void setDeadPersonsToFail(uint32 personsToFail);
68 
69  uint32 getVictimCount() const;
70  void setVictimCount(uint32 val);
71  uint64 getBuildingId() const;
72  void setBuildingId(uint64 val);
73  float getHint08LifeEnergy() const;
74  void setHint08LifeEnergy(float val);
75 
76 
77  //[-------------------------------------------------------]
78  //[ Public virtual em5::FreeplayEvent methods ]
79  //[-------------------------------------------------------]
80  public:
81  virtual bool onStartup() override;
82  virtual void onShutdown() override;
83  virtual void onRun() override;
84  virtual bool onFailure(EventResult& eventResult) override;
85  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
86  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
87  virtual void hintCallback(Observer& hintObserver) override;
88  virtual const qsf::Entity* getFocusEntity() override;
89  virtual bool checkEventConfiguration() override;
90  virtual void serialize(qsf::BinarySerializer& serializer) override;
91 
92 
93  //[-------------------------------------------------------]
94  //[ Private methods ]
95  //[-------------------------------------------------------]
96  private:
97  void startObjectives();
98  void startHintObservers();
99  qsf::Entity* createVictim();
100  qsf::Entity* createSalesman();
101  bool checkIfReachedShop(qsf::Entity& entity);
102  void startSalesmanEscape();
103  uint32 getFailReasonObjectiveTypeId(const ObjectiveList& objectives);
104 
105 
106  //[-------------------------------------------------------]
107  //[ Private definitions ]
108  //[-------------------------------------------------------]
109  private:
110  enum VictimState
111  {
112  GO_TO_SHOP,
113  EATING,
114  GO_AWAY,
115  ILL
116  };
117 
118 
119  //[-------------------------------------------------------]
120  //[ Private data ]
121  //[-------------------------------------------------------]
122  private:
123  uint32 mDeadPersonsToFail;
124  uint64 mBuildingId;
125  uint64 mSalesman;
126  std::vector<uint64> mVictimIds;
127  std::vector<uint32> mVictimStates;
128  std::vector<float> mVictimWalkingAwayTime;
129  std::vector<float> mVictimWalkingAwayTimeThreshold;
130  uint32 mVictimCount;
131  uint32 mVictimsEat;
132  uint32 mVictimsIll;
133  bool mIsSalesmanEscaping;
134  float mHint08LifeEnergy;
135  bool mCanVictimsBecomeIll;
136 
137 
138  //[-------------------------------------------------------]
139  //[ CAMP reflection system ]
140  //[-------------------------------------------------------]
141  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
142 
143 
144  };
145 
146 
147 //[-------------------------------------------------------]
148 //[ Namespace ]
149 //[-------------------------------------------------------]
150 } // em5
151 
152 
153 //[-------------------------------------------------------]
154 //[ CAMP reflection system ]
155 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Emergency 5 freeplay event "fair visitors with food poisoning" 13.2.
Definition: FairVisitorsWithFoodPoisoningEvent.h:30
static const uint32 FREEPLAY_EVENT_ID
"em5::FairVisitorsWithFoodPoisoningEvent" unique freeplay event ID
Definition: FairVisitorsWithFoodPoisoningEvent.h:38
Reason
Definition: EventSpreadReason.h:20
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
EMERGENCY 5 objective list class.
Definition: ObjectiveList.h:32
Binary serializer class.
Definition: BinarySerializer.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32