changed 2 cvar names/ranges and fixed the server's time wrap check

sv_minRebootDelayMins <mins> -> sv_minRestartDelay <hours>
com_completionStyle -> con_completionStyle
This commit is contained in:
myT 2017-12-14 23:37:23 +01:00
parent 3a52f8869e
commit 2b7c0d56f9
6 changed files with 20 additions and 23 deletions

View file

@ -94,9 +94,9 @@ add: r_greyscale <0.0 to 1.0> (default: 0) to control how monochromatic the fina
r_greyscale 0 = full color (nothing done)
r_greyscale 1 = completely monochrome
add: com_completionStyle <0|1> (default: 0) to select the auto-completion style
com_completionStyle 0 = always print all results
com_completionStyle 1 = print once, then cycle results like Enemy Territory's console
add: con_completionStyle <0|1> (default: 0) to select the auto-completion style
con_completionStyle 0 = always print all results
con_completionStyle 1 = print once, then cycle results like Enemy Territory's console
chg: cvars and commands are alphabetically sorted
@ -114,8 +114,8 @@ add: m_accelStyle <0|1> (default: 0) to control the mouse accel style
add: m_accelOffset <0.001 to 5000> (default: 5) to control the power offset with m_accelStyle 1
add: sv_minRebootDelayMins <60 to infinity> (default: 1440)
the min. amount of minutes to wait for before restarting the server
add: sv_minRestartDelay <2 to 48> (default: 2)
the min. amount of hours to wait for before restarting the server
a scheduled restart won't happen until there are no more human players connected
fix: broken rendering when the 2nd stage of a collapsed shader stage pair had non-white colors

View file

@ -79,7 +79,7 @@ cvar_t *sv_packetdelay = 0;
cvar_t *com_noErrorInterrupt;
#endif
static cvar_t *com_completionStyle; // 0 = legacy, 1 = ET-style
static cvar_t *con_completionStyle; // 0 = legacy, 1 = ET-style
static cvar_t *con_history;
// com_speeds times
@ -2184,7 +2184,7 @@ static const cvarTableItem_t com_cvars[] =
#if defined(_WIN32) && defined(_DEBUG)
{ &com_noErrorInterrupt, "com_noErrorInterrupt", "0", 0, CVART_BOOL },
#endif
{ &com_completionStyle, "com_completionStyle", "0", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, help_com_completionStyle },
{ &con_completionStyle, "con_completionStyle", "0", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, help_con_completionStyle },
{ &con_history, "con_history", "1", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, "writes the command history to a file on exit" }
};
@ -2892,7 +2892,7 @@ static void Field_AutoCompleteCmdOrVarName( int startArg, int compArg, qbool sea
return;
// we found 2+ matches
if ( com_completionStyle->integer ) {
if ( con_completionStyle->integer ) {
const int delta = String_HasLeadingSlash( field->buffer ) ? 0 : 1;
field->acStartArg = startArg;
field->acCompArg = compArg;
@ -2948,7 +2948,7 @@ static void Field_AutoCompleteCommandArgument( int startArg, int compArg )
Cmd_AutoCompleteArgument( cmdName, startArg, compArg );
// we found 2+ matches
if ( field->acOffset == 0 && matchCount >= 2 && com_completionStyle->integer ) {
if ( field->acOffset == 0 && matchCount >= 2 && con_completionStyle->integer ) {
const int delta = String_HasLeadingSlash( field->buffer ) ? 0 : 1;
field->acStartArg = startArg;
field->acCompArg = compArg;

View file

@ -37,10 +37,10 @@ help_pattern_matching \
" 1 = visible\n" \
" 2 = minimized"
#define help_com_completionStyle \
#define help_con_completionStyle \
"auto-completion style\n" \
" 0 = legacy, always print all results\n" \
" 1 = ET-style, print once then cycle"
" 0 = legacy: always prints all results\n" \
" 1 = ET-style: prints once then cycles reults"
#define help_qport \
"internal network port\n" \

View file

@ -248,7 +248,7 @@ extern cvar_t *sv_pure;
extern cvar_t *sv_floodProtect;
extern cvar_t *sv_lanForceRate;
extern cvar_t *sv_strictAuth;
extern cvar_t *sv_minRebootDelayMins;
extern cvar_t *sv_minRestartDelay;
//===========================================================

View file

@ -565,7 +565,7 @@ static const cvarTableItem_t sv_cvars[] =
{ NULL, "sv_mapChecksum", "", CVAR_ROM, CVART_INTEGER, NULL, NULL, ".bsp file checksum" },
{ &sv_lanForceRate, "sv_lanForceRate", "1", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, "1 means uncapped rate on LAN" },
{ &sv_strictAuth, "sv_strictAuth", "0", CVAR_ARCHIVE, CVART_BOOL, NULL, NULL, "requires CD key authentication" },
{ &sv_minRebootDelayMins, "sv_minRebootDelayMins", "120", 0, CVART_INTEGER, "60", NULL, "min. minutes before rebooting the server" }
{ &sv_minRestartDelay, "sv_minRestartDelay", "2", 0, CVART_INTEGER, "1", "48", "min. hours to wait before restarting the server" }
};

View file

@ -49,9 +49,9 @@ cvar_t *sv_maxPing;
cvar_t *sv_gametype;
cvar_t *sv_pure;
cvar_t *sv_floodProtect;
cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)
cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)
cvar_t *sv_strictAuth;
cvar_t *sv_minRebootDelayMins;
cvar_t *sv_minRestartDelay; // min. time before restart in hours
@ -791,17 +791,14 @@ void SV_Frame( int msec ) {
// Some mods may still have code like "sin(cg.time / 1000.0f)".
// IEEE 754 floats have a 23-bit mantissa.
// Rounding errors will start after roughly ((1<<23) / (60*1000)) ~ 139.8 minutes.
const int minRebootTimeCvar = 60 * 1000 * sv_minRebootDelayMins->integer;
const int minRebootTimeConst = 60 * 60 * 1000; // absolute min. time: 1 hour
const int maxRebootTime = 0x7FFFFFFF; // absolute max. time: ~ 24.86 days
const int minRebootTime = max( minRebootTimeCvar, minRebootTimeConst );
// All timestamps here are in milli-seconds, like svs.time.
// Absolute max. time with signed 32-bits: 0x7FFFFFFF ms ~ 24.86 days.
const int maxRebootTime = 0x7FC9117F; // 1 hour before max. time
const int minRebootTime = 60 * 60 * 1000 * sv_minRestartDelay->integer; // the cvar's unit is hours
if ( svs.time >= minRebootTime && !hasHuman ) {
SV_IntegerOverflowShutDown( "Restarting server early to avoid time wrapping and/or precision issues" );
return;
}
if ( minRebootTimeCvar < minRebootTimeConst )
Cvar_Set( "sv_minRebootDelayMins", va( "%d", minRebootTimeConst / (60 * 1000) ) );
// If the time is close to hitting the 32nd bit, kick all clients and clear svs.time
// rather than checking for negative time wraparound everywhere.