Changeset - r10615:151b5d3fccb0
[Not reviewed]
master
0 9 0
peter1138 - 15 years ago 2009-01-08 11:06:07
peter1138@openttd.org
(svn r14907) -Codechange: Remove 32 character limit from driver/blitter selection and parameters.
9 files changed with 47 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/blitter/factory.hpp
Show inline comments
 
@@ -152,9 +152,9 @@ public:
 
	/**
 
	 * Get the long, human readable, name for the Blitter-class.
 
	 */
 
	const char *GetName();
 
};
 

	
 
extern char _ini_blitter[32];
 
extern char *_ini_blitter;
 

	
 
#endif /* BLITTER_FACTORY_HPP */
src/driver.cpp
Show inline comments
 
@@ -9,24 +9,24 @@
 

	
 
#include "sound/sound_driver.hpp"
 
#include "music/music_driver.hpp"
 
#include "video/video_driver.hpp"
 

	
 
VideoDriver *_video_driver;
 
char _ini_videodriver[32];
 
char *_ini_videodriver;
 
int _num_resolutions;
 
Dimension _resolutions[32];
 
Dimension _cur_resolution;
 

	
 
SoundDriver *_sound_driver;
 
char _ini_sounddriver[32];
 
char *_ini_sounddriver;
 

	
 
MusicDriver *_music_driver;
 
char _ini_musicdriver[32];
 
char *_ini_musicdriver;
 

	
 
char _ini_blitter[32];
 
char *_ini_blitter;
 

	
 
static const char* GetDriverParam(const char* const* parm, const char* name)
 
