Allow larger map names

This commit is contained in:
def 2020-06-18 18:29:27 +02:00
parent 8c17e7c6c1
commit 7aed6476dc
7 changed files with 27 additions and 15 deletions

View file

@ -4,6 +4,7 @@
#define ENGINE_DEMO_H #define ENGINE_DEMO_H
#include <base/hash.h> #include <base/hash.h>
#include <engine/map.h>
#include <engine/shared/uuid_manager.h> #include <engine/shared/uuid_manager.h>
#include "kernel.h" #include "kernel.h"
@ -29,7 +30,7 @@ struct CDemoHeader
unsigned char m_aMarker[7]; unsigned char m_aMarker[7];
unsigned char m_Version; unsigned char m_Version;
char m_aNetversion[64]; char m_aNetversion[64];
char m_aMapName[64]; char m_aMapName[MAX_MAP_LENGTH];
unsigned char m_aMapSize[4]; unsigned char m_aMapSize[4];
unsigned char m_aMapCrc[4]; unsigned char m_aMapCrc[4];
char m_aType[8]; char m_aType[8];
@ -45,7 +46,7 @@ struct CTimelineMarkers
struct CMapInfo struct CMapInfo
{ {
char m_aName[128]; char m_aName[MAX_MAP_LENGTH];
SHA256_DIGEST m_Sha256; SHA256_DIGEST m_Sha256;
int m_Crc; int m_Crc;
int m_Size; int m_Size;

View file

@ -1,6 +1,7 @@
#ifndef ENGINE_GHOST_H #ifndef ENGINE_GHOST_H
#define ENGINE_GHOST_H #define ENGINE_GHOST_H
#include <engine/map.h>
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>
#include "kernel.h" #include "kernel.h"
@ -11,7 +12,7 @@ public:
unsigned char m_aMarker[8]; unsigned char m_aMarker[8];
unsigned char m_Version; unsigned char m_Version;
char m_aOwner[MAX_NAME_LENGTH]; char m_aOwner[MAX_NAME_LENGTH];
char m_aMap[64]; char m_aMap[MAX_MAP_LENGTH];
unsigned char m_aCrc[4]; unsigned char m_aCrc[4];
unsigned char m_aNumTicks[4]; unsigned char m_aNumTicks[4];
unsigned char m_aTime[4]; unsigned char m_aTime[4];

View file

@ -6,6 +6,11 @@
#include <base/hash.h> #include <base/hash.h>
#include "kernel.h" #include "kernel.h"
enum
{
MAX_MAP_LENGTH = 128
};
class IMap : public IInterface class IMap : public IInterface
{ {
MACRO_INTERFACE("map", 0) MACRO_INTERFACE("map", 0)

View file

@ -3,6 +3,7 @@
#ifndef ENGINE_SERVERBROWSER_H #ifndef ENGINE_SERVERBROWSER_H
#define ENGINE_SERVERBROWSER_H #define ENGINE_SERVERBROWSER_H
#include <engine/map.h>
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>
#include "kernel.h" #include "kernel.h"
@ -53,7 +54,7 @@ public:
int m_HasRank; int m_HasRank;
char m_aGameType[16]; char m_aGameType[16];
char m_aName[64]; char m_aName[64];
char m_aMap[32]; char m_aMap[MAX_MAP_LENGTH];
int m_MapCrc; int m_MapCrc;
int m_MapSize; int m_MapSize;
char m_aVersion[32]; char m_aVersion[32];

View file

@ -10,7 +10,7 @@ class CBackground : public CMapLayers
{ {
IEngineMap *m_pMap; IEngineMap *m_pMap;
bool m_Loaded; bool m_Loaded;
char m_aMapName[128]; char m_aMapName[MAX_MAP_LENGTH];
//to avoid spam when in menu //to avoid spam when in menu
int64 m_LastLoad; int64 m_LastLoad;

View file

@ -4,6 +4,7 @@
#define GAME_SERVER_GAMECONTROLLER_H #define GAME_SERVER_GAMECONTROLLER_H
#include <base/vmath.h> #include <base/vmath.h>
#include <engine/map.h>
class CDoor; class CDoor;
#if !defined(_MSC_VER) || _MSC_VER >= 1600 #if !defined(_MSC_VER) || _MSC_VER >= 1600
@ -54,7 +55,7 @@ protected:
void ResetGame(); void ResetGame();
char m_aMapWish[128]; char m_aMapWish[MAX_MAP_LENGTH];
int m_RoundStartTick; int m_RoundStartTick;

View file

@ -4,6 +4,9 @@
#ifndef GAME_SERVER_SCORE_SQL_H #ifndef GAME_SERVER_SCORE_SQL_H
#define GAME_SERVER_SCORE_SQL_H #define GAME_SERVER_SCORE_SQL_H
#include <string>
#include <engine/map.h>
#include <engine/server/sql_string_helpers.h> #include <engine/server/sql_string_helpers.h>
#include <game/prng.h> #include <game/prng.h>
#include <game/voting.h> #include <game/voting.h>
@ -39,7 +42,7 @@ struct CSqlPlayerResult
{ {
char m_Reason[VOTE_REASON_LENGTH]; char m_Reason[VOTE_REASON_LENGTH];
char m_Server[32+1]; char m_Server[32+1];
char m_Map[128+1]; char m_Map[MAX_MAP_LENGTH+1];
} m_MapVote; } m_MapVote;
} m_Data; // PLAYER_INFO } m_Data; // PLAYER_INFO
@ -55,7 +58,7 @@ struct CSqlRandomMapResult
m_Map[0] = '\0'; m_Map[0] = '\0';
m_aMessage[0] = '\0'; m_aMessage[0] = '\0';
} }
char m_Map[128]; char m_Map[MAX_MAP_LENGTH];
char m_aMessage[512]; char m_aMessage[512];
}; };
@ -108,16 +111,16 @@ struct CSqlInitData : CSqlData<CSqlInitResult>
{ {
using CSqlData<CSqlInitResult>::CSqlData; using CSqlData<CSqlInitResult>::CSqlData;
// current map // current map
sqlstr::CSqlString<128> m_Map; sqlstr::CSqlString<MAX_MAP_LENGTH> m_Map;
}; };
struct CSqlPlayerRequest : CSqlData<CSqlPlayerResult> struct CSqlPlayerRequest : CSqlData<CSqlPlayerResult>
{ {
using CSqlData<CSqlPlayerResult>::CSqlData; using CSqlData<CSqlPlayerResult>::CSqlData;
// object being requested, either map (128 bytes) or player (16 bytes) // object being requested, either map (128 bytes) or player (16 bytes)
sqlstr::CSqlString<128> m_Name; sqlstr::CSqlString<MAX_MAP_LENGTH> m_Name;
// current map // current map
sqlstr::CSqlString<128> m_Map; sqlstr::CSqlString<MAX_MAP_LENGTH> m_Map;
sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer; sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer;
// relevant for /top5 kind of requests // relevant for /top5 kind of requests
int m_Offset; int m_Offset;
@ -127,7 +130,7 @@ struct CSqlRandomMapRequest : CSqlData<CSqlRandomMapResult>
{ {
using CSqlData<CSqlRandomMapResult>::CSqlData; using CSqlData<CSqlRandomMapResult>::CSqlData;
sqlstr::CSqlString<32> m_ServerType; sqlstr::CSqlString<32> m_ServerType;
sqlstr::CSqlString<32> m_CurrentMap; sqlstr::CSqlString<MAX_MAP_LENGTH> m_CurrentMap;
sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer; sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer;
int m_Stars; int m_Stars;
}; };
@ -136,7 +139,7 @@ struct CSqlScoreData : CSqlData<CSqlPlayerResult>
{ {
using CSqlData<CSqlPlayerResult>::CSqlData; using CSqlData<CSqlPlayerResult>::CSqlData;
sqlstr::CSqlString<MAX_NAME_LENGTH> m_Map; sqlstr::CSqlString<MAX_MAP_LENGTH> m_Map;
char m_GameUuid[UUID_MAXSTRSIZE]; char m_GameUuid[UUID_MAXSTRSIZE];
sqlstr::CSqlString<MAX_NAME_LENGTH> m_Name; sqlstr::CSqlString<MAX_NAME_LENGTH> m_Name;
@ -167,7 +170,7 @@ struct CSqlTeamSave : CSqlData<CSqlSaveResult>
char m_ClientName[MAX_NAME_LENGTH]; char m_ClientName[MAX_NAME_LENGTH];
char m_Map[128]; char m_Map[MAX_MAP_LENGTH];
char m_Code[128]; char m_Code[128];
char m_aGeneratedCode[128]; char m_aGeneratedCode[128];
char m_Server[5]; char m_Server[5];
@ -177,7 +180,7 @@ struct CSqlTeamLoad : CSqlData<CSqlSaveResult>
{ {
using CSqlData<CSqlSaveResult>::CSqlData; using CSqlData<CSqlSaveResult>::CSqlData;
sqlstr::CSqlString<128> m_Code; sqlstr::CSqlString<128> m_Code;
sqlstr::CSqlString<128> m_Map; sqlstr::CSqlString<MAX_MAP_LENGTH> m_Map;
sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer; sqlstr::CSqlString<MAX_NAME_LENGTH> m_RequestingPlayer;
int m_ClientID; int m_ClientID;
// struct holding all player names in the team or an empty string // struct holding all player names in the team or an empty string