Skip to content

Commit cc37fda

Browse files
committed
Server: Fix numerous Clang warnings
1 parent b8e7628 commit cc37fda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+625
-950
lines changed

Server/AIServer/AIServer.vcxproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,13 @@
139139
<ClCompile Include="AISocketManager.cpp" />
140140
<ClCompile Include="GameSocket.cpp" />
141141
<ClCompile Include="MagicProcess.cpp" />
142-
<ClCompile Include="MAP.cpp" />
142+
<ClCompile Include="Map.cpp" />
143143
<ClCompile Include="Npc.cpp" />
144144
<ClCompile Include="NpcItem.cpp" />
145145
<ClCompile Include="NpcMagicProcess.cpp" />
146146
<ClCompile Include="NpcThread.cpp" />
147147
<ClCompile Include="Party.cpp" />
148148
<ClCompile Include="PathFind.cpp" />
149-
<ClCompile Include="Region.cpp" />
150149
<ClCompile Include="RoomEvent.cpp" />
151150
<ClCompile Include="SendThreadMain.cpp" />
152151
<ClCompile Include="AIServer.cpp" />
@@ -164,7 +163,7 @@
164163
<ClInclude Include="Extern.h" />
165164
<ClInclude Include="GameSocket.h" />
166165
<ClInclude Include="MagicProcess.h" />
167-
<ClInclude Include="MAP.h" />
166+
<ClInclude Include="Map.h" />
168167
<ClInclude Include="Npc.h" />
169168
<ClInclude Include="NpcItem.h" />
170169
<ClInclude Include="NpcMagicProcess.h" />

Server/AIServer/AIServer.vcxproj.filters

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ClCompile Include="MagicProcess.cpp">
2121
<Filter>Source Files</Filter>
2222
</ClCompile>
23-
<ClCompile Include="MAP.cpp">
23+
<ClCompile Include="Map.cpp">
2424
<Filter>Source Files</Filter>
2525
</ClCompile>
2626
<ClCompile Include="Npc.cpp">
@@ -41,9 +41,6 @@
4141
<ClCompile Include="PathFind.cpp">
4242
<Filter>Source Files</Filter>
4343
</ClCompile>
44-
<ClCompile Include="Region.cpp">
45-
<Filter>Source Files</Filter>
46-
</ClCompile>
4744
<ClCompile Include="RoomEvent.cpp">
4845
<Filter>Source Files</Filter>
4946
</ClCompile>
@@ -85,7 +82,7 @@
8582
<ClInclude Include="MagicProcess.h">
8683
<Filter>Header Files</Filter>
8784
</ClInclude>
88-
<ClInclude Include="MAP.h">
85+
<ClInclude Include="Map.h">
8986
<Filter>Header Files</Filter>
9087
</ClInclude>
9188
<ClInclude Include="Npc.h">

Server/AIServer/AIServerApp.cpp

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ void AIServerApp::AllNpcInfo()
10201020
int nZone = 0;
10211021
int size = _npcMap.GetSize();
10221022

1023-
int send_index = 0, zone_index = 0, packet_size = 0;
1023+
int send_index = 0;
10241024
int count = 0, send_count = 0, send_tot = 0;
10251025
char send_buff[2048] = {};
10261026

@@ -1036,9 +1036,8 @@ void AIServerApp::AllNpcInfo()
10361036
SetByte(send_buff, AG_SERVER_INFO, send_index);
10371037
SetByte(send_buff, SERVER_INFO_START, send_index);
10381038
SetByte(send_buff, nZone, send_index);
1039-
packet_size = Send(send_buff, send_index, nZone);
1039+
Send(send_buff, send_index, nZone);
10401040

1041-
zone_index = GetZoneIndex(nZone);
10421041
send_index = 2;
10431042
count = 0;
10441043
send_count = 0;
@@ -1077,9 +1076,10 @@ void AIServerApp::AllNpcInfo()
10771076
send_count = 0;
10781077
count = 0;
10791078
send_tot++;
1080-
//TRACE(_T("AllNpcInfo - send_count=%d, count=%d, zone=%d\n"), send_tot, count, nZone);
1079+
spdlog::trace("AIServerApp::AllNpcInfo: send_count={}, count={}, zone={}",
1080+
send_tot, count, nZone);
10811081
memset(send_buff, 0, sizeof(send_buff));
1082-
Sleep(50);
1082+
std::this_thread::sleep_for(50ms);
10831083
}
10841084
}
10851085

@@ -1092,8 +1092,9 @@ void AIServerApp::AllNpcInfo()
10921092
SetByte(send_buff, (uint8_t) count, send_count);
10931093
Send(send_buff, send_index, nZone);
10941094
send_tot++;
1095-
//TRACE(_T("AllNpcInfo - send_count=%d, count=%d, zone=%d\n"), send_tot, count, nZone);
1096-
Sleep(50);
1095+
spdlog::trace("AIServerApp::AllNpcInfo: send_count={}, count={}, zone={}",
1096+
send_tot, count, nZone);
1097+
std::this_thread::sleep_for(50ms);
10971098
}
10981099

