diff options
author | smatz <smatz@openttd.org> | 2008-06-16 19:38:41 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-06-16 19:38:41 +0000 |
commit | 2299181c4be2a6d53eec62664c7a51e429c9f8a5 (patch) | |
tree | 9779d4c999b30e1a9c2dbf181c1456b5bb688cfc /src/openttd.cpp | |
parent | 0c342f3292af7dd5f563e5bd053ff01bdcd32582 (diff) | |
download | openttd-2299181c4be2a6d53eec62664c7a51e429c9f8a5.tar.xz |
(svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 1861d3cd3..fc540da80 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -285,7 +285,7 @@ md_continue_here:; * @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) { @@ -293,8 +293,8 @@ static void ParseResolution(int res[2], const char *s) 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() @@ -379,7 +379,7 @@ int ttd_main(int argc, char *argv[]) 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; @@ -444,7 +444,7 @@ int ttd_main(int argc, char *argv[]) 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) @@ -497,14 +497,14 @@ int ttd_main(int argc, char *argv[]) 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); |