Skip to content

Commit 9e56983

Browse files
committed
xrGame: fixed some compiler warnings
Also added some comments
1 parent 6306bda commit 9e56983

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/xrGame/PhysicsShellHolder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void CPhysicsShellHolder::net_Destroy()
7575
xr_delete(m_pPhysicsShell);
7676
}
7777

78-
static enum EEnableState { stEnable = 0, stDisable, stNotDefitnite };
78+
enum EEnableState { stEnable = 0, stDisable, stNotDefitnite }; // stNotDefitnite? Possibly mistaken name
7979
static u8 st_enable_state = (u8)stNotDefitnite;
8080
BOOL CPhysicsShellHolder::net_Spawn(CSE_Abstract* DC)
8181
{

src/xrGame/WeaponBinocularsVision.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void SBinocVisibleObj::Draw()
7373

7474
void SBinocVisibleObj::Update()
7575
{
76-
m_flags.set(flVisObjNotValid, TRUE);
76+
m_flags.set(flVisObjNotValid, true);
7777

7878
if (!m_object->Visual())
7979
return;
@@ -131,11 +131,11 @@ void SBinocVisibleObj::Update()
131131
if (mn.similar(cur_rect.lt, 2.f) && mx.similar(cur_rect.rb, 2.f))
132132
{
133133
// target locked
134-
m_flags.set(flTargetLocked, TRUE);
134+
m_flags.set(flTargetLocked, true);
135135
u32 clr = subst_alpha(m_lt.GetTextureColor(), 255);
136136

137137
//-----------------------------------------------------
138-
CActor* pActor = NULL;
138+
CActor* pActor = nullptr;
139139
if (IsGameTypeSingle())
140140
pActor = Actor();
141141
else
@@ -191,7 +191,7 @@ void SBinocVisibleObj::Update()
191191
m_rt.SetWndPos(Fvector2().set((cur_rect.rb.x), (cur_rect.lt.y)));
192192
m_rb.SetWndPos(Fvector2().set((cur_rect.rb.x), (cur_rect.rb.y)));
193193

194-
m_flags.set(flVisObjNotValid, FALSE);
194+
m_flags.set(flVisObjNotValid, false);
195195
}
196196

197197
CBinocularsVision::CBinocularsVision(const shared_str& sect) { Load(sect); }
@@ -201,7 +201,7 @@ void CBinocularsVision::Update()
201201
if (GEnv.isDedicatedServer)
202202
return;
203203
//-----------------------------------------------------
204-
const CActor* pActor = NULL;
204+
const CActor* pActor = nullptr;
205205
if (IsGameTypeSingle())
206206
pActor = Actor();
207207
else
@@ -218,7 +218,7 @@ void CBinocularsVision::Update()
218218

219219
VIS_OBJECTS_IT it = m_active_objects.begin();
220220
for (; it != m_active_objects.end(); ++it)
221-
(*it)->m_flags.set(flVisObjNotValid, TRUE);
221+
(*it)->m_flags.set(flVisObjNotValid, true);
222222

223223
CVisualMemoryManager::VISIBLES::const_iterator v_it = vVisibles.begin();
224224
for (; v_it != vVisibles.end(); ++v_it)
@@ -239,18 +239,18 @@ void CBinocularsVision::Update()
239239

240240
if (found != m_active_objects.end())
241241
{
242-
(*found)->m_flags.set(flVisObjNotValid, FALSE);
242+
(*found)->m_flags.set(flVisObjNotValid, false);
243243
}
244244
else
245245
{
246246
m_active_objects.push_back(new SBinocVisibleObj());
247247
SBinocVisibleObj* new_vis_obj = m_active_objects.back();
248-
new_vis_obj->m_flags.set(flVisObjNotValid, FALSE);
248+
new_vis_obj->m_flags.set(flVisObjNotValid, false);
249249
new_vis_obj->m_object = object_;
250250
new_vis_obj->create_default(m_frame_color.get());
251251
new_vis_obj->m_upd_speed = m_rotating_speed;
252252

253-
m_sounds.PlaySound("found_snd", Fvector().set(0, 0, 0), NULL, true);
253+
m_sounds.PlaySound("found_snd", Fvector().set(0, 0, 0), nullptr, true);
254254
}
255255
}
256256
std::sort(m_active_objects.begin(), m_active_objects.end());
@@ -266,12 +266,12 @@ void CBinocularsVision::Update()
266266
{
267267
SBinocVisibleObj* visObj = (*it);
268268

269-
BOOL bLocked = visObj->m_flags.test(flTargetLocked);
269+
const bool bLocked = visObj->m_flags.test(flTargetLocked);
270270

271271
(*it)->Update();
272272

273273
if (bLocked != visObj->m_flags.test(flTargetLocked))
274-
m_sounds.PlaySound("catch_snd", Fvector().set(0, 0, 0), NULL, true);
274+
m_sounds.PlaySound("catch_snd", Fvector().set(0, 0, 0), nullptr, true);
275275
}
276276
}
277277