10991100
send_index = 0;
@@ -1102,12 +1103,12 @@ void AIServerApp::AllNpcInfo()
11021103
SetByte(send_buff, SERVER_INFO_END, send_index);
11031104
SetByte(send_buff, nZone, send_index);
11041105
SetShort(send_buff, (int16_t) _totalNpcCount, send_index);
1105-
packet_size = Send(send_buff, send_index, nZone);
1106+
Send(send_buff, send_index, nZone);
11061107

11071108
spdlog::debug("AIServerApp::AllNpcInfo: end for zoneId={}", nZone);
11081109
}
11091110

1110-
Sleep(1000);
1111+
std::this_thread::sleep_for(1s);
11111112
}
11121113
// ~sungyong 2002.05.23
11131114

@@ -1154,7 +1155,6 @@ void AIServerApp::CheckAliveTest()
11541155
{
11551156
int send_index = 0;
11561157
char send_buff[256] = {};
1157-
int iErrorCode = 0;
11581158

11591159
SetByte(send_buff, AG_CHECK_ALIVE_REQ, send_index);
11601160

@@ -1291,7 +1291,7 @@ int AIServerApp::Send(const char* pData, int length, int nZone)
12911291
return 0;
12921292

12931293
if (length <= 0
1294-
|| length > sizeof(_SEND_DATA::pBuf))
1294+
|| length > static_cast<int>(sizeof(_SEND_DATA::pBuf)))
12951295
return 0;
12961296

12971297
_SEND_DATA* pNewData = new _SEND_DATA;
@@ -1319,7 +1319,6 @@ void AIServerApp::SyncTest()
13191319

13201320
int send_index = 0;
13211321
char send_buff[256] = {};
1322-
int iErrorCode = 0;
13231322

13241323
SetByte(send_buff, AG_CHECK_ALIVE_REQ, send_index);
13251324

@@ -1356,7 +1355,7 @@ void AIServerApp::TestCode()
13561355
count_3++;
13571356
}
13581357

1359-
//TRACE(_T("$$$ random test == 1=%d, 2=%d, 3=%d,, %d,%hs $$$\n"), count_1, count_2, count_3, __FILE__, __LINE__);
1358+
spdlog::debug("AIServerApp::TestCode: random test 1={} 2={} 3={}", count_1, count_2, count_3);
13601359
}
13611360

13621361
bool AIServerApp::GetMagicType1Data()
@@ -1457,33 +1456,26 @@ void AIServerApp::RegionCheck()
14571456

14581457
bool AIServerApp::AddObjectEventNpc(_OBJECT_EVENT* pEvent, int zone_number)
14591458
{
1460-
int i = 0, j = 0, objectid = 0;
14611459
model::Npc* pNpcTable = nullptr;
1462-
bool bFindNpcTable = false;
1463-
int offset = 0;
14641460
int nServerNum = GetServerNumber(zone_number);
14651461
if (_serverZoneType != nServerNum)
14661462
return false;
14671463

14681464
pNpcTable = _npcTableMap.GetData(pEvent->sIndex);
14691465
if (pNpcTable == nullptr)
14701466
{
1471-
bFindNpcTable = false;
14721467
spdlog::error("AIServerApp::AddObjectEventNpc error: eventId={} zoneId={}",
14731468
pEvent->sIndex, zone_number);
14741469
return false;
14751470
}
14761471

1477-
bFindNpcTable = true;
1478-
14791472
CNpc* pNpc = new CNpc();
14801473

14811474
pNpc->m_sNid = _mapEventNpcCount++; // 서버 내에서의 고유 번호
14821475
pNpc->m_sSid = (int16_t) pEvent->sIndex; // MONSTER(NPC) Serial ID
14831476

14841477
pNpc->m_byMoveType = 100;
14851478
pNpc->m_byInitMoveType = 100;
1486-
bFindNpcTable = false;
14871479

14881480
pNpc->m_byMoveType = 0;
14891481
pNpc->m_byInitMoveType = 0;
@@ -1518,7 +1510,6 @@ bool AIServerApp::AddObjectEventNpc(_OBJECT_EVENT* pEvent, int zone_number)
15181510
//pNpc->m_ZoneIndex = GetZoneIndex(pNpc->m_sCurZone);
15191511
/*
15201512
if(pNpc->m_ZoneIndex == -1) {
1521-
AfxMessageBox("Invaild zone Index!!");
15221513
return false;
15231514
} */
15241515

Server/AIServer/AIServerApp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include "AISocketManager.h"
77

8-
#include "MAP.h"
8+
#include "Map.h"
99
#include "NpcItem.h"
1010
#include "Npc.h"
1111

Server/AIServer/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ add_executable(AIServer
2828
PathFind.cpp
2929
PathFind.h
3030
pch.h
31-
Region.cpp
3231
Region.h
3332
resource.h
3433
RoomEvent.cpp
@@ -66,6 +65,6 @@ target_link_libraries(AIServer
6665
# Setup warning levels
6766
target_compile_options(AIServer PRIVATE
6867
$<$<CXX_COMPILER_ID:MSVC>:/W3>
69-
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic>
70-
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic>
68+
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Wno-gnu-anonymous-struct -Wno-nested-anon-types>
69+
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wpedantic -Wno-gnu-anonymous-struct -Wno-nested-anon-types>
7170
)

0 commit comments

Comments
 (0)