Fix gravity CVAR crashing when changed from the menu (resolves #106)

This commit is contained in:
katsy 2024-05-19 23:06:37 +00:00 committed by Eidolon
parent 8326292a3f
commit 017a067630
2 changed files with 5 additions and 2 deletions

View file

@ -860,7 +860,7 @@ consvar_t cv_ufo_health = OnlineCheat("ufo_health", "-1").min_max(-1, 100).descr
consvar_t cv_botscanvote = ServerCheat("botscanvote", "No").yes_no();
void Gravity_OnChange(void);
consvar_t cv_gravity = ServerCheat("gravity", "0.8").floating_point().onchange(Gravity_OnChange).description("Change the default gravity"); // change DEFAULT_GRAVITY if you change this
consvar_t cv_gravity = ServerCheat("gravity", "0.8").floating_point().min_max(0, 200*FRACUNIT).onchange(Gravity_OnChange).description("Change the default gravity"); // change DEFAULT_GRAVITY if you change this
consvar_t cv_kartdebugcolorize = ServerCheat("debugcolorize", "Off").on_off().description("Show all colorized options on the HUD");
consvar_t cv_kartdebugdirector = ServerCheat("debugdirector", "Off").on_off().description("Show director AI on the HUD");

View file

@ -88,6 +88,9 @@ static void M_AddFloatVar(consvar_t *cv, fixed_t step)
const CV_PossibleValue_t *values = cv->PossibleValue;
if (values == NULL) //cvar is unbounded and will not work! return is here only as a failsafe to prevent crashes
return;
for (i = 0; values[i].strvalue; ++i)
{
if (cv->value == values[i].value)
@ -220,7 +223,7 @@ static void M_ChangeCvar(INT32 choice)
"Turning on Auto Roulette",
"\"Ring Racers\" is not designed with random items in mind. With Auto Roulette, you cannot select the item results you want or select an item early."
"\n"
"You will be at a distinct \x85" "disadvantage. \x80\n"
"You will be at a distinct \x85" "disadvantage. \x80\n"
"\n"
"ARE YOU SURE?",
M_ChangeCvarResponse,