From a3094b3719e1721d2138581e73b6c65368854f1d Mon Sep 17 00:00:00 2001 From: asmodai Date: Tue, 14 Jul 2015 15:01:40 +0300 Subject: [PATCH] Fixed bug in challenge generator. --- rehlds/engine/sv_main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 7d13556..b201a27 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2454,7 +2454,11 @@ void SVC_GetChallenge(void) i = oldest; #endif // generate new challenge number - g_rg_sv_challenges[i].challenge = ( RandomLong(0, 36863) << 16 ) | ( RandomLong(0, 65535) ); +#ifdef REHLDS_FIXES + g_rg_sv_challenges[i].challenge = (RandomLong(0, 0x7fff) << 16) | (RandomLong(0, 0xffff)); +#else // REHLDS_FIXES + g_rg_sv_challenges[i].challenge = (RandomLong(0, 36863) << 16) | (RandomLong(0, 65535)); +#endif // REHLDS_FIXES g_rg_sv_challenges[i].adr = net_from; g_rg_sv_challenges[i].time = (int)realtime; } @@ -2517,7 +2521,11 @@ void SVC_ServiceChallenge(void) i = oldest; #endif // generate new challenge number +#ifdef REHLDS_FIXES + g_rg_sv_challenges[i].challenge = (RandomLong(0, 0x7fff) << 16) | (RandomLong(0, 0xffff)); +#else // REHLDS_FIXES g_rg_sv_challenges[i].challenge = (RandomLong(0, 36863) << 16) | (RandomLong(0, 65535)); +#endif // REHLDS_FIXES g_rg_sv_challenges[i].adr = net_from; g_rg_sv_challenges[i].time = (int)realtime; }