{
 
	size_t len;
 

	
 
	if (parm == NULL) return NULL;
 
@@ -60,13 +60,13 @@ int GetDriverParamInt(const char* const*
 
 * @post Sets the driver so GetCurrentDriver() returns it too.
 
 */
 
const Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
 
{
 
	if (GetDrivers().size() == 0) return NULL;
 

	
 
	if (*name == '\0') {
 
	if (StrEmpty(name)) {
 
		/* Probe for this driver */
 
		for (int priority = 10; priority >= 0; priority--) {
 
			Drivers::iterator it = GetDrivers().begin();
 
			for (; it != GetDrivers().end(); ++it) {
 
				DriverFactoryBase *d = (*it).second;
 

	
src/gfxinit.cpp
Show inline comments
 
@@ -31,13 +31,13 @@ PaletteType _use_palette = PAL_AUTODETEC
 
bool _palette_remap_grf[MAX_FILE_SLOTS];
 
/** Palette map to go from the !_use_palette to the _use_palette */
 
const byte *_palette_remap = NULL;
 
/** Palette map to go from the _use_palette to the !_use_palette */
 
const byte *_palette_reverse_remap = NULL;
 

	
 
char _ini_graphics_set[32];
 
char *_ini_graphics_set;
 

	
 
/** Structure holding filename and MD5 information about a single file */
 
struct MD5File {
 
	const char *filename;        ///< filename
 
	uint8 hash[16];              ///< md5 sum of the file
 
	const char *missing_warning; ///< warning when this file is missing
src/gfxinit.h
Show inline comments
 
@@ -12,9 +12,9 @@ void GfxLoadSprites();
 
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl);
 

	
 
void FindGraphicsSets();
 
bool SetGraphicsSet(const char *name);
 
char *GetGraphicsSetsList(char *p, const char *last);
 

	
 
extern char _ini_graphics_set[32];
 
extern char *_ini_graphics_set;
 

	
 
#endif /* GFXINIT_H */
src/music/music_driver.hpp
Show inline comments
 
@@ -30,9 +30,9 @@ public:
 
	 * Get the long, human readable, name for the Driver-class.
 
	 */
 
	const char *GetName();
 
};
 

	
 
extern MusicDriver *_music_driver;
 
extern char _ini_musicdriver[32];
 
extern char *_ini_musicdriver;
 

	
 
#endif /* MUSIC_MUSIC_DRIVER_HPP */
src/openttd.cpp
Show inline comments
 
@@ -388,13 +388,17 @@ extern void DedicatedFork();
 
#endif
 

	
 
int ttd_main(int argc, char *argv[])
 
{
 
	int i;
 
	const char *optformat;
 
	char musicdriver[32], sounddriver[32], videodriver[32], blitter[32], graphics_set[32];
 
	char *musicdriver = NULL;
 
	char *sounddriver = NULL;
 
	char *videodriver = NULL;
 
	char *blitter = NULL;
 
	char *graphics_set = NULL;
 
	Dimension resolution = {0, 0};
 
	Year startyear = INVALID_YEAR;
 
	uint generation_seed = GENERATE_NEW_SEED;
 
	bool save_config = true;
 
#if defined(ENABLE_NETWORK)
 
	bool dedicated = false;
 
@@ -402,14 +406,12 @@ int ttd_main(int argc, char *argv[])
 
	char *network_conn = NULL;
 
	char *debuglog_conn = NULL;
 
	char *dedicated_host = NULL;
 
	uint16 dedicated_port = 0;
 
#endif /* ENABLE_NETWORK */
 

	
 
	musicdriver[0] = sounddriver[0] = videodriver[0] = blitter[0] = graphics_set[0] = '\0';
 

	
 
	_game_mode = GM_MENU;
 
	_switch_mode = SM_MENU;
 
	_switch_mode_errorstr = INVALID_STRING_ID;
 
	_dedicated_forks = false;
 
	_config_file = NULL;
 

	
 
@@ -424,17 +426,17 @@ int ttd_main(int argc, char *argv[])
 
	;
 

	
 
	MyGetOptData mgo(argc - 1, argv + 1, optformat);
 

	
 
	while ((i = MyGetOpt(&mgo)) != -1) {
 
		switch (i) {
 
		case 'I': strecpy(graphics_set, mgo.opt, lastof(graphics_set)); break;
 
		case 'm': strecpy(musicdriver, mgo.opt, lastof(musicdriver)); break;
 
		case 's': strecpy(sounddriver, mgo.opt, lastof(sounddriver)); break;
 
		case 'v': strecpy(videodriver, mgo.opt, lastof(videodriver)); break;
 
		case 'b': strecpy(blitter, mgo.opt, lastof(blitter)); break;
 
		case 'I': free(graphics_set); graphics_set = strdup(mgo.opt); break;
 
		case 'm': free(musicdriver); musicdriver = strdup(mgo.opt); break;
 
		case 's': free(sounddriver); sounddriver = strdup(mgo.opt); break;
 
		case 'v': free(videodriver); videodriver = strdup(mgo.opt); break;
 
		case 'b': free(blitter); blitter = strdup(mgo.opt); break;
 
#if defined(ENABLE_NETWORK)
 
		case 'D':
 
			strcpy(musicdriver, "null");
 
			strcpy(sounddriver, "null");
 
			strcpy(videodriver, "dedicated");
 
			strcpy(blitter, "null");
 
@@ -528,17 +530,33 @@ int ttd_main(int argc, char *argv[])
 
	LoadFromConfig();
 
	CheckConfig();
 
	LoadFromHighScore();
 

	
 

	
 
	/* override config? */
 
	if (!StrEmpty(graphics_set)) strecpy(_ini_graphics_set, graphics_set, lastof(_ini_graphics_set));
 
	if (!StrEmpty(musicdriver)) strecpy(_ini_musicdriver, musicdriver, lastof(_ini_musicdriver));
 
	if (!StrEmpty(sounddriver)) strecpy(_ini_sounddriver, sounddriver, lastof(_ini_sounddriver));
 
	if (!StrEmpty(videodriver)) strecpy(_ini_videodriver, videodriver, lastof(_ini_videodriver));
 
	if (!StrEmpty(blitter))     strecpy(_ini_blitter, blitter, lastof(_ini_blitter));
 
	if (!StrEmpty(graphics_set)) {
 
		free(_ini_graphics_set);
 
		_ini_graphics_set = graphics_set;
 
	}
 
	if (!StrEmpty(musicdriver)) {
 
		free(_ini_musicdriver);
 
		_ini_musicdriver = musicdriver;
 
	}
 
	if (!StrEmpty(sounddriver)) {
 
		free(_ini_sounddriver);
 
		_ini_sounddriver = sounddriver;
 
	}
 
	if (!StrEmpty(videodriver)) {
 
		free(_ini_videodriver);
 
		_ini_videodriver = videodriver;
 
	}
 
	if (!StrEmpty(blitter)) {
 
		free(_ini_blitter);
 
		_ini_blitter = blitter;
 
	}
 

	
 
	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. */
src/settings.cpp
Show inline comments
 
@@ -1158,17 +1158,17 @@ static const SettingDescGlobVarList _win
 
#endif /* WIN32 */
 

	
 
static const SettingDescGlobVarList _misc_settings[] = {
 
	SDTG_MMANY("display_opt",     SLE_UINT8, S, 0, _display_opt,       (1 << DO_SHOW_TOWN_NAMES | 1 << DO_SHOW_STATION_NAMES | 1 << DO_SHOW_SIGNS | 1 << DO_FULL_ANIMATION | 1 << DO_FULL_DETAIL | 1 << DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION||FULL_DETAIL|WAYPOINTS", STR_NULL, NULL),
 
	 SDTG_BOOL("news_ticker_sound",          S, 0, _news_ticker_sound,     true,    STR_NULL, NULL),
 
	 SDTG_BOOL("fullscreen",                 S, 0, _fullscreen,           false,    STR_NULL, NULL),
 
	  SDTG_STR("graphicsset",      SLE_STRB,C|S,0, _ini_graphics_set,      NULL,    STR_NULL, NULL),
 
	  SDTG_STR("videodriver",      SLE_STRB,C|S,0, _ini_videodriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("musicdriver",      SLE_STRB,C|S,0, _ini_musicdriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("sounddriver",      SLE_STRB,C|S,0, _ini_sounddriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("blitter",          SLE_STRB,C|S,0, _ini_blitter,           NULL,    STR_NULL, NULL),
 
	  SDTG_STR("graphicsset",      SLE_STRQ,C|S,0, _ini_graphics_set,      NULL,    STR_NULL, NULL),
 
	  SDTG_STR("videodriver",      SLE_STRQ,C|S,0, _ini_videodriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("musicdriver",      SLE_STRQ,C|S,0, _ini_musicdriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("sounddriver",      SLE_STRQ,C|S,0, _ini_sounddriver,       NULL,    STR_NULL, NULL),
 
	  SDTG_STR("blitter",          SLE_STRQ,C|S,0, _ini_blitter,           NULL,    STR_NULL, NULL),
 
	  SDTG_STR("language",         SLE_STRB, S, 0, _dynlang.curr_file,     NULL,    STR_NULL, NULL),
 
	SDTG_CONDLIST("resolution",  SLE_INT, 2, S, 0, _cur_resolution,   "640,480",    STR_NULL, NULL, 0, SL_MAX_VERSION), // workaround for implicit lengthof() in SDTG_LIST
 
	  SDTG_STR("screenshot_format",SLE_STRB, S, 0, _screenshot_format_name,NULL,    STR_NULL, NULL),
 
	  SDTG_STR("savegame_format",  SLE_STRB, S, 0, _savegame_format,       NULL,    STR_NULL, NULL),
 
	 SDTG_BOOL("rightclick_emulate",         S, 0, _rightclick_emulate,   false,    STR_NULL, NULL),
 
#ifdef WITH_FREETYPE
src/sound/sound_driver.hpp
Show inline comments
 
@@ -25,9 +25,9 @@ public:
 
	 * Get the long, human readable, name for the Driver-class.
 
	 */
 
	const char *GetName();
 
};
 

	
 
extern SoundDriver *_sound_driver;
 
extern char _ini_sounddriver[32];
 
extern char *_ini_sounddriver;
 

	
 
#endif /* SOUND_SOUND_DRIVER_HPP */
src/video/video_driver.hpp
Show inline comments
 
@@ -31,12 +31,12 @@ public:
 
	 * Get the long, human readable, name for the Driver-class.
 
	 */
 
	const char *GetName();
 
};
 

	
 
extern VideoDriver *_video_driver;
 
extern char _ini_videodriver[32];
 
extern char *_ini_videodriver;
 
extern int _num_resolutions;
 
extern Dimension _resolutions[32];
 
extern Dimension _cur_resolution;
 

	
 
#endif /* VIDEO_VIDEO_DRIVER_HPP */
0 comments (0 inline, 0 general)