Emergency 20 Dokumentation  4.2.0
FireMaterial-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  mFireMaterialId(key),
16  mCombustionsValue(100.0f),
17  mBurnTime(qsf::Time::fromSeconds(1.0f)),
18  mStartEnergyValue(0.0f),
19  mMaxEnergyValue(100.0f),
20  mChargeTime(qsf::Time::fromSeconds(1.0f)),
21  mSelfCoolingValue(10.0f),
22  mFireResistance(0.0f),
23  mBlastForce(0.0f),
24  mBlastRadius(0.0f)
25  {
26  // Nothing to do in here
27  }
28 
30  {
31  // Nothing to do in here
32  }
33 
35  {
36  return mFireMaterialId;
37  }
38 
40  {
41  mFireMaterialId = id;
42  }
43 
44  inline const std::string& FireMaterial::getName() const
45  {
46  return mName;
47  }
48 
49  inline void FireMaterial::setName(const std::string& name)
50  {
51  mName = name;
52  }
53 
54  inline float FireMaterial::getCombustionValue() const
55  {
56  return mCombustionsValue;
57  }
58 
59  inline void FireMaterial::setCombustionValue(float combustionValue)
60  {
61  mCombustionsValue = combustionValue;
62  }
63 
65  {
66  return mBurnTime;
67  }
68 
69  inline void FireMaterial::setBurnTime(qsf::Time burnTime)
70  {
71  // The new burn time must be greater than the charge time
72  mBurnTime = (burnTime > mChargeTime) ? burnTime : mChargeTime;
73  }
74 
75  inline float FireMaterial::getStartEnergyValue() const
76  {
77  return mStartEnergyValue;
78  }
79 
80  inline void FireMaterial::setStartEnergyValue(float startEnergyValue)
81  {
82  mStartEnergyValue = startEnergyValue;
83  }
84 
85  inline float FireMaterial::getMaxEnergyValue() const
86  {
87  return mMaxEnergyValue;
88  }
89 
90  inline void FireMaterial::setMaxEnergyValue(float maxEnergyValue)
91  {
92  mMaxEnergyValue = maxEnergyValue;
93  // TODO(mk) recalculate life value, and chargevalue because its depends
94  }
95 
97  {
98  return mChargeTime;
99  }
100 
101  inline void FireMaterial::setChargeTime(qsf::Time chargeTime)
102  {
103  mChargeTime = chargeTime;
104  }
105 
106  inline float FireMaterial::getChargeValue() const
107  {
108  // We don't keep this value as member, we calculate it on the fly
109  return (mMaxEnergyValue - mStartEnergyValue) / mChargeTime.getSeconds();
110  }
111 
112  inline void FireMaterial::setChargeValue(float chargeValue)
113  {
114  // TODO(mk) temporary the setter is disabled
115  // ChargeTime and ChargeValue are the same Value in different display, chargeValue is no member
116  setChargeTime(qsf::Time::fromSeconds(mMaxEnergyValue/chargeValue));
117  }
118 
120  {
121  return mSelfCoolingValue;
122  }
123 
124  inline void FireMaterial::setSelfCoolingValue(float selfCoolingValue)
125  {
126  mSelfCoolingValue = selfCoolingValue;
127  }
128 
129  inline float FireMaterial::getFireResistance() const
130  {
131  return mFireResistance;
132  }
133 
134  inline void FireMaterial::setFireResistance(float fireResistance)
135  {
136  mFireResistance = fireResistance;
137  }
138 
139  inline float FireMaterial::getBlastForce() const
140  {
141  return mBlastForce;
142  }
143 
144  inline void FireMaterial::setBlastForce(float blastForce)
145  {
146  mBlastForce = blastForce;
147  }
148 
149  inline float FireMaterial::getBlastRadius() const
150  {
151  return mBlastRadius;
152  }
153 
154  inline void FireMaterial::setBlastRadius(float blastRadius)
155  {
156  mBlastRadius = blastRadius;
157  }
158 
159  inline bool FireMaterial::canExplode() const
160  {
161  return (mBlastForce > 0.0f && mBlastRadius > 0.0f);
162  }
163 
164 
165 //[-------------------------------------------------------]
166 //[ Namespace ]
167 //[-------------------------------------------------------]
168 } // em5
Definition: ActionPriority.h:13
bool canExplode() const
Check whether this material can explode at all.
Definition: FireMaterial-inl.h:159
void setFireResistance(float fireResistance)
Set the fire resistance value, amount of energy is substracted of receiving energy.
Definition: FireMaterial-inl.h:134
void setBlastRadius(float blastRadius)
Set the blast radius, entities in the radius receive the blast force value in case of a combustion...
Definition: FireMaterial-inl.h:154
unsigned int uint32
Definition: PlatformTypes.h:181
float getMaxEnergyValue() const
Get the maximum energy a fire can have.
Definition: FireMaterial-inl.h:85
float getSeconds() const
Definition: Time-inl.h:127
virtual ~FireMaterial()
Destructor.
Definition: FireMaterial-inl.h:29
void setBlastForce(float blastForce)
Set the blast force value, amount of energy is given to entities in the blast radius in case of explo...
Definition: FireMaterial-inl.h:144
void setChargeTime(qsf::Time chargeTime)
Set the time the fire needs to grow to his maxium energy value.
Definition: FireMaterial-inl.h:101
float getSelfCoolingValue() const
Get the self cooling value, amount of energy the fire shrinks in case of an extinguished fire...
Definition: FireMaterial-inl.h:119
float getBlastForce() const
Get the blast force value, amount of energy is given to entities in the blast radius in case of explo...
Definition: FireMaterial-inl.h:139
float getBlastRadius() const
Get the blast radius, entities in the radius receive the blast force value in case of a combustion...
Definition: FireMaterial-inl.h:149
void setChargeValue(float chargeValue)
Set the value the fire grows per second (eg. "5")
Definition: FireMaterial-inl.h:112
Definition: PickupPersonByParamedicAction.h:21
void setBurnTime(qsf::Time burnTime)
Set the burn time, the time the entity burns after start fire and no other touching.
Definition: FireMaterial-inl.h:69
void setStartEnergyValue(float startEnergyValue)
Set the start energy value, the amount of energy the fire starts with.
Definition: FireMaterial-inl.h:80
void setCombustionValue(float combustionValue)
Set the combustion value, if this value is reached, the fire starts burning.
Definition: FireMaterial-inl.h:59
void setName(const std::string &name)
Set name of the fire material.
Definition: FireMaterial-inl.h:49
float getFireResistance() const
Get the fire resistance value, amount of energy is substracted of receiving energy.
Definition: FireMaterial-inl.h:129
qsf::Time getBurnTime() const
Get the burn time, the time the entity burns after start fire and no other touching.
Definition: FireMaterial-inl.h:64
float getCombustionValue() const
Get the combustion value, if this value is reached, the fire starts burning.
Definition: FireMaterial-inl.h:54
void setFireMaterialId(uint32 id)
Set fire material ID.
Definition: FireMaterial-inl.h:39
static Time fromSeconds(float seconds)
Definition: Time-inl.h:74
uint32 getFireMaterialId() const
Get unique fire material ID.
Definition: FireMaterial-inl.h:34
void setSelfCoolingValue(float selfCoolingValue)
Set the self cooling value, amount of energy the fire shrinks in case of an extinguished fire...
Definition: FireMaterial-inl.h:124
qsf::Time getChargeTime() const
Get the time the fire needs to grow to his maximum energy value.
Definition: FireMaterial-inl.h:96
float getStartEnergyValue() const
Get the start energy value, the amount of energy the fire starts with.
Definition: FireMaterial-inl.h:75
void setMaxEnergyValue(float maxEnergyValue)
Set the maximum energy a fire can have.
Definition: FireMaterial-inl.h:90
float getChargeValue() const
Get the value the fire grows per second (eg. "5")
Definition: FireMaterial-inl.h:106
FireMaterial(uint32 key)
Constructor.
Definition: FireMaterial-inl.h:14
const std::string & getName() const
Get name of the fire material.
Definition: FireMaterial-inl.h:44
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32