Mercurial > hg > openttd
changeset 5885:e0a6ce7c45b8 draft
(svn r8497) -Codechange: Increase the size of the sound/video/music-drivers to 32 bytes (instead of 16) so their actual parameters can be passed. Sound has for example 'bufsize' and 'hz'. Also use the recently introduced StrEmpty().
author | Darkvater <Darkvater@openttd.org> |
---|---|
date | Wed, 31 Jan 2007 20:20:36 +0000 |
parents | c36fd99592cb |
children | 28dcf755e961 |
files | src/openttd.cpp src/variables.h |
diffstat | 2 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -149,7 +149,7 @@ "\n" "Command line options:\n" " -v drv = Set video driver (see below)\n" - " -s drv = Set sound driver (see below)\n" + " -s drv = Set sound driver (see below) (param bufsize,hz)\n" " -m drv = Set music driver (see below)\n" " -r res = Set resolution (for instance 800x600)\n" " -h = Display this help text\n" @@ -337,7 +337,7 @@ { int i; const char *optformat; - char musicdriver[16], sounddriver[16], videodriver[16]; + char musicdriver[32], sounddriver[32], videodriver[32]; int resolution[2] = {0,0}; Year startyear = INVALID_YEAR; uint generation_seed = GENERATE_NEW_SEED; @@ -350,7 +350,7 @@ uint16 dedicated_port = 0; #endif /* ENABLE_NETWORK */ - musicdriver[0] = sounddriver[0] = videodriver[0] = 0; + musicdriver[0] = sounddriver[0] = videodriver[0] = '\0'; _game_mode = GM_MENU; _switch_mode = SM_MENU; @@ -381,14 +381,13 @@ strcpy(sounddriver, "null"); strcpy(videodriver, "dedicated"); dedicated = true; - if (mgo.opt != NULL) - { + if (mgo.opt != NULL) { /* Use the existing method for parsing (openttd -n). * However, we do ignore the #player part. */ const char *temp = NULL; const char *port = NULL; ParseConnectionString(&temp, &port, mgo.opt); - if (*mgo.opt != '\0') dedicated_host = mgo.opt; + if (!StrEmpty(mgo.opt)) dedicated_host = mgo.opt; if (port != NULL) dedicated_port = atoi(port); } break; @@ -440,10 +439,10 @@ LoadFromHighScore(); // override config? - if (musicdriver[0]) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver)); - if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver)); - if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver)); - if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; } + if (!StrEmpty(musicdriver)) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver)); + if (!StrEmpty(sounddriver)) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver)); + if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver)); + if (resolution[0] != 0) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; } if (startyear != INVALID_YEAR) _patches_newgame.starting_year = startyear; if (generation_seed != GENERATE_NEW_SEED) _patches_newgame.generation_seed = generation_seed;
--- a/src/variables.h +++ b/src/variables.h @@ -312,7 +312,7 @@ VARDEF Vehicle *_place_clicked_vehicle; -VARDEF char _ini_videodriver[16], _ini_musicdriver[16], _ini_sounddriver[16]; +VARDEF char _ini_videodriver[32], _ini_musicdriver[32], _ini_sounddriver[32]; // Used for dynamic language support typedef struct {