(svn r21656) -Fix [FS#4345] (r3722, r15301): Use a bool instead of uint8 to store a bool and use the dedicated accessor function when reading boolean settings (glx, rubidium)

This commit is contained in:
planetmaker 2010-12-29 13:32:35 +00:00
parent bfc386fe10
commit 6331923653
2 changed files with 2 additions and 2 deletions

View File

@ -1153,7 +1153,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
if (sdb->cmd == SDT_BOOLX) { if (sdb->cmd == SDT_BOOLX) {
static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}}; static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
/* Draw checkbox for boolean-value either on/off */ /* Draw checkbox for boolean-value either on/off */
bool on = (*(bool*)var); bool on = (bool)ReadValue(var, sd->save.conv);
DrawFrameRect(buttons_left, button_y, buttons_left + 19, button_y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); DrawFrameRect(buttons_left, button_y, buttons_left + 19, button_y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE);
SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF); SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);

View File

@ -99,7 +99,7 @@ struct GUISettings {
bool station_dragdrop; ///< whether drag and drop is enabled for stations bool station_dragdrop; ///< whether drag and drop is enabled for stations
bool station_show_coverage; ///< whether to highlight coverage area bool station_show_coverage; ///< whether to highlight coverage area
bool persistent_buildingtools; ///< keep the building tools active after usage bool persistent_buildingtools; ///< keep the building tools active after usage
uint8 expenses_layout; ///< layout of expenses window bool expenses_layout; ///< layout of expenses window
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.