From: terencehill Date: Wed, 22 Jan 2020 20:01:02 +0000 (+0100) Subject: Make sure number of lives is an integer and <= 999 X-Git-Tag: xonotic-v0.8.5~1110^2~4^2 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=0a9d43331a8a975ab0b18f524cc8ce8dc18ee446;p=xonotic%2Fxonotic-data.pk3dir.git Make sure number of lives is an integer and <= 999 --- diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index 61a6d701b..bff9722d0 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -10,11 +10,10 @@ int autocvar_g_lms_last_join; bool autocvar_g_lms_regenerate; // main functions -float LMS_NewPlayerLives() +int LMS_NewPlayerLives() { - float fl; - fl = autocvar_fraglimit; - if(fl == 0) + int fl = floor(autocvar_fraglimit); + if(fl == 0 || fl > 999) fl = 999; // first player has left the game for dying too much? Nobody else can get in. @@ -22,7 +21,7 @@ float LMS_NewPlayerLives() return 0; if(!autocvar_g_lms_join_anytime) - if(lms_lowest_lives < fl - autocvar_g_lms_last_join) + if(lms_lowest_lives < fl - max(0, floor(autocvar_g_lms_last_join))) return 0; return bound(1, lms_lowest_lives, fl); @@ -447,5 +446,5 @@ MUTATOR_HOOKFUNCTION(lms, AddPlayerScore) void lms_Initialize() { - lms_lowest_lives = 9999; + lms_lowest_lives = 999; } diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh index 996d371fe..bf02920d2 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qh @@ -3,7 +3,10 @@ #include #include -.float lms_spectate_warning; +// 1 when player presses F3 to spectate for the first time (he only gets a warning) +// 2 when player goes spectator (presses F3 to spectate for the second time) +// 3 when player disconnects +.int lms_spectate_warning; #define autocvar_g_lms_lives_override cvar("g_lms_lives_override") string autocvar_g_lms_weaponarena = "most_available"; @@ -29,5 +32,5 @@ REGISTER_MUTATOR(lms, false) } // lives related defs -float lms_lowest_lives; -float LMS_NewPlayerLives(); +int lms_lowest_lives; +int LMS_NewPlayerLives();