src/openttd.cpp
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 10991 d8811e327d12
--- a/src/openttd.cpp	Tue Jun 17 10:32:49 2008 +0000
+++ b/src/openttd.cpp	Tue Jun 17 13:22:13 2008 +0000
@@ -286,7 +286,7 @@
  * @param res variable to store the resolution in.
  * @param s   the string to decompose.
  */
-static void ParseResolution(int res[2], const char *s)
+static void ParseResolution(Dimension *res, const char *s)
 {
 	const char *t = strchr(s, 'x');
 	if (t == NULL) {
@@ -294,8 +294,8 @@
 		return;
 	}
 
-	res[0] = max(strtoul(s, NULL, 0), 64UL);
-	res[1] = max(strtoul(t + 1, NULL, 0), 64UL);
+	res->width  = max(strtoul(s, NULL, 0), 64UL);
+	res->height = max(strtoul(t + 1, NULL, 0), 64UL);
 }
 
 static void InitializeDynamicVariables()
@@ -377,7 +377,7 @@
 	int i;
 	const char *optformat;
 	char musicdriver[32], sounddriver[32], videodriver[32], blitter[32];
-	int resolution[2] = {0, 0};
+	Dimension resolution = {0, 0};
 	Year startyear = INVALID_YEAR;
 	uint generation_seed = GENERATE_NEW_SEED;
 	bool save_config = true;
@@ -442,7 +442,7 @@
 			debuglog_conn = mgo.opt;
 			break;
 #endif /* ENABLE_NETWORK */
-		case 'r': ParseResolution(resolution, mgo.opt); break;
+		case 'r': ParseResolution(&resolution, mgo.opt); break;
 		case 't': startyear = atoi(mgo.opt); break;
 		case 'd': {
 #if defined(WIN32)
@@ -495,14 +495,14 @@
 	if (!StrEmpty(sounddriver)) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
 	if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
 	if (!StrEmpty(blitter))     ttd_strlcpy(_ini_blitter, blitter, sizeof(_ini_blitter));
-	if (resolution[0] != 0) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; }
+	if (resolution.width != 0) { _cur_resolution = resolution; }
 	if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
 	if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
 
 	/* The width and height must be at least 1 pixel, this
 	 * way all internal drawing routines work correctly. */
-	if (_cur_resolution[0] == 0) _cur_resolution[0] = 1;
-	if (_cur_resolution[1] == 0) _cur_resolution[1] = 1;
+	if (_cur_resolution.width  <= 0) _cur_resolution.width  = 1;
+	if (_cur_resolution.height <= 0) _cur_resolution.height = 1;
 
 #if defined(ENABLE_NETWORK)
 	if (dedicated_host) snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", dedicated_host);