summaryrefslogtreecommitdiff
path: root/sdl.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-08-23 18:32:16 +0000
committerdominik <dominik@openttd.org>2004-08-23 18:32:16 +0000
commit1a8476f02f639aac60929598a70395a331423bee (patch)
tree3cbbbf8171751d6c5c4308b9d0d993af576fb043 /sdl.c
parent8277c9df8a5801260f1f92b5f6102da6296568e5 (diff)
downloadopenttd-1a8476f02f639aac60929598a70395a331423bee.tar.xz
(svn r120) Fix: (SDL) same resolution was displayed more than once in game options
Diffstat (limited to 'sdl.c')
-rw-r--r--sdl.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sdl.c b/sdl.c
index 3de59d386..f12dbde30 100644
--- a/sdl.c
+++ b/sdl.c
@@ -235,19 +235,19 @@ static void GetVideoModes(void) {
modes = SDL_CALL SDL_ListModes(NULL, SDL_SWSURFACE + (_fullscreen ? SDL_FULLSCREEN : 0));
_all_modes = (int)modes == -1;
-
- if(modes == NULL) {
+
+ if(!modes) {
error("sdl: no modes available");
} else if((int) modes == -1) {
// all modes available, put some default ones here
memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
_num_resolutions = sizeof(default_resolutions) / (sizeof(uint16)*2);
} else {
- int n = 0;
-
- for(i = 0; modes[i] != NULL; i++) {
- int w = modes[i]->w;
- int h = modes[i]->h;
+ int n = 0, w = 0, h = 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;
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