src/xrGame/console_commands_mp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ class CCC_UnBanPlayerByIndex : public IConsole_Command
10101010
}
10111011
else
10121012
{
1013+
// size_t ????? u32 maybe?
10131014
size_t player_index = 0;
10141015
if (sscanf_s(args_, "%u", &player_index) != 1)
10151016
{

src/xrGame/inventory_item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CInventoryItem : public CAttachableItem,
104104
virtual void OnEvent(NET_Packet& P, u16 type);
105105

106106
virtual bool Useful() const; // !!! Переопределить. (см. в Inventory.cpp)
107-
virtual bool IsUsingCondition() const { return (m_flags.test(FUsingCondition) > 0); }
107+
virtual bool IsUsingCondition() const { return m_flags.test(FUsingCondition); }
108108
virtual bool Attach(PIItem pIItem, bool b_send_event) { return false; }
109109
virtual bool Detach(PIItem pIItem) { return false; }
110110
//при детаче спаунится новая вещь при заданно названии секции

src/xrGame/script_game_object3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ bool CScriptGameObject::IsBoneVisible(pcstr bone_name)
14271427
if (bone_id == BI_NONE)
14281428
return false;
14291429

1430-
return k->LL_GetBoneVisible(bone_id) == true ? true : false;
1430+
return k->LL_GetBoneVisible(bone_id);
14311431
}
14321432

14331433
float CScriptGameObject::GetLuminocityHemi()

src/xrGame/script_sound.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CScriptSound::CScriptSound(LPCSTR caSoundName, ESoundTypes sound_type)
2727

2828
CScriptSound::~CScriptSound()
2929
{
30+
// Compiler warning C4297: function assumed not to throw an exception but does.
3031
THROW3(!m_sound._feedback(), "playing sound is not completed, but is destroying",
3132
m_sound._handle() ? m_sound._handle()->file_name() : "unknown");
3233
m_sound.destroy();

src/xrPhysics/PHCharacter.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "xrServerEntities/PHSynchronize.h"
88
#include "PHDisabling.h"
99

10-
#include "xrEngine/iphysicsshell.h"
10+
#include "xrEngine/IPhysicsShell.h"
1111

1212
class IPhysicsShellHolder;
1313
class IClimableObject;
@@ -19,19 +19,17 @@ class CPHAICharacter;
1919
namespace ALife
2020
{
2121
enum EHitType;
22-
};
23-
static enum EEnvironment { peOnGround, peAtWall, peInAir };
22+
}
23+
enum EEnvironment { peOnGround, peAtWall, peInAir };
2424

2525
class CPHCharacter :
2626
public CPHObject,
2727
public CPHSynchronize,
2828
public CPHDisablingTranslational,
2929
public IPhysicsElement
30-
#if 0
31-
#ifdef DEBUG
30+
#if 0//def DEBUG
3231
,public pureRender
3332
#endif
34-
#endif
3533
{
3634
public:
3735
u64 m_creation_step;

0 commit comments

Comments
 (0)