]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cap grid size to >= 2 to prevent accidental crashing (extremely small grid sizes...
authorFruitieX <rasse@rasse-lappy.localdomain>
Wed, 9 Jun 2010 13:38:40 +0000 (16:38 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Wed, 9 Jun 2010 13:38:40 +0000 (16:38 +0300)
qcsrc/client/hud.qc

index 48be6f8d30f7b1010560ae3706915c1fcbb7db3f..fa5b94ca0abd0c292a77b69b2b4ab3be3ed9aeb5 100644 (file)
@@ -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);
                }
        }