summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-08-24 09:15:09 +0000
committerdominik <dominik@openttd.org>2004-08-24 09:15:09 +0000
commitce0f8a7bcd77d910554768c790f9f5103697da6a (patch)
tree568964958ce08d39115372db9dcd1b42c206a956
parent07b53f23b743e4090686cf7bf4d933e5d2638df3 (diff)
downloadopenttd-ce0f8a7bcd77d910554768c790f9f5103697da6a.tar.xz
(svn r129) Fix: no more same multiple resolutions due to incorrect SDL implementation (Tron)
-rw-r--r--sdl.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sdl.c b/sdl.c
index f12dbde30..6fea23c06 100644
--- a/sdl.c
+++ b/sdl.c
@@ -243,17 +243,22 @@ static void GetVideoModes(void) {
memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
_num_resolutions = sizeof(default_resolutions) / (sizeof(uint16)*2);
} else {
- int n = 0, w = 0, h = 0;
+ int n = 0;
for(i = 0; modes[i]; i++) {
- if(w == modes[i]->w && h == modes[i]->h) continue; // don't show same resolutions multiple times
- w = modes[i]->w;
- h = modes[i]->h;
+ int w = modes[i]->w;
+ int h = modes[i]->h;
if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH+1) &&
IS_INT_INSIDE(h, 480, MAX_SCREEN_HEIGHT+1) &&
w%8 == 0 && h%8 == 0) { // disable screen resolutions which are not multiples of 8
- _resolutions[n][0] = w;
- _resolutions[n][1] = h;
- if (++n == sizeof(_resolutions) / (sizeof(uint16)*2)) break;
+ int j;
+ for (j = 0; j < n; ++j)
+ if (_resolutions[j][0] == w && _resolutions[j][1] == h)
+ break;
+ if (j == n) {
+ _resolutions[n][0] = w;
+ _resolutions[n][1] = h;
+ if (++n == sizeof(_resolutions) / (sizeof(uint16)*2)) break;
+ }
}
}
_num_resolutions = n;