summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 625a1b8f8..ffbb59e2d 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -149,7 +149,7 @@ static void showhelp(void)
"\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 ttd_main(int argc, char *argv[])
{
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 @@ int ttd_main(int argc, char *argv[])
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 @@ int ttd_main(int argc, char *argv[])
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 @@ int ttd_main(int argc, char *argv[])
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;