(svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
- I also changed an order of strings from On, Off to Off, On, so this can be used ingame with the WWT_4 widget type. - Since the newssettings now take 2 bits per setting (off/summary/on) _news_display_opt is widened to 32 bits and the settings code changed slightly to accomodate for a maximum of 16 message-types.
This commit is contained in:
24
settings.c
24
settings.c
@@ -485,12 +485,12 @@ static void make_manyofmany(char *buf, const char *many, uint32 x)
|
||||
|
||||
static const void *string_to_val(const SettingDesc *desc, const char *str)
|
||||
{
|
||||
unsigned long val;
|
||||
uint32 val;
|
||||
char *end;
|
||||
|
||||
switch(desc->flags & 0xF) {
|
||||
case SDT_INTX:
|
||||
val = strtol(str, &end, 0);
|
||||
val = strtoul(str, &end, 0);
|
||||
if (*end != 0) ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name);
|
||||
return (void*)val;
|
||||
case SDT_ONEOFMANY: {
|
||||
@@ -599,7 +599,7 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||
IniItem *item;
|
||||
const void *p;
|
||||
void *ptr;
|
||||
int i = 0;
|
||||
uint32 i = 0;
|
||||
char buf[512]; // setting buffer
|
||||
const char *s;
|
||||
|
||||
@@ -679,7 +679,7 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||
}
|
||||
switch(desc->flags & 0xF) {
|
||||
case SDT_INTX:
|
||||
sprintf(buf, "%d", i);
|
||||
sprintf(buf, "%u", i);
|
||||
break;
|
||||
case SDT_ONEOFMANY:
|
||||
make_oneofmany(buf, (const char*)desc->b, i);
|
||||
@@ -742,7 +742,8 @@ static const SettingDesc win32_settings[] = {
|
||||
|
||||
static const SettingDesc misc_settings[] = {
|
||||
{"display_opt", SDT_MANYOFMANY | SDT_UINT8, (void*)(DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_TRANS_BUILDINGS|DO_WAYPOINTS), &_display_opt, "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|TRANS_BUILDINGS|FULL_DETAIL|WAYPOINTS"},
|
||||
{"news_display_opt", SDT_UINT16, (void*)-1, &_news_display_opt, NULL},
|
||||
{"news_display_opt", SDT_UINT32, "0xAAAAAAAA", &_news_display_opt, NULL}, // default to all full messages: 10101010101010101010 = 0xAAAAAAAA
|
||||
{"news_ticker_sound", SDT_BOOL, (void*)true, &_news_ticker_sound, NULL},
|
||||
{"fullscreen", SDT_BOOL, (void*)false, &_fullscreen, NULL},
|
||||
{"videodriver", SDT_STRINGBUF | (lengthof(_ini_videodriver)<<16) | SDT_NOSAVE,NULL, _ini_videodriver, NULL},
|
||||
{"musicdriver", SDT_STRINGBUF | (lengthof(_ini_musicdriver)<<16) | SDT_NOSAVE,NULL, _ini_musicdriver, NULL},
|
||||
@@ -1051,3 +1052,16 @@ void SaveToConfig(void)
|
||||
ini_save(_config_file, ini);
|
||||
ini_free(ini);
|
||||
}
|
||||
|
||||
void CheckConfig(void)
|
||||
{
|
||||
// fix up news_display_opt from old to new
|
||||
int i;
|
||||
uint32 tmp;
|
||||
for (i = 0, tmp = _news_display_opt; i != 10; i++, tmp >>= 1) {
|
||||
if ((tmp & 0x3) == 0x3) { // old settings
|
||||
_news_display_opt = 0xAAAAAAAA; // set all news-messages to full 1010101010...
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user