From 7aed6476dcf6f6e8316d6968c13698e174369258 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 18 Jun 2020 18:29:27 +0200 Subject: [PATCH] Allow larger map names --- src/engine/demo.h | 5 +++-- src/engine/ghost.h | 3 ++- src/engine/map.h | 5 +++++ src/engine/serverbrowser.h | 3 ++- src/game/client/components/background.h | 2 +- src/game/server/gamecontroller.h | 3 ++- src/game/server/score/sql_score.h | 21 ++++++++++++--------- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/engine/demo.h b/src/engine/demo.h index 930aaf319..55c5d85d6 100644 --- a/src/engine/demo.h +++ b/src/engine/demo.h @@ -4,6 +4,7 @@ #define ENGINE_DEMO_H #include +#include #include #include "kernel.h" @@ -29,7 +30,7 @@ struct CDemoHeader unsigned char m_aMarker[7]; unsigned char m_Version; char m_aNetversion[64]; - char m_aMapName[64]; + char m_aMapName[MAX_MAP_LENGTH]; unsigned char m_aMapSize[4]; unsigned char m_aMapCrc[4]; char m_aType[8]; @@ -45,7 +46,7 @@ struct CTimelineMarkers struct CMapInfo { - char m_aName[128]; + char m_aName[MAX_MAP_LENGTH]; SHA256_DIGEST m_Sha256; int m_Crc; int m_Size; diff --git a/src/engine/ghost.h b/src/engine/ghost.h index b9cd816c9..751f0c944 100644 --- a/src/engine/ghost.h +++ b/src/engine/ghost.h @@ -1,6 +1,7 @@ #ifndef ENGINE_GHOST_H #define ENGINE_GHOST_H +#include #include #include "kernel.h" @@ -11,7 +12,7 @@ public: unsigned char m_aMarker[8]; unsigned char m_Version; char m_aOwner[MAX_NAME_LENGTH]; - char m_aMap[64]; + char m_aMap[MAX_MAP_LENGTH]; unsigned char m_aCrc[4]; unsigned char m_aNumTicks[4]; unsigned char m_aTime[4]; diff --git a/src/engine/map.h b/src/engine/map.h index f2c55ffc0..cb83ddab8 100644 --- a/src/engine/map.h +++ b/src/engine/map.h @@ -6,6 +6,11 @@ #include #include "kernel.h" +enum +{ + MAX_MAP_LENGTH = 128 +}; + class IMap : public IInterface { MACRO_INTERFACE("map", 0) diff --git a/src/engine/serverbrowser.h b/src/engine/serverbrowser.h index 4c25bc06a..1a017c5b0 100644 --- a/src/engine/serverbrowser.h +++ b/src/engine/serverbrowser.h @@ -3,6 +3,7 @@ #ifndef ENGINE_SERVERBROWSER_H #define ENGINE_SERVERBROWSER_H +#include #include #include "kernel.h" @@ -53,7 +54,7 @@ public: int m_HasRank; char m_aGameType[16]; char m_aName[64]; - char m_aMap[32]; + char m_aMap[MAX_MAP_LENGTH]; int m_MapCrc; int m_MapSize; char m_aVersion[32]; diff --git a/src/game/client/components/background.h b/src/game/client/components/background.h index b7fbd6968..ceca72397 100644 --- a/src/game/client/components/background.h +++ b/src/game/client/components/background.h @@ -10,7 +10,7 @@ class CBackground : public CMapLayers { IEngineMap *m_pMap; bool m_Loaded; - char m_aMapName[128]; + char m_aMapName[MAX_MAP_LENGTH]; //to avoid spam when in menu int64 m_LastLoad; diff --git a/src/game/server/gamecontroller.h b/src/game/server/gamecontroller.h index 313941fbc..ed1c0dfc7 100644 --- a/src/game/server/gamecontroller.h +++ b/src/game/server/gamecontroller.h @@ -4,6 +4,7 @@ #define GAME_SERVER_GAMECONTROLLER_H #include +#include class CDoor; #if !defined(_MSC_VER) || _MSC_VER >= 1600 @@ -54,7 +55,7 @@ protected: void ResetGame(); - char m_aMapWish[128]; + char m_aMapWish[MAX_MAP_LENGTH]; int m_RoundStartTick; diff --git a/src/game/server/score/sql_score.h b/src/game/server/score/sql_score.h index 183d3e2be..43c5ebf24 100644 --- a/src/game/server/score/sql_score.h +++ b/src/game/server/score/sql_score.h @@ -4,6 +4,9 @@ #ifndef GAME_SERVER_SCORE_SQL_H #define GAME_SERVER_SCORE_SQL_H +#include + +#include #include #include #include @@ -39,7 +42,7 @@ struct CSqlPlayerResult { char m_Reason[VOTE_REASON_LENGTH]; char m_Server[32+1]; - char m_Map[128+1]; + char m_Map[MAX_MAP_LENGTH+1]; } m_MapVote; } m_Data; // PLAYER_INFO @@ -55,7 +58,7 @@ struct CSqlRandomMapResult m_Map[0] = '\0'; m_aMessage[0] = '\0'; } - char m_Map[128]; + char m_Map[MAX_MAP_LENGTH]; char m_aMessage[512]; }; @@ -108,16 +111,16 @@ struct CSqlInitData : CSqlData { using CSqlData::CSqlData; // current map - sqlstr::CSqlString<128> m_Map; + sqlstr::CSqlString m_Map; }; struct CSqlPlayerRequest : CSqlData { using CSqlData::CSqlData; // object being requested, either map (128 bytes) or player (16 bytes) - sqlstr::CSqlString<128> m_Name; + sqlstr::CSqlString m_Name; // current map - sqlstr::CSqlString<128> m_Map; + sqlstr::CSqlString m_Map; sqlstr::CSqlString m_RequestingPlayer; // relevant for /top5 kind of requests int m_Offset; @@ -127,7 +130,7 @@ struct CSqlRandomMapRequest : CSqlData { using CSqlData::CSqlData; sqlstr::CSqlString<32> m_ServerType; - sqlstr::CSqlString<32> m_CurrentMap; + sqlstr::CSqlString m_CurrentMap; sqlstr::CSqlString m_RequestingPlayer; int m_Stars; }; @@ -136,7 +139,7 @@ struct CSqlScoreData : CSqlData { using CSqlData::CSqlData; - sqlstr::CSqlString m_Map; + sqlstr::CSqlString m_Map; char m_GameUuid[UUID_MAXSTRSIZE]; sqlstr::CSqlString m_Name; @@ -167,7 +170,7 @@ struct CSqlTeamSave : CSqlData char m_ClientName[MAX_NAME_LENGTH]; - char m_Map[128]; + char m_Map[MAX_MAP_LENGTH]; char m_Code[128]; char m_aGeneratedCode[128]; char m_Server[5]; @@ -177,7 +180,7 @@ struct CSqlTeamLoad : CSqlData { using CSqlData::CSqlData; sqlstr::CSqlString<128> m_Code; - sqlstr::CSqlString<128> m_Map; + sqlstr::CSqlString m_Map; sqlstr::CSqlString m_RequestingPlayer; int m_ClientID; // struct holding all player names in the team or an empty string