~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/toolbar_gui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman
  • Date: 2009-06-09 21:46:28 UTC
  • mfrom: (1.1.7 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090609214628-6z5uodi6178z050l
[ Matthijs Kooijman ]
* New upstream release.
* Link against libicu to enable right-to-left language support. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: toolbar_gui.cpp 15723 2009-03-15 15:12:06Z rubidium $ */
 
1
/* $Id: toolbar_gui.cpp 16481 2009-05-31 12:18:03Z rubidium $ */
2
2
 
3
3
/** @file toolbar_gui.cpp Code related to the (main) toolbar. */
4
4
 
167
167
        void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const
168
168
        {
169
169
                CompanyID company = (CompanyID)result;
 
170
 
 
171
                /* It's possible the company is deleted while the dropdown is open */
 
172
                if (!IsValidCompanyID(company)) return;
 
173
 
170
174
                DrawCompanyIcon(company, x + 2, y + 1);
171
175
 
172
176
                SetDParam(0, company);
784
788
                w->HandleButtonClick(TBSE_DATEBACKWARD);
785
789
                w->SetDirty();
786
790
 
787
 
                _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR);
788
 
                SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
 
791
                _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR);
 
792
                SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
789
793
        }
790
794
        _left_button_clicked = false;
791
795
}
797
801
                w->HandleButtonClick(TBSE_DATEFORWARD);
798
802
                w->SetDirty();
799
803
 
800
 
                _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR);
801
 
                SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
 
804
                _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR);
 
805
                SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
802
806
        }
803
807
        _left_button_clicked = false;
804
808
}
1233
1237
 
1234
1238
        virtual void OnPaint()
1235
1239
        {
1236
 
                this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
1237
 
                this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
 
1240
                this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR);
 
1241
                this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR);
1238
1242
 
1239
1243
                /* Draw brown-red toolbar bg. */
1240
1244
                GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
1242
1246
 
1243
1247
                this->DrawWidgets();
1244
1248
 
1245
 
                SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
 
1249
                SetDParam(0, ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
1246
1250
                DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING);
1247
1251
 
1248
1252
                /* We hide this panel when the toolbar space gets too small */