mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r14907) -Codechange: Remove 32 character limit from driver/blitter selection and parameters.
This commit is contained in:
parent
c71862174a
commit
6b6fd36050
|
@ -155,6 +155,6 @@ public:
|
|||
const char *GetName();
|
||||
};
|
||||
|
||||
extern char _ini_blitter[32];
|
||||
extern char *_ini_blitter;
|
||||
|
||||
#endif /* BLITTER_FACTORY_HPP */
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
#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)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ const Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type typ
|
|||
{
|
||||
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();
|
||||
|
|
|
@ -34,7 +34,7 @@ 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 {
|
||||
|
|
|
@ -15,6 +15,6 @@ 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 */
|
||||
|
|
|
@ -33,6 +33,6 @@ public:
|
|||
};
|
||||
|
||||
extern MusicDriver *_music_driver;
|
||||
extern char _ini_musicdriver[32];
|
||||
extern char *_ini_musicdriver;
|
||||
|
||||
#endif /* MUSIC_MUSIC_DRIVER_HPP */
|
||||
|
|
|
@ -391,7 +391,11 @@ 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;
|
||||
|
@ -405,8 +409,6 @@ int ttd_main(int argc, char *argv[])
|
|||
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;
|
||||
|
@ -427,11 +429,11 @@ int ttd_main(int argc, char *argv[])
|
|||
|
||||
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");
|
||||
|
@ -531,11 +533,27 @@ int ttd_main(int argc, char *argv[])
|
|||
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -1161,11 +1161,11 @@ 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),
|
||||
|
|
|
@ -28,6 +28,6 @@ public:
|
|||
};
|
||||
|
||||
extern SoundDriver *_sound_driver;
|
||||
extern char _ini_sounddriver[32];
|
||||
extern char *_ini_sounddriver;
|
||||
|
||||
#endif /* SOUND_SOUND_DRIVER_HPP */
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
};
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue