Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 63faa88

Browse files
committed
Fix several compiler warnings
1 parent 2e5c64d commit 63faa88

File tree

20 files changed

+98
-52
lines changed

20 files changed

+98
-52
lines changed

src/libs/animation/src/animation_imp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ void AnimationImp::BuildAnimationMatrices()
240240

241241
// Auto normalization
242242
if (normBlend != 0.0f)
243+
{
243244
if (plCnt > 1)
244245
{
245246
normBlend = 1.0f / normBlend;
@@ -381,6 +382,7 @@ void AnimationImp::BuildAnimationMatrices()
381382
// for(int32_t j = 0; j < nbones; j++)
382383
// aniInfo->GetBone(j).BlendFrame(frame);
383384
}
385+
}
384386
for (int32_t j = 0; j < nbones; j++)
385387
{
386388
auto &bn = aniInfo->GetBone(j);

src/libs/battle_interface/src/battle_command.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ void BICommandList::Init()
272272
sscanf(pAList->GetAttribute("CommandNoteOffset"), "%d,%d", &m_NoteOffset.x, &m_NoteOffset.y);
273273

274274
// Setting values for arrows (up / down)
275-
if (attr = pAList->GetAttribute("UDArrow_Texture"))
275+
attr = pAList->GetAttribute("UDArrow_Texture");
276+
if (attr)
276277
m_sUpDownArrowTexture = attr;
277278
BIUtils::ReadRectFromAttr(pAList, "UDArrow_UV_Up", m_frUpArrowUV, m_frUpArrowUV);
278279
BIUtils::ReadRectFromAttr(pAList, "UDArrow_UV_Down", m_frDownArrowUV, m_frDownArrowUV);
@@ -283,7 +284,8 @@ void BICommandList::Init()
283284
BIUtils::ReadPosFromAttr(pAList, "UDArrow_Offset_Down", m_pntDownArrowOffset.x, m_pntDownArrowOffset.y,
284285
m_pntDownArrowOffset.x, m_pntDownArrowOffset.y);
285286

286-
if (attr = pAList->GetAttribute("LRArrow_Texture"))
287+
attr = pAList->GetAttribute("LRArrow_Texture");
288+
if (attr)
287289
m_sLeftRightArrowTexture = attr;
288290
BIUtils::ReadRectFromAttr(pAList, "LRArrow_UV_Left", m_frLeftArrowUV, m_frLeftArrowUV);
289291
BIUtils::ReadRectFromAttr(pAList, "LRArrow_UV_Right", m_frRightArrowUV, m_frRightArrowUV);
@@ -295,15 +297,17 @@ void BICommandList::Init()
295297
m_pntRightArrowOffset.x, m_pntRightArrowOffset.y);
296298

297299
// set values for the menu activity icon
298-
if (attr = pAList->GetAttribute("ActiveIcon_Texture"))
300+
attr = pAList->GetAttribute("ActiveIcon_Texture");
301+
if (attr)
299302
m_sActiveIconTexture = attr;
300303
BIUtils::ReadPosFromAttr(pAList, "ActiveIcon_Offset", m_pntActiveIconOffset.x, m_pntActiveIconOffset.y,
301304
m_pntActiveIconOffset.x, m_pntActiveIconOffset.y);
302305
BIUtils::ReadPosFromAttr(pAList, "ActiveIcon_Size", m_pntActiveIconSize.x, m_pntActiveIconSize.y,
303306
m_pntActiveIconSize.x, m_pntActiveIconSize.y);
304307
BIUtils::ReadRectFromAttr(pAList, "ActiveIcon_UV1", m_frActiveIconUV1, m_frActiveIconUV1);
305308
BIUtils::ReadRectFromAttr(pAList, "ActiveIcon_UV2", m_frActiveIconUV2, m_frActiveIconUV2);
306-
if (attr = pAList->GetAttribute("ActiveIcon_Note"))
309+
attr = pAList->GetAttribute("ActiveIcon_Note");
310+
if (attr)
307311
m_sActiveIconNote = attr;
308312
}
309313

src/libs/battle_interface/src/battle_sign.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ void BISignIcon::Init(ATTRIBUTES *pRoot, ATTRIBUTES *pA)
164164

165165
pcTmp = pA->GetAttribute("fontoffset");
166166
if (pcTmp)
167-
sscanf(pcTmp, "%ld,%ld", &m_SignTextFontOffset.x, &m_SignTextFontOffset.y);
167+
{
168+
long x{}, y{};
169+
sscanf(pcTmp, "%ld,%ld", &x, &y);
170+
m_SignTextFontOffset = {x, y};
171+
}
168172

169173
pcTmp = pA->GetAttribute("backtexturename");
170174
if (pcTmp)

src/libs/battle_interface/src/item_entity/item_entity.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ bool ItemEntity::Init()
2626
void ItemEntity::Realize(uint32_t delta_time)
2727
{
2828
if (m_bVisible && m_pModel)
29+
{
2930
if (m_bTieToLocator)
31+
{
3032
DrawIntoLocator();
33+
}
3134
else
35+
{
3236
m_pModel->ProcessStage(Stage::realize, delta_time);
37+
}
38+
}
3339
}
3440

