Changeset - r5885:d15784c1bd77
[Not reviewed]
master
0 2 0
Darkvater - 17 years ago 2007-01-31 20:20:36
darkvater@openttd.org
(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().
2 files changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/openttd.cpp
Show inline comments
 
@@ -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;
 

	
src/variables.h
Show inline comments
 
@@ -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 {
0 comments (0 inline, 0 general)