Stopwatch: checking protocol at runtime instead

This commit is contained in:
OM 2023-07-01 21:17:30 +02:00
parent 0f0fbb7b0d
commit 8418da422c

View file

@ -219,32 +219,22 @@ CG_Stopwatch_f
================
*/
#if TARGET_GAME_PROTOCOL >= 15
static void CG_Stopwatch_f()
{
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
cgi.stopWatch->iStartTime = atoi(cgi.Argv(1));
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
if (cgi.protocol >= PROTOCOL_MOHTA_MIN) {
cgi.stopWatch->iStartTime = atoi(cgi.Argv(1));
} else {
// The base game has it wrong
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
}
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
}
#else
static void CG_Stopwatch_f()
{
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
}
#endif
/*
================
CG_ServerLag_f