3541
uint64_t ItemEntity::ProcessMessage(MESSAGE &message)
@@ -107,7 +113,8 @@ bool ItemEntity::ReadAndCreate()
107113
auto *const pcTechnique = BIUtils::GetStringFromAttr(AttributesPointer, "technique", "");
108114
if (pcModelName)
109115
{
110-
if (m_eidModel = core.CreateEntity("modelr"))
116+
m_eidModel = core.CreateEntity("modelr");
117+
if (m_eidModel)
111118
{
112119
core.Send_Message(m_eidModel, "ls", MSG_MODEL_LOAD_GEO, pcModelName);
113120
m_pModel = static_cast<MODEL *>(core.GetEntityPointer(m_eidModel));

src/libs/battle_interface/src/sea/battle_ship_sign.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ void BIShipIcon::Init(ATTRIBUTES *pRoot, ATTRIBUTES *pA)
195195
// ugeen 150920
196196
pcTmp = pA->GetAttribute("sailorfontoffset");
197197
if (pcTmp)
198-
sscanf(pcTmp, "%ld,%ld", &m_SailorFontOffset.x, &m_SailorFontOffset.y);
198+
{
199+
long x{}, y{};
200+
sscanf(pcTmp, "%ld,%ld", &x, &y);
201+
m_SailorFontOffset = {x, y};
202+
}
199203

200204
pcTmp = pA->GetAttribute("shipnamefontid");
201205
if (pcTmp)
@@ -205,7 +209,11 @@ void BIShipIcon::Init(ATTRIBUTES *pRoot, ATTRIBUTES *pA)
205209

206210
pcTmp = pA->GetAttribute("shipnamefontoffset");
207211
if (pcTmp)
208-
sscanf(pcTmp, "%ld,%ld", &m_ShipNameFontOffset.x, &m_ShipNameFontOffset.y);
212+
{
213+
long x{}, y{};
214+
sscanf(pcTmp, "%ld,%ld", &x, &y);
215+
m_ShipNameFontOffset = {x, y};
216+
}
209217

210218
pcTmp = pA->GetAttribute("backtexturename");
211219
if (pcTmp)

src/libs/battle_interface/src/sea/island_descr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ void ISLAND_DESCRIBER::SetIsland(ATTRIBUTES *pAIsland)
6565
{
6666
int32_t lTmp;
6767
if (pvdat->Get(lTmp, 0))
68+
{
6869
if (lTmp == 0)
6970
m_pLocators[i].locatorType = ISLAND_LOCATOR_LAND;
7071
else if (lTmp == 1)
7172
m_pLocators[i].locatorType = ISLAND_LOCATOR_FORT;
7273
else
7374
m_pLocators[i].locatorType = ISLAND_LOCATOR_TOWN;
75+
}
7476
if (pvdat->Get(lTmp, 1))
7577
m_pLocators[i].relation = lTmp;
7678
if (pvdat->Get(lTmp, 2))

src/libs/blot/src/blots.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ uint64_t Blots::ProcessMessage(MESSAGE &message)
7676
if (pCharAttributeRoot)
7777
{
7878
blotsInfo = pCharAttributeRoot->CreateSubAClass(pCharAttributeRoot, "ship.blots");
79-
char buf[32];
80-
sprintf_s(buf, "%i", BLOTS_MAX);
81-
blotsInfo->SetValue(buf);
79+
blotsInfo->SetValue(std::to_string(BLOTS_MAX));
8280
for (int32_t i = 0; i < BLOTS_MAX; i++)
8381
LoadBlot(i);
8482
}

src/libs/core/src/core_impl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
class CoreImpl final : public CorePrivate
1414
{
1515
public:
16-
void Init();
16+
void Init() override;
1717

18-
void InitBase();
19-
void ReleaseBase();
18+
void InitBase() override;
19+
void ReleaseBase() override;
2020

21-
void CleanUp();
21+
void CleanUp() override;
2222

2323
void SetWindow(std::shared_ptr<storm::OSWindow> window) override;
2424
bool Initialize();
2525
void ResetCore();
26-
bool Run();
26+
bool Run() override;
2727
bool LoadClassesTable();
2828

2929
void ProcessExecute();
@@ -43,7 +43,7 @@ class CoreImpl final : public CorePrivate
4343
void EraseEntities();
4444
void ClearEvents();
4545
void *MakeClass(const char *class_name);
46-
void AppState(bool state);
46+
void AppState(bool state) override;
4747
uint32_t MakeHashValue(const char *string);
4848
VMA *FindVMA(const char *class_name);
4949
VMA *FindVMA(int32_t hash);
@@ -133,9 +133,9 @@ class CoreImpl final : public CorePrivate
133133
bool IsLayerFrozen(layer_index_t index) const override;
134134
void ForEachEntity(const std::function<void(entptr_t)>& f) override;
135135

136-
void collectCrashInfo() const;
136+
void collectCrashInfo() const override;
137137

138-
[[nodiscard]] bool initialized() const
138+
[[nodiscard]] bool initialized() const override
139139
{
140140
return Initialized;
141141
}

src/libs/core/src/data.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ void DATA::Set(const char *attribute_name, const char *attribute_value)
402402
return;
403403
}
404404

405-
AttributesClass = new ATTRIBUTES(pVCompiler->GetVSC());
405+
AttributesClass = new ATTRIBUTES(*pVCompiler->GetVSC());
406406
}
407-
AttributesClass->SetAttribute(attribute_name, attribute_value);
407+
AttributesClass->SetAttribute(std::string_view(attribute_name), std::string_view(attribute_value));
408408
// Attributes.SetAttribute(attribute_name,attribute_value);
409409
}
410410

@@ -2357,7 +2357,7 @@ ATTRIBUTES *DATA::GetAClass()
23572357
return nullptr;
23582358
}
23592359

2360-
AttributesClass = new ATTRIBUTES(pVCompiler->GetVSC());
2360+
AttributesClass = new ATTRIBUTES(*pVCompiler->GetVSC());
23612361
}
23622362
return AttributesClass;
23632363
}

src/libs/core/src/message.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#pragma once
2-
31
#include "message.h"
42

53
#include <algorithm>

0 commit comments

Comments
 (0)