From: FruitieX Date: Wed, 9 Jun 2010 13:38:40 +0000 (+0300) Subject: cap grid size to >= 2 to prevent accidental crashing (extremely small grid sizes... X-Git-Tag: xonotic-v0.1.0preview~541^2~88 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=179b561d9bc03323f05114ea3710616e4c238de7;p=xonotic%2Fxonotic-data.pk3dir.git cap grid size to >= 2 to prevent accidental crashing (extremely small grid sizes = very long loops drawing all the lines) --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 48be6f8d3..fa5b94ca0 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3805,14 +3805,14 @@ void HUD_Main (void) { float i; // x-axis - for(i = 0; i < vid_conwidth/cvar("hud_configure_grid_x"); ++i) + for(i = 0; i < vid_conwidth/max(2, cvar("hud_configure_grid_x")); ++i) { - drawfill(eX * i * cvar("hud_configure_grid_x"), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL); + drawfill(eX * i * max(2, cvar("hud_configure_grid_x")), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL); } // y-axis - for(i = 0; i < vid_conheight/cvar("hud_configure_grid_y"); ++i) + for(i = 0; i < vid_conheight/max(2, cvar("hud_configure_grid_y")); ++i) { - drawfill(eY * i * cvar("hud_configure_grid_y"), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL); + drawfill(eY * i * max(2, cvar("hud_configure_grid_y")), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL); } }