mirror of https://github.com/OpenTTD/OpenTTD
(svn r120) Fix: (SDL) same resolution was displayed more than once in game options
parent
8277c9df8a
commit
1a8476f02f
12
sdl.c
12
sdl.c
|
@ -236,18 +236,18 @@ static void GetVideoModes(void) {
|
||||||
|
|
||||||
_all_modes = (int)modes == -1;
|
_all_modes = (int)modes == -1;
|
||||||
|
|
||||||
if(modes == NULL) {
|
if(!modes) {
|
||||||
error("sdl: no modes available");
|
error("sdl: no modes available");
|
||||||
} else if((int) modes == -1) {
|
} else if((int) modes == -1) {
|
||||||
// all modes available, put some default ones here
|
// all modes available, put some default ones here
|
||||||
memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
|
memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
|
||||||
_num_resolutions = sizeof(default_resolutions) / (sizeof(uint16)*2);
|
_num_resolutions = sizeof(default_resolutions) / (sizeof(uint16)*2);
|
||||||
} else {
|
} else {
|
||||||
int n = 0;
|
int n = 0, w = 0, h = 0;
|
||||||
|
for(i = 0; modes[i]; i++) {
|
||||||
for(i = 0; modes[i] != NULL; i++) {
|
if(w == modes[i]->w && h == modes[i]->h) continue; // don't show same resolutions multiple times
|
||||||
int w = modes[i]->w;
|
w = modes[i]->w;
|
||||||
int h = modes[i]->h;
|
h = modes[i]->h;
|
||||||
if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH+1) &&
|
if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH+1) &&
|
||||||
IS_INT_INSIDE(h, 480, MAX_SCREEN_HEIGHT+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
|
w%8 == 0 && h%8 == 0) { // disable screen resolutions which are not multiples of 8
|
||||||
|
|
Loading…
Reference in New Issue