1
0
Fork 0

Eliminated hardcoded allowed map limit, added and increased the limit in length.h

This commit is contained in:
Exynox 2023-12-09 19:16:41 +02:00
parent da120f69e0
commit 99935d6cff
6 changed files with 12 additions and 5 deletions

View File

@ -19,6 +19,7 @@ enum EMisc
SMS_MAX_LEN = 80,
MOBILE_MAX_LEN = 32,
SOCIAL_ID_MAX_LEN = 18,
MAP_ALLOW_MAX_LEN = 128,
GUILD_NAME_MAX_LEN = 12,

View File

@ -761,7 +761,7 @@ typedef struct SPacketGDSetup
BYTE bChannel; // 채널
WORD wListenPort; // 클라이언트가 접속하는 포트 번호
WORD wP2PPort; // 서버끼리 연결 시키는 P2P 포트 번호
LONG alMaps[32];
LONG alMaps[MAP_ALLOW_MAX_LEN];
DWORD dwLoginCount;
BYTE bAuthServer;
} TPacketGDSetup;
@ -773,7 +773,7 @@ typedef struct SPacketDGMapLocations
typedef struct SMapLocation
{
LONG alMaps[32];
LONG alMaps[MAP_ALLOW_MAX_LEN];
char szHost[MAX_HOST_LENGTH + 1];
WORD wPort;
} TMapLocation;

View File

@ -66,7 +66,7 @@ class CPeer : public CPeerBase
DWORD m_dwUserCount;
WORD m_wListenPort; // 게임서버가 클라이언트를 위해 listen 하는 포트
WORD m_wP2PPort; // 게임서버가 게임서버 P2P 접속을 위해 listen 하는 포트
LONG m_alMaps[32]; // 어떤 맵을 관장하고 있는가?
LONG m_alMaps[MAP_ALLOW_MAX_LEN]; // 어떤 맵을 관장하고 있는가?
TItemIDRangeTable m_itemRange;
TItemIDRangeTable m_itemSpareRange;

View File

@ -172,6 +172,12 @@ void map_allow_add(int index)
exit(1);
}
if (s_set_map_allows.size() >= MAP_ALLOW_MAX_LEN)
{
fprintf(stdout, "Fatal error: maximum allowed maps reached!\n");
exit(1);
}
fprintf(stdout, "MAP ALLOW %d\n", index);
s_set_map_allows.insert(index);
}

View File

@ -180,7 +180,7 @@ void CLIENT_DESC::SetPhase(int iPhase)
p.wListenPort = mother_port;
p.wP2PPort = p2p_port;
p.bAuthServer = false;
map_allow_copy(p.alMaps, 32);
map_allow_copy(p.alMaps, MAP_ALLOW_MAX_LEN);
const DESC_MANAGER::DESC_SET & c_set = DESC_MANAGER::instance().GetClientSet();
DESC_MANAGER::DESC_SET::const_iterator it;

View File

@ -1312,7 +1312,7 @@ void CInputDB::MapLocations(const char * c_pData)
while (bCount--)
{
for (int i = 0; i < 32; ++i)
for (int i = 0; i < MAP_ALLOW_MAX_LEN; ++i)
{
if (0 == pLoc->alMaps[i])
break;