summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
committerbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
commit753b5724001079c3352d23a911488044884dcf5b (patch)
treedc2a5593c6d3da96528beb914da8807aea2325e7 /settings_gui.c
parente383584988a99dbdfbcd4a63b1f11213a4274355 (diff)
downloadopenttd-753b5724001079c3352d23a911488044884dcf5b.tar.xz
(svn r6619) -Codechange: Use accessors for disabled_state.
Another step toward merging XTDwidget. The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/settings_gui.c b/settings_gui.c
index cbe3b5f79..f5d100b63 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -95,7 +95,9 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
int i;
StringID str = STR_02BE_DEFAULT;
- w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21);
+
+ SetWindowWidgetDisabledState(w, 21, !(_vehicle_design_names & 1));
+ if (!IsWindowWidgetDisabled(w, 21)) str = STR_02BF_CUSTOM;
SetDParam(0, str);
SetDParam(1, _currency_specs[_opt_ptr->currency].name);
SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units);
@@ -381,17 +383,15 @@ static GameOptions _opt_mod_temp;
static void GameDifficultyWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- case WE_CREATE: /* Setup disabled buttons when creating window */
- // disable all other difficulty buttons during gameplay except for 'custom'
- w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
-
- if (_game_mode == GM_EDITOR) SETBIT(w->disabled_state, 7);
+ case WE_CREATE: // Setup disabled buttons when creating window
+ /* disable all other difficulty buttons during gameplay except for 'custom' */
+ SetWindowWidgetDisabledState(w, 3, _game_mode == GM_NORMAL);
+ SetWindowWidgetDisabledState(w, 4, _game_mode == GM_NORMAL);
+ SetWindowWidgetDisabledState(w, 5, _game_mode == GM_NORMAL);
+ SetWindowWidgetDisabledState(w, 6, _game_mode == GM_NORMAL);
+ SetWindowWidgetDisabledState(w, 7, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
+ SetWindowWidgetDisabledState(w, 10, _networking && !_network_server); // Save-button in multiplayer (and if client)
- if (_networking) {
- SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer
- if (!_network_server)
- SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client)
- }
break;
case WE_PAINT: {
uint32 click_a, click_b, disabled;
@@ -1049,7 +1049,9 @@ void ShowNewgrf(void)
w->vscroll.cap = 12;
w->vscroll.count = count;
w->vscroll.pos = 0;
- w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7);
+ DisableWindowWidget(w, 5); // Small up arrow
+ DisableWindowWidget(w, 6); // Small sown arrow
+ DisableWindowWidget(w, 7); // Set parameter button
}
/**