video/sdl_v.c
changeset 4501 f544a0172d5c
parent 4434 a08cb4b5c179
child 4507 8db2d47a6527
equal deleted inserted replaced
4500:6bcd1f6fdc22 4501:f544a0172d5c
   127 		_num_resolutions = n;
   127 		_num_resolutions = n;
   128 		SortResolutions(_num_resolutions);
   128 		SortResolutions(_num_resolutions);
   129 	}
   129 	}
   130 }
   130 }
   131 
   131 
   132 static int GetAvailableVideoMode(int *w, int *h)
   132 static void GetAvailableVideoMode(int *w, int *h)
   133 {
   133 {
   134 	int i;
   134 	int i;
   135 	int best;
   135 	int best;
   136 	uint delta;
   136 	uint delta;
   137 
   137 
   138 	// all modes available?
   138 	// all modes available?
   139 	if (_all_modes)
   139 	if (_all_modes) return;
   140 		return 1;
       
   141 
   140 
   142 	// is the wanted mode among the available modes?
   141 	// is the wanted mode among the available modes?
   143 	for (i = 0; i != _num_resolutions; i++) {
   142 	for (i = 0; i != _num_resolutions; i++) {
   144 		if (*w == _resolutions[i][0] && *h == _resolutions[i][1])
   143 		if (*w == _resolutions[i][0] && *h == _resolutions[i][1]) return;
   145 			return 1;
       
   146 	}
   144 	}
   147 
   145 
   148 	// use the closest possible resolution
   146 	// use the closest possible resolution
   149 	best = 0;
   147 	best = 0;
   150 	delta = abs((_resolutions[0][0] - *w) * (_resolutions[0][1] - *h));
   148 	delta = abs((_resolutions[0][0] - *w) * (_resolutions[0][1] - *h));
   155 			delta = newdelta;
   153 			delta = newdelta;
   156 		}
   154 		}
   157 	}
   155 	}
   158 	*w = _resolutions[best][0];
   156 	*w = _resolutions[best][0];
   159 	*h = _resolutions[best][1];
   157 	*h = _resolutions[best][1];
   160 	return 2;
       
   161 }
   158 }
   162 
   159 
   163 extern const char _openttd_revision[];
   160 extern const char _openttd_revision[];
   164 
   161 
   165 #ifndef ICON_DIR
   162 #ifndef ICON_DIR