Emergency 20 Dokumentation  4.2.0
ComplexFireComponent-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  //[-------------------------------------------------------]
15  FireReceiverComponent(prototype),
16  mFireState(FireComponent::FIRESTATE_NOFIRE),
17  mNumFireObjects(0),
18  mTotalDamage(0.0f),
19  mLastShownHitpointValue(qsf::getUninitialized<uint32>()),
20  mPrintedNoFireComponentsWarning(false),
21  FireEntityIdArray(*this, mEntityIds),
22  FireParticleIdArray(*this, mFireParticleEntityIds)
23  {
24  // Nothing to do in here
25  }
26 
28  {
29  // Nothing to do in here
30  }
31 
32 
33  //[-------------------------------------------------------]
34  //[ Public virtual qsf::FireReceiver methods ]
35  //[-------------------------------------------------------]
36  inline bool ComplexFireComponent::isBurning() const
37  {
38  return FireComponent::isBurningFireState(mFireState);
39  }
40 
41  inline bool ComplexFireComponent::isBurned() const
42  {
43  return (mFireState == FireComponent::FIRESTATE_DESTROYED || mFireComponents.empty());
44  }
45 
46 
47  //[-------------------------------------------------------]
48  //[ CAMP reflection system ]
49  //[-------------------------------------------------------]
50  inline std::size_t ComplexFireComponent::EntityIdArrayInterface::size() const
51  {
52  return getVariable().size();
53  }
54 
55  inline const uint64& ComplexFireComponent::EntityIdArrayInterface::get(std::size_t index) const
56  {
57  return getVariable()[index];
58  }
59 
60  inline void ComplexFireComponent::EntityIdArrayInterface::set(std::size_t index, const uint64& value)
61  {
62  getVariable()[index] = value;
63  // Array slot has changed update the fire particle assignments
64  // This is needed so that inside the editor the particles are controlled by the fire component state
65  getOwner().onFireAndFireParticleEntitiesSlotChanged();
66  }
67 
68  inline void ComplexFireComponent::EntityIdArrayInterface::insert(std::size_t before, const uint64& value)
69  {
70  getVariable().insert(getVariable().begin() + before, value);
71  // Array slot has changed update the fire particle assignments
72  // This is needed so that inside the editor the particles are controlled by the fire component state
73  getOwner().onFireAndFireParticleEntitiesSlotChanged();
74  }
75 
76  inline void ComplexFireComponent::EntityIdArrayInterface::remove(std::size_t index)
77  {
78  getVariable().erase(getVariable().begin() + index);
79  // Array slot has changed update the fire particle assignments
80  // This is needed so that inside the editor the particles are controlled by the fire component state
81  getOwner().onFireAndFireParticleEntitiesSlotChanged();
82  }
83 
84 
85 //[-------------------------------------------------------]
86 //[ Namespace ]
87 //[-------------------------------------------------------]
88 } // em5
Definition: ActionPriority.h:13
virtual bool isBurning() const override
Return true if the fire is active, in this case the fire will charge by themself. ...
Definition: ComplexFireComponent-inl.h:36
Entity is not burning, but completely destroyed by fire; it can't start burning again because there's...
Definition: FireComponent.h:93
virtual bool isBurned() const override
Return "true" if the total amount of material energy is used; in this case the fire is over...
Definition: ComplexFireComponent-inl.h:41
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 fire receiver component class.
Definition: FireReceiverComponent.h:69
ComplexFireComponent(qsf::Prototype *prototype)
Constructor.
Definition: ComplexFireComponent-inl.h:14
EMERGENCY 5 fire component class.
Definition: FireComponent.h:64
uint64_t uint64
Definition: PlatformTypes.h:184
Definition: PickupPersonByParamedicAction.h:21
T getUninitialized()
Definition: GetUninitialized.h:38
static bool isBurningFireState(FireState fireState)
Definition: FireComponent-inl.h:14
virtual ~ComplexFireComponent()
Destructor.
Definition: ComplexFireComponent-inl.h:27
Prototype class.
Definition: Prototype.h:100