2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

Convert g_bIs#GameName# to enum. (#300)

* Convert g_bIs#GameName# to enum.
This commit is contained in:
Chuvi 2017-01-05 01:08:21 +03:00 committed by LevShisterov
parent 22ca60c764
commit 73237e884b
2 changed files with 58 additions and 4 deletions

View File

@ -545,7 +545,28 @@ extern cvar_t sv_rcon_minfailuretime;
extern cvar_t sv_rcon_banpenalty;
extern cvar_t scr_downloading;
#ifdef REHLDS_FIXES
enum GameType_e
{
GT_Unitialized,
GT_CZero,
GT_CZeroRitual,
GT_TerrorStrike,
GT_TFC,
GT_HL1,
GT_CStrike
};
extern GameType_e g_eGameType;
//A crutch to prevent rewriting tons of code.
#define g_bIsCZero (g_eGameType==GT_CZero)
#define g_bIsCZeroRitual (g_eGameType==GT_CZeroRitual)
#define g_bIsTerrorStrike (g_eGameType==GT_TerrorStrike)
#define g_bIsTFC (g_eGameType==GT_TFC)
#define g_bIsHL1 (g_eGameType==GT_HL1)
#define g_bIsCStrike (g_eGameType==GT_CStrike)
#else
extern int g_bCS_CZ_Flags_Initialized;
extern int g_bIsCZero;
extern int g_bIsCZeroRitual;
@ -553,7 +574,7 @@ extern int g_bIsTerrorStrike;
extern int g_bIsTFC;
extern int g_bIsHL1;
extern int g_bIsCStrike;
#endif
extern int fatbytes;
extern int giNextUserMsg;
extern int hashstrings_collisions;

View File

@ -99,7 +99,10 @@ char outputbuf[MAX_ROUTEABLE_PACKET];
redirect_t sv_redirected;
netadr_t sv_redirectto;
// TODO: make one global var with mods enum.
// DONE: make one global var with mods enum.
#ifdef REHLDS_FIXES
GameType_e g_eGameType = GT_Unitialized;
#else
int g_bCS_CZ_Flags_Initialized;
int g_bIsCZero;
int g_bIsCZeroRitual;
@ -107,7 +110,7 @@ int g_bIsTerrorStrike;
int g_bIsTFC;
int g_bIsHL1;
int g_bIsCStrike;
#endif
qboolean allow_cheats;
/*
@ -5561,34 +5564,64 @@ NOXREF void SV_ReconnectAllClients(void)
void SetCStrikeFlags(void)
{
if (!g_bCS_CZ_Flags_Initialized) // TODO: Convert these to enum
#ifdef REHLDS_FIXES
if(g_eGameType==GT_Unitialized)
#else
if (!g_bCS_CZ_Flags_Initialized) // DONE: Convert these to enum
#endif
{
if (!Q_stricmp(com_gamedir, "valve"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_HL1;
#else
g_bIsHL1 = 1;
#endif
}
else if (!Q_stricmp(com_gamedir, "cstrike") || !Q_stricmp(com_gamedir, "cstrike_beta"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_CStrike;
#else
g_bIsCStrike = 1;
#endif
}
else if (!Q_stricmp(com_gamedir, "czero"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_CZero;
#else
g_bIsCZero = 1;
#endif
}
else if (!Q_stricmp(com_gamedir, "czeror"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_CZeroRitual;
#else
g_bIsCZeroRitual = 1;
#endif
}
else if (!Q_stricmp(com_gamedir, "terror"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_TerrorStrike;
#else
g_bIsTerrorStrike = 1;
#endif
}
else if (!Q_stricmp(com_gamedir, "tfc"))
{
#ifdef REHLDS_FIXES
g_eGameType = GT_TFC;
#else
g_bIsTFC = 1;
#endif
}
#ifndef REHLDS_FIXES
g_bCS_CZ_Flags_Initialized = 1;
#endif
}
}