diff options
| author | Joel de Vahl <joel@stalverk80.se> | 2007-07-23 17:43:01 +0000 |
|---|---|---|
| committer | Joel de Vahl <joel@stalverk80.se> | 2007-07-23 17:43:01 +0000 |
| commit | 8be353d62c3f2247485e7ab4940feee5b8f349ab (patch) | |
| tree | a849581c03be002a40f231af4055113b2599db44 /src/game | |
| parent | ab192f794e5e4f87933b07763861790f269f501a (diff) | |
| download | zcatch-8be353d62c3f2247485e7ab4940feee5b8f349ab.tar.gz zcatch-8be353d62c3f2247485e7ab4940feee5b8f349ab.zip | |
Don't crash on settings->video
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/menu.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 1d87a688..4eef008c 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -784,11 +784,13 @@ static int settings_controls_render() return 0; } +static const unsigned MAX_RESOLUTIONS = 8; + static int settings_video_render() { static int resolution_count[2] = {0}; - static int resolutions[2][10][2] = {0}; - static char resolution_names[2][10][128] = {0}; + static int resolutions[2][MAX_RESOLUTIONS][2] = {0}; + static char resolution_names[2][MAX_RESOLUTIONS][128] = {0}; static bool inited = false; if (!inited) @@ -817,10 +819,14 @@ static int settings_video_render() } int resolution_index = resolution_count[depth_index]; - resolution_count[depth_index]++; - resolutions[depth_index][resolution_index][0] = mode.width; - resolutions[depth_index][resolution_index][1] = mode.height; - sprintf(resolution_names[depth_index][resolution_index], "%ix%i", mode.width, mode.height); + if(resolution_index < MAX_RESOLUTIONS) + { + resolution_count[depth_index]++; + resolutions[depth_index][resolution_index][0] = mode.width; + resolutions[depth_index][resolution_index][1] = mode.height; + dbg_msg("res", "%ix%i", mode.width, mode.height); + sprintf(resolution_names[depth_index][resolution_index], "%ix%i", mode.width, mode.height); + } } inited = true; |