summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2007-01-31 20:20:36 +0000
committerDarkvater <darkvater@openttd.org>2007-01-31 20:20:36 +0000
commitc5c0a54a5020e911f0375db8dfbf228032a5773a (patch)
treec2f4c35c11c20e29965ea5917120f1e84e36bae8 /src
parent63a5b0e8bea3a3d253b6d2dac88dd3e9cc84224c (diff)
downloadopenttd-c5c0a54a5020e911f0375db8dfbf228032a5773a.tar.xz
(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().
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp19
-rw-r--r--src/variables.h2
2 files changed, 10 insertions, 11 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;
diff --git a/src/variables.h b/src/variables.h
index 049730f43..420be73ed 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -312,7 +312,7 @@ VARDEF SmallFiosItem _file_to_saveload;
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 {