chore: KDIS datatypes
[KDIS.git] / KDIS / DataTypes / GuidedMunitionsAppearance.cpp
blob1091bd1e517ab6e62d7fe52e96e0122795d1b95c
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 #include "./GuidedMunitionsAppearance.h"
32 using namespace KDIS;
33 using namespace DATA_TYPE;
34 using namespace ENUMS;
36 //////////////////////////////////////////////////////////////////////////
37 // Public:
38 //////////////////////////////////////////////////////////////////////////
40 void GuidedMunitionsAppearance::SetEntityDamage( EntityDamage ED )
42 m_Damage = ED;
45 //////////////////////////////////////////////////////////////////////////
47 EntityDamage GuidedMunitionsAppearance::GetEntityDamage() const
49 return ( EntityDamage )m_Damage;
52 //////////////////////////////////////////////////////////////////////////
54 void GuidedMunitionsAppearance::SetEntitySmoke( EntitySmoke ES )
56 m_Smoke = ES;
59 //////////////////////////////////////////////////////////////////////////
61 EntitySmoke GuidedMunitionsAppearance::GetEntitySmoke() const
63 return ( EntitySmoke )m_Smoke;
66 //////////////////////////////////////////////////////////////////////////
68 void GuidedMunitionsAppearance::SetEntityTrailingEffect( EntityTrailingEffect ETE )
70 m_TrailingEffect = ETE;
73 //////////////////////////////////////////////////////////////////////////
75 EntityTrailingEffect GuidedMunitionsAppearance::GetEntityTrailingEffect() const
77 return ( EntityTrailingEffect )m_TrailingEffect;
80 //////////////////////////////////////////////////////////////////////////
82 void GuidedMunitionsAppearance::SetEntityFlamingEffect( KBOOL EFE )
84 m_FlamingEffectField = EFE;
87 //////////////////////////////////////////////////////////////////////////
89 KBOOL GuidedMunitionsAppearance::IsEntityFlaming() const
91 return m_FlamingEffectField;
94 //////////////////////////////////////////////////////////////////////////
96 void GuidedMunitionsAppearance::SetLaunchFlashPresent( KBOOL LF )
98 m_LaunchFlash = LF;
101 //////////////////////////////////////////////////////////////////////////
103 KBOOL GuidedMunitionsAppearance::IsLaunchFlashPresent() const
105 return m_LaunchFlash;
108 //////////////////////////////////////////////////////////////////////////
110 void GuidedMunitionsAppearance::SetEntityFrozenStatus( KBOOL EFS )
112 m_FrozenStatus = EFS;
115 //////////////////////////////////////////////////////////////////////////
117 KBOOL GuidedMunitionsAppearance::IsEntityFrozen() const
119 return m_FrozenStatus;
122 //////////////////////////////////////////////////////////////////////////
124 void GuidedMunitionsAppearance::SetEntityPowerPlantOn( KBOOL EPPS )
126 m_PowerPlantStatus = EPPS;
129 //////////////////////////////////////////////////////////////////////////
131 KBOOL GuidedMunitionsAppearance::IsEntityPowerPlantOn() const
133 return m_PowerPlantStatus;
136 //////////////////////////////////////////////////////////////////////////
138 void GuidedMunitionsAppearance::SetEntityStateActive( KBOOL ES )
140 m_State = !ES;
143 //////////////////////////////////////////////////////////////////////////
145 KBOOL GuidedMunitionsAppearance::IsEntityStateActive() const
147 return !m_State;
150 //////////////////////////////////////////////////////////////////////////
152 void GuidedMunitionsAppearance::SetCoverShroudStatus( CoverShroudStatus CSS )
154 m_CoverShroudStatus = CSS;
157 //////////////////////////////////////////////////////////////////////////
159 CoverShroudStatus GuidedMunitionsAppearance::GetCoverShroudStatus() const
161 return static_cast<CoverShroudStatus>(m_CoverShroudStatus);
164 //////////////////////////////////////////////////////////////////////////
166 void GuidedMunitionsAppearance::SetMaskedCloaked( KBOOL MC )
168 m_MaskedCloaked = MC;
171 //////////////////////////////////////////////////////////////////////////
173 KBOOL GuidedMunitionsAppearance::IsMaskedCloaked() const
175 return m_MaskedCloaked;
178 //////////////////////////////////////////////////////////////////////////
180 KString GuidedMunitionsAppearance::GetAsString() const
182 KStringStream ss;
184 ss << "Guided Munitions Appearance:"
185 << "\n\tDamage: " << GetEnumAsStringEntityDamage( m_Damage )
186 << "\n\tSmoke: " << GetEnumAsStringEntitySmoke( m_Smoke )
187 << "\n\tTrailing Effect: " << GetEnumAsStringEntityTrailingEffect( m_TrailingEffect )
188 << "\n\tFlaming Effect: " << m_FlamingEffectField
189 << "\n\tLaunch Flash: " << m_LaunchFlash
190 << "\n\tFrozen Status: " << m_FrozenStatus
191 << "\n\tPower Plant: " << m_PowerPlantStatus
192 << "\n\tState: " << m_State
193 << "\n\tCover/Shroud Status: " << GetEnumAsStringCoverShroudStatus( m_CoverShroudStatus )
194 << "\n\tMasked/Cloaked: " << m_MaskedCloaked
195 << "\n";
197 return ss.str();
200 //////////////////////////////////////////////////////////////////////////
202 KBOOL GuidedMunitionsAppearance::operator == ( const GuidedMunitionsAppearance & Value ) const
204 // Lets do a single comparison instead of checking every field.
205 // This struct is basically a KUINT32 so lets cast it to one and compare.
207 KUINT32 a = *( KUINT32 * )this;
208 KUINT32 b = *( KUINT32 * )&Value;
210 if( a != b )return false;
211 return true;
214 //////////////////////////////////////////////////////////////////////////
216 KBOOL GuidedMunitionsAppearance::operator != ( const GuidedMunitionsAppearance & Value ) const
218 return !( *this == Value );
221 //////////////////////////////////////////////////////////////////////////