540 /* don't allow too fast scrolling */ |
540 /* don't allow too fast scrolling */ |
541 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
541 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
542 w->HandleButtonClick(6); |
542 w->HandleButtonClick(6); |
543 w->SetDirty(); |
543 w->SetDirty(); |
544 |
544 |
545 _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); |
545 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR); |
546 SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
546 SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
547 } |
547 } |
548 _left_button_clicked = false; |
548 _left_button_clicked = false; |
549 } |
549 } |
550 |
550 |
551 static void ToolbarScenDateForward(Window *w) |
551 static void ToolbarScenDateForward(Window *w) |
553 /* don't allow too fast scrolling */ |
553 /* don't allow too fast scrolling */ |
554 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
554 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
555 w->HandleButtonClick(7); |
555 w->HandleButtonClick(7); |
556 w->SetDirty(); |
556 w->SetDirty(); |
557 |
557 |
558 _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); |
558 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR); |
559 SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
559 SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
560 } |
560 } |
561 _left_button_clicked = false; |
561 _left_button_clicked = false; |
562 } |
562 } |
563 |
563 |
564 static void ToolbarScenMapTownDir(Window *w) |
564 static void ToolbarScenMapTownDir(Window *w) |
903 DoZoomInOutWindow(ZOOM_NONE, this); |
903 DoZoomInOutWindow(ZOOM_NONE, this); |
904 } |
904 } |
905 |
905 |
906 virtual void OnPaint() |
906 virtual void OnPaint() |
907 { |
907 { |
908 this->SetWidgetDisabledState(6, _patches_newgame.starting_year <= MIN_YEAR); |
908 this->SetWidgetDisabledState(6, _settings_newgame.game_creation.starting_year <= MIN_YEAR); |
909 this->SetWidgetDisabledState(7, _patches_newgame.starting_year >= MAX_YEAR); |
909 this->SetWidgetDisabledState(7, _settings_newgame.game_creation.starting_year >= MAX_YEAR); |
910 |
910 |
911 /* Draw brown-red toolbar bg. */ |
911 /* Draw brown-red toolbar bg. */ |
912 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); |
912 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); |
913 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
913 GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4 | (1 << PALETTE_MODIFIER_GREYOUT)); |
914 |
914 |
915 this->DrawWidgets(); |
915 this->DrawWidgets(); |
916 |
916 |
917 SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
917 SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); |
918 DrawStringCenteredTruncated(this->widget[6].right, this->widget[7].left, 6, STR_00AF, TC_FROMSTRING); |
918 DrawStringCenteredTruncated(this->widget[6].right, this->widget[7].left, 6, STR_00AF, TC_FROMSTRING); |
919 |
919 |
920 /* We hide this panel when the toolbar space gets too small */ |
920 /* We hide this panel when the toolbar space gets too small */ |
921 if (this->widget[4].left != this->widget[4].right) { |
921 if (this->widget[4].left != this->widget[4].right) { |
922 DrawStringCenteredTruncated(this->widget[4].left + 1, this->widget[4].right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); |
922 DrawStringCenteredTruncated(this->widget[4].left + 1, this->widget[4].right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); |