Emergency 20 Dokumentation  4.2.0
BuildingOverlayData.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 //[-------------------------------------------------------]
15 
16 
17 //[-------------------------------------------------------]
18 //[ Namespace ]
19 //[-------------------------------------------------------]
20 namespace em5
21 {
22  namespace multiplayer
23  {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
33  class BuildingOverlayData: public DataCacheComponentExistenceTrackingBase<BuildingOverlayComponent>
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public methods ]
39  //[-------------------------------------------------------]
40  public:
41  BuildingOverlayData(const qsf::Entity& targetEntity);
42  virtual ~BuildingOverlayData();
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public virtual em5::multiplayer::DataCacheBase methods ]
47  //[-------------------------------------------------------]
48  public:
49  virtual bool prepareForUpdate(const qsf::Entity& targetEntity, const qsf::Clock& clock) override;
50  virtual void updateData(qsf::game::BitStream& bitStream, bool force) override;
51  virtual void setData(const qsf::game::BitStream& bitStream, const int32 receivedHostTickCount) override;
52  virtual void interpolate(qsf::Entity& targetEntity, const qsf::Clock& clock, const int32 receivedHostTickCount) override;
53 
54 
55  //[-------------------------------------------------------]
56  //[ Private data ]
57  //[-------------------------------------------------------]
58  private:
59  struct Provider
60  {
61  bool mEntityIdChanged;
63  bool mProgressChanged;
64  uint8 mProgress;
65 
66  inline Provider() :
67  mEntityIdChanged(false),
68  mEntityId(qsf::getUninitialized<uint64>()),
69  mProgressChanged(false),
70  mProgress(0)
71  {
72  // Nothing to do in here
73  }
74  };
75 
76  bool mRegisteredProvidersChanged;
77  std::vector<uint64> mUnregisteredProviderEntityIds;
78  std::vector<Provider> mRegisteredProviders;
79  bool mNumberOfRequiredProvidersChanged;
80  uint8 mNumberOfRequiredProviders;
81 
82  struct HistoryEntry
83  {
84  int32 tickCount;
85  bool mRegisteredProvidersChanged;
86  std::vector<uint64> mUnregisteredProviderEntityIds;
87  std::vector<Provider> mRegisteredProviders;
88  bool mNumberOfRequiredProvidersChanged;
89  uint8 mNumberOfRequiredProviders;
90  };
91 
92  std::vector<HistoryEntry> mHistoryList;
93 
94 
95  };
96 
97 
98 //[-------------------------------------------------------]
99 //[ Namespace ]
100 //[-------------------------------------------------------]
101  } // multiplayer
102 } // em5
Definition: ActionPriority.h:13
EMERGENCY 5 entity with a building overlay component data cache for a single entity for multiplayer...
Definition: BuildingOverlayData.h:33
Entity class.
Definition: Entity.h:46
Clock class.
Definition: Clock.h:33
uint64_t uint64
Definition: PlatformTypes.h:184
virtual void updateData(qsf::game::BitStream &bitStream, bool force) override
Updates the cache and writes any changed data to the given bit stream.
virtual void interpolate(qsf::Entity &targetEntity, const qsf::Clock &clock, const int32 receivedHostTickCount) override
Does any interpolation steps needed to apply the cached data to the entity.
Game bit stream class (just a wrapper for linnet bit stream)
Definition: BitStream.h:40
virtual bool prepareForUpdate(const qsf::Entity &targetEntity, const qsf::Clock &clock) override
Prepares for an update.
signed int int32
Definition: PlatformTypes.h:180
EMERGENCY 5 multiplayer data cache base class which tracks component existence.
Definition: DataCacheComponentExistenceTrackingBase.h:36
BuildingOverlayData(const qsf::Entity &targetEntity)
virtual void setData(const qsf::game::BitStream &bitStream, const int32 receivedHostTickCount) override
Reads the data from the bit stream.
uint64 mEntityId
Definition: DataCacheBase.h:106
unsigned char uint8
Definition: PlatformTypes.h:175