2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-16 00:28:20 +03:00

Const-like defines -> consts

This commit is contained in:
Sh1ft0x0EF 2017-04-26 00:51:29 +00:00
parent c895428d1d
commit 416637e970
38 changed files with 125 additions and 119 deletions

View File

@ -199,7 +199,7 @@ void CSys::Printf(char *fmt, ...)
ConsoleOutput(szText);
}
#define MAX_LINUX_CMDLINE 2048
const int MAX_LINUX_CMDLINE = 2048;
static char linuxCmdline[ MAX_LINUX_CMDLINE ];
void BuildCmdLine(int argc, char **argv)

View File

@ -8,7 +8,7 @@
#include "enums.h"
#endif
#define MAX_ALIAS_NAME 32
const int MAX_ALIAS_NAME = 32;
typedef struct cmdalias_s
{

View File

@ -102,7 +102,7 @@ typedef struct module_s
#include "in_buttons.h"
#endif
#define CLDLL_INTERFACE_VERSION 7
const int CLDLL_INTERFACE_VERSION = 7;
extern void LoadSecurityModuleFromDisk(char * pszDllName);
extern void LoadSecurityModuleFromMemory( unsigned char * pCode, int nSize );

View File

@ -46,8 +46,8 @@
#include "model.h"
#include "kbutton.h"
#define MAX_SCOREBOARDNAME 32
#define MAX_DEMOS 32
const int MAX_SCOREBOARDNAME = 32;
const int MAX_DEMOS = 32;
typedef enum cactive_e
{

View File

@ -36,9 +36,9 @@
All command/alias names are case insensitive! Arguments not.
*/
#define MAX_CMD_BUFFER 16384
#define MAX_CMD_TOKENS 80
#define MAX_CMD_LINE 1024
const int MAX_CMD_BUFFER = 16384;
const int MAX_CMD_TOKENS = 80;
const int MAX_CMD_LINE = 1024;
/*

View File

@ -33,7 +33,7 @@
// Looks like no more than 8096 visibility leafs per world model
#define MODEL_MAX_PVS 1024
const int MODEL_MAX_PVS = 1024;
#ifdef HOOK_ENGINE

View File

@ -2798,7 +2798,7 @@ typedef struct
unsigned short wBitsPerSample;
} FormatChunk;
#define WAVE_HEADER_LENGTH 128
const int WAVE_HEADER_LENGTH = 128;
unsigned int EXT_FUNC COM_GetApproxWavePlayLength(const char *filepath)
{

View File

@ -28,7 +28,7 @@
#pragma once
#define MAX_CONSISTENCY_LIST 512
const int MAX_CONSISTENCY_LIST = 512;
typedef struct consistency_s
{

View File

@ -32,8 +32,8 @@
#include "cvardef.h"
#include "FileSystem.h"
#define MAX_CVAR_VALUE 1024
#define MAX_CVARLIST_FILES 100
const int MAX_CVAR_VALUE = 1024;
const int MAX_CVARLIST_FILES = 100;
#ifdef HOOK_ENGINE
#define cvar_vars (*pcvar_vars)

View File

@ -32,8 +32,9 @@
#include "model.h"
#include "wad.h"
#define MAX_DECALS 512
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
const int MAX_DECALS = 512;
#define DECAL_EXTRASIZE sizeof(texture_t) - sizeof(miptex_t)
typedef struct decalname_s
{

View File

@ -30,7 +30,7 @@
#include "maintypes.h"
#define DELTA_MAX_FIELDS 56 // 7*8
const int DELTA_MAX_FIELDS = 56; // 7*8
enum
{
@ -46,7 +46,7 @@ enum
DT_SIGNED = BIT(31) // sign modificator
};
#define FDT_MARK BIT(0) // Delta mark for sending
const int FDT_MARK = BIT(0); // Delta mark for sending
typedef struct delta_s delta_t;
typedef void(*encoder_t)(delta_t *, const unsigned char *, const unsigned char *);

View File

@ -30,8 +30,8 @@
#include "maintypes.h"
#define DELTAJIT_MAX_BLOCKS 32
#define DELTAJIT_MAX_FIELDS 56
const int DELTAJIT_MAX_BLOCKS = 32;
const int DELTAJIT_MAX_FIELDS = 56;
struct deltajit_field {
unsigned int id;

View File

@ -31,11 +31,11 @@
#include "userid.h"
#ifdef REHLDS_FIXES
#define MAX_IPFILTERS 4096
#define MAX_USERFILTERS 4096
const int MAX_IPFILTERS = 4096;
const int MAX_USERFILTERS = 4096;
#else
#define MAX_IPFILTERS 32768
#define MAX_USERFILTERS 32768
const int MAX_IPFILTERS = 32768;
const int MAX_USERFILTERS = 32768;
#endif // REHLDS_FIXES
typedef struct ipfilter_s

View File

@ -34,7 +34,7 @@
#include "server.h"
#include "rehlds_api.h"
#define MAX_COMMAND_LINE_PARAMS 50
const int MAX_COMMAND_LINE_PARAMS = 50;
typedef struct quakeparms_s
{

View File

@ -31,17 +31,17 @@
#include "maintypes.h"
// Max key/value length (with a NULL char)
#define MAX_KV_LEN 127
const int MAX_KV_LEN = 127;
// Key + value + 2 x slash + NULL
#define MAX_INFO_STRING 256
const int MAX_INFO_STRING = 256;
#define INFO_MAX_BUFFER_VALUES 4
const int INFO_MAX_BUFFER_VALUES = 4;
#ifdef REHLDS_FIXES
#define MAX_LOCALINFO 4096
const int MAX_LOCALINFO = 4096;
#else
#define MAX_LOCALINFO MAX_INFO_STRING * 128
const int MAX_LOCALINFO = MAX_INFO_STRING * 128;
#endif // REHLDS_FIXES
const char *Info_ValueForKey(const char *s, const char *key);

View File

@ -30,7 +30,7 @@
#include "entity_state.h"
#define NUM_BASELINES 64
const int NUM_BASELINES = 64;
typedef struct extra_baselines_s
{

View File

@ -33,7 +33,8 @@
#include "commonmacros.h"
// header
#define STUDIO_VERSION 10
const int STUDIO_VERSION = 10;
#define IDSTUDIOHEADER MAKEID('I', 'D', 'S', 'T') // little-endian "IDST"
#define IDSEQGRPHEADER MAKEID('I', 'D', 'S', 'Q') // little-endian "IDSQ"

View File

@ -33,53 +33,53 @@
#include "enums.h"
#include "netadr.h"
#define PROTOCOL_VERSION 48
const int PROTOCOL_VERSION = 48;
// MAX_CHALLENGES is made large to prevent a denial
// of service attack that could cycle all of them
// out before legitimate users connected
#ifdef REHLDS_OPT_PEDANTIC
#define MAX_CHALLENGES 64
const int MAX_CHALLENGES = 64;
#else
#define MAX_CHALLENGES 1024
const int MAX_CHALLENGES = 1024;
#endif // REHLDS_OPT_PEDANTIC
// Client connection is initiated by requesting a challenge value
// the server sends this value back
#define S2C_CHALLENGE 'A' // + challenge value
const char S2C_CHALLENGE = 'A'; // + challenge value
// Send a userid, client remote address, is this server secure and engine build number
#define S2C_CONNECTION 'B'
const char S2C_CONNECTION = 'B';
// HLMaster rejected a server's connection because the server needs to be updated
#define M2S_REQUESTRESTART 'O'
const char M2S_REQUESTRESTART = 'O';
// send a log event as key value
#define S2A_LOGSTRING 'R'
const char S2A_LOGSTRING = 'R';
// Send a log string
#define S2A_LOGKEY 'S'
const char S2A_LOGKEY = 'S';
// Basic information about the server
#define A2S_INFO 'T'
const char A2S_INFO = 'T';
// Details about each player on the server
#define A2S_PLAYER 'U'
const char A2S_PLAYER = 'U';
// The rules the server is using
#define A2S_RULES 'V'
const char A2S_RULES = 'V';
// Another user is requesting a challenge value from this machine
#define A2A_GETCHALLENGE 'W' // Request challenge # from another machine
const char A2A_GETCHALLENGE = 'W'; // Request challenge # from another machine
// Generic Ping Request
#define A2A_PING 'i' // respond with an A2A_ACK
const char A2A_PING = 'i'; // respond with an A2A_ACK
// Generic Ack
#define A2A_ACK 'j' // general acknowledgement without info
const char A2A_ACK = 'j'; // general acknowledgement without info
// Challenge response from master
#define M2A_CHALLENGE 's' // + challenge value
const char M2A_CHALLENGE = 's'; // + challenge value
// 0 == regular, 1 == file stream
enum
@ -91,25 +91,25 @@ enum
};
// Flow control bytes per second limits
#define MAX_RATE 100000.0f
#define MIN_RATE 1000.0f
const float MAX_RATE = 100000.0f;
const float MIN_RATE = 1000.0f;
// Default data rate
#define DEFAULT_RATE (9999.0f)
const float DEFAULT_RATE = (9999.0f);
// NETWORKING INFO
// Max size of udp packet payload
#define MAX_UDP_PACKET 4010 // 9 bytes SPLITHEADER + 4000 payload?
const int MAX_UDP_PACKET = 4010; // 9 bytes SPLITHEADER + 4000 payload?
// Max length of a reliable message
#define MAX_MSGLEN 3990 // 10 reserved for fragheader?
const int MAX_MSGLEN = 3990; // 10 reserved for fragheader?
// Max length of unreliable message
#define MAX_DATAGRAM 4000
const int MAX_DATAGRAM = 4000;
// This is the packet payload without any header bytes (which are attached for actual sending)
#define NET_MAX_PAYLOAD 65536
const int NET_MAX_PAYLOAD = 65536;
// This is the payload plus any header info (excluding UDP header)
@ -135,7 +135,7 @@ enum
// bytes will be stripped by the networking channel layer
//#define NET_MAX_MESSAGE PAD_NUMBER( ( MAX_MSGLEN + HEADER_BYTES ), 16 )
// This is currently used value in the engine. TODO: define above gives 4016, check it why.
#define NET_MAX_MESSAGE 4037
const int NET_MAX_MESSAGE = 4037;
typedef enum svc_commands_e
@ -237,7 +237,7 @@ typedef struct flowstats_s
double time;
} flowstats_t;
#define MAX_LATENT 32
const int MAX_LATENT = 32;
typedef struct flow_s
{
@ -252,19 +252,20 @@ typedef struct flow_s
float avgkbytespersec;
} flow_t;
#define FRAGMENT_C2S_MIN_SIZE 16
#define FRAGMENT_S2C_MIN_SIZE 256
#define FRAGMENT_S2C_MAX_SIZE 1024
#define CLIENT_FRAGMENT_SIZE_ONCONNECT 128
#define CUSTOMIZATION_MAX_SIZE 20480
const int FRAGMENT_C2S_MIN_SIZE = 16;
const int FRAGMENT_S2C_MIN_SIZE = 256;
const int FRAGMENT_S2C_MAX_SIZE = 1024;
const int CLIENT_FRAGMENT_SIZE_ONCONNECT = 128;
const int CUSTOMIZATION_MAX_SIZE = 20480;
#ifndef REHLDS_FIXES
// Size of fragmentation buffer internal buffers
#define FRAGMENT_MAX_SIZE 1400
const int FRAGMENT_MAX_SIZE = 1400;
#define MAX_FRAGMENTS 25000
const int MAX_FRAGMENTS = 25000;
#else
#define FRAGMENT_MAX_SIZE 1024
const int FRAGMENT_MAX_SIZE = 1024;
// Client sends normal fragments only while connecting
#define MAX_NORMAL_FRAGMENTS (NET_MAX_PAYLOAD / CLIENT_FRAGMENT_SIZE_ONCONNECT)
@ -274,8 +275,8 @@ typedef struct flow_s
#define MAX_FILE_FRAGMENTS (CUSTOMIZATION_MAX_SIZE / FRAGMENT_C2S_MIN_SIZE)
#endif
#define UDP_HEADER_SIZE 28
#define MAX_RELIABLE_PAYLOAD 1200
const int UDP_HEADER_SIZE = 28;
const int MAX_RELIABLE_PAYLOAD = 1200;
#define MAKE_FRAGID(id,count) ( ( ( id & 0xffff ) << 16 ) | ( count & 0xffff ) )
#define FRAG_GETID(fragid) ( ( fragid >> 16 ) & 0xffff )

View File

@ -46,15 +46,15 @@
#endif // _WIN32
#define MAX_ROUTEABLE_PACKET 1400
const int MAX_ROUTEABLE_PACKET = 1400;
#define SPLIT_SIZE (MAX_ROUTEABLE_PACKET - sizeof(SPLITPACKET))
// Create general message queues
#define NUM_MSG_QUEUES 40
#define MSG_QUEUE_SIZE 1536
const int NUM_MSG_QUEUES = 40;
const int MSG_QUEUE_SIZE = 1536;
#define NET_HEADER_FLAG_SPLITPACKET -2
const int NET_HEADER_FLAG_SPLITPACKET = -2;
typedef struct loopmsg_s
{
@ -62,7 +62,7 @@ typedef struct loopmsg_s
int datalen;
} loopmsg_t;
#define MAX_LOOPBACK 4
const int MAX_LOOPBACK = 4;
typedef struct loopback_s
{
@ -110,7 +110,7 @@ typedef struct SPLITPACKET_t
} SPLITPACKET;
#pragma pack(pop)
#define NET_WS_MAX_FRAGMENTS 5
const int NET_WS_MAX_FRAGMENTS = 5;
#ifdef HOOK_ENGINE
#define net_thread_initialized (*pnet_thread_initialized)

View File

@ -2361,11 +2361,13 @@ void SeedRandomNumberGenerator(void)
}
}
#define IA 16807
#define IM 2147483647
#define IQ 127773
#define IR 2836
#define NTAB 32
const int IA = 16807;
const int IM = 2147483647;
const int IQ = 127773;
const int IR = 2836;
const int NTAB = 32;
#define NDIV (1+(IM-1)/NTAB)
int32 ran1(void)

View File

@ -31,8 +31,8 @@
#include "maintypes.h"
// TODO: I think this defines must be in /common/
#define NUM_EDICTS 900
#define MAX_NAME 32
const int NUM_EDICTS = 900;
const int MAX_NAME = 32;
#include "custom_int.h"
#include "crc.h"
@ -54,9 +54,9 @@
#include "inst_baseline.h"
#include "net_ws.h"
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0f
#define DEFAULT_SOUND_PACKET_PITCH 100
const int DEFAULT_SOUND_PACKET_VOLUME = 255;
const float DEFAULT_SOUND_PACKET_ATTENUATION = 1.0f;
const int DEFAULT_SOUND_PACKET_PITCH = 100;
// Sound flags
enum
@ -82,10 +82,10 @@ enum
MSG_FL_ONE = BIT(7), // Send to single client
};
#define RESOURCE_INDEX_BITS 12
const int RESOURCE_INDEX_BITS = 12;
#ifdef REHLDS_FIXES
#define RESOURCE_MAX_COUNT (1 << RESOURCE_INDEX_BITS)
const int RESOURCE_MAX_COUNT = BIT(RESOURCE_INDEX_BITS);
#endif // REHLDS_FIXES
typedef enum redirect_e

View File

@ -31,7 +31,7 @@
#include "quakedef.h"
// max number of sentences in game. NOTE: this must match CVOXFILESENTENCEMAX in dlls\util.h!!!
#define CVOXFILESENTENCEMAX 1536
const int CVOXFILESENTENCEMAX = 1536;
typedef struct sfx_s
{

View File

@ -3239,8 +3239,8 @@ void SV_BeginRedirect(redirect_t rd, netadr_t *addr)
outputbuf[0] = 0;
}
#define MAX_RCON_FAILURES_STORAGE 32
#define MAX_RCON_FAILURES 20
const int MAX_RCON_FAILURES_STORAGE = 32;
const int MAX_RCON_FAILURES = 20;
typedef struct rcon_failure_s
{

View File

@ -31,7 +31,7 @@
#include "maintypes.h"
#include "server.h"
#define DI_NODIR -1
const int DI_NODIR = -1;
#ifdef HOOK_ENGINE

View File

@ -33,7 +33,7 @@
#include "world.h"
#include "pm_defs.h"
#define CMD_MAXBACKUP 64
const int CMD_MAXBACKUP = 64;
typedef struct command_s command_t;

View File

@ -52,7 +52,7 @@
#endif
#define MAX_DISCONNECT_REASON 256
const int MAX_DISCONNECT_REASON = 256;
#ifdef HOOK_ENGINE

View File

@ -36,7 +36,8 @@
#include "engine_launcher_api.h"
#include "idedicatedexports.h"
#define FIFTEEN_MB (15 * 1024 * 1024)
const int FIFTEEN_MB = (15 * 1024 * 1024);
#define MINIMUM_WIN_MEMORY 0x0e00000
#define WARNING_MEMORY 0x0200000
#define MAXIMUM_WIN_MEMORY 0x8000000 // Ask for 128 MB max

View File

@ -31,7 +31,7 @@
#include "maintypes.h"
#include "wad.h"
#define MAX_MAP_TEXTURES 512
const int MAX_MAP_TEXTURES = 512;
typedef struct texlumpinfo_s
{

View File

@ -30,19 +30,19 @@
#include "maintypes.h"
#define DEMO_MESSAGE "__DEMOMESSAGE__"
#define NETWORK_MESSAGE1 "__NETMESSAGE__1"
#define NETWORK_MESSAGE2 "__NETMESSAGE__2"
#define NETWORK_MESSAGE3 "__NETMESSAGE__3"
#define NETWORK_MESSAGE4 "__NETMESSAGE__4"
static const char *DEMO_MESSAGE = "__DEMOMESSAGE__";
static const char *NETWORK_MESSAGE1 = "__NETMESSAGE__1";
static const char *NETWORK_MESSAGE2 = "__NETMESSAGE__2";
static const char *NETWORK_MESSAGE3 = "__NETMESSAGE__3";
static const char *NETWORK_MESSAGE4 = "__NETMESSAGE__4";
#define MAX_NETMESSAGE 4
const int MAX_NETMESSAGE = 4;
#define MSGFILE_NAME 0
#define MSGFILE_TEXT 1
const int MSGFILE_NAME = 0;
const int MSGFILE_TEXT = 1;
#define NAME_HEAP_SIZE 16384
#define MAX_MESSAGES 1000
const int NAME_HEAP_SIZE = 16384;
const int MAX_MESSAGES = 1000;
#ifdef HOOK_ENGINE

View File

@ -68,7 +68,7 @@ typedef struct wadlist_s
typedef struct wadlist_s wadlist_t;
typedef struct lumpinfo_s lumpinfo_t;
#define NUM_WADS 2
const int NUM_WADS = 2;
#ifdef HOOK_ENGINE
#define wads (*pwads)

View File

@ -46,7 +46,7 @@ all big things are allocated on the hunk.
*/
#define ZONEID 0x001d4a11
#define MINFRAGMENT 64
const int MINFRAGMENT = 64;
typedef struct memblock_s
{
@ -285,7 +285,7 @@ void Z_CheckHeap(void)
#ifndef Hunk_Functions_region
#define HUNK_NAME_LEN 64
const int HUNK_NAME_LEN = 64;
#define HUNK_SENTINEL 0x1df001ed
typedef struct hunk_s
@ -579,7 +579,7 @@ CACHE MEMORY
===============================================================================
*/
#define CACHE_NAME_LEN 64
const int CACHE_NAME_LEN = 64;
typedef struct cache_system_s
{
@ -1118,7 +1118,7 @@ NOXREF void Cache_Print_Models_And_Totals(void)
FS_Close(file);
}
#define MAX_SFX 1024
const int MAX_SFX = 1024;
NOXREF void Cache_Print_Sounds_And_Totals(void)
{

View File

@ -36,11 +36,11 @@ IBaseInterface* CreateFileSystemInterface(void);
InterfaceReg iface = InterfaceReg(CreateFileSystemInterface, "VFileSystem009");
#ifdef _WIN32
#define ORIGINAL_ENGINE_DLL_NAME "swds.dll"
#define ORIGINAL_FILESYSTEM_DLL_NAME "filesystem_stdio2.dll"
const char *ORIGINAL_ENGINE_DLL_NAME = "swds.dll";
const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.dll";
#else
#define ORIGINAL_ENGINE_DLL_NAME "engine_i486.so"
#define ORIGINAL_FILESYSTEM_DLL_NAME "filesystem_stdio2.so"
const char *ORIGINAL_ENGINE_DLL_NAME = "engine_i486.so";
const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.so";
#endif
CSysModule *g_pOriginalFileSystemModule = NULL;

View File

@ -32,7 +32,7 @@
#include "osconfig.h"
#define MAX_PATTERN 128
const int MAX_PATTERN = 128;
struct Section;

View File

@ -1,6 +1,6 @@
#include "precompiled.h"
#define REHLDS_DEBUG_MAX_EDICTS 2048
const int REHLDS_DEBUG_MAX_EDICTS = 2048;
uint32 calcFloatChecksum(uint32 crc, const float* pFloat) {
uint32 sVal = *reinterpret_cast<const uint32*>(pFloat);

View File

@ -28,7 +28,7 @@
#pragma once
#include "hookchains.h"
#define MAX_HOOKS_IN_CHAIN 19
const int MAX_HOOKS_IN_CHAIN = 19;
// Implementation for chains in modules
template<typename t_ret, typename ...t_args>

View File

@ -10,8 +10,8 @@
#include <iostream>
#include <fstream>
#define HOSTENT_DATA_MAX_ALIASES 10
#define HOSTENT_DATA_MAX_ADDRS 32
const int HOSTENT_DATA_MAX_ALIASES = 10;
const int HOSTENT_DATA_MAX_ADDRS = 32;
struct hostent_data_t {
char hostName[256];

View File

@ -1,8 +1,8 @@
#pragma once
#ifdef _WIN32
#define TESTPLAYER_FUNCTREE_DEPTH 8
#define TESTPLAYER_FUNCCALL_MAXSIZE 17000
const int TESTPLAYER_FUNCTREE_DEPTH = 8;
const int TESTPLAYER_FUNCCALL_MAXSIZE = 17000;
#include "osconfig.h"
#include "funccalls.h"

View File

@ -10,8 +10,8 @@
#include <fstream>
#include <unordered_map>
#define TESTSUITE_PROTOCOL_VERSION_MINOR 5
#define TESTSUITE_PROTOCOL_VERSION_MAJOR 0
const int TESTSUITE_PROTOCOL_VERSION_MINOR = 5;
const int TESTSUITE_PROTOCOL_VERSION_MAJOR = 0;
void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs);