From 863d0e08e3ed4017f0c0ec64720aae274f794927 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 18 Jun 2011 18:33:20 +0000 Subject: [PATCH] (svn r22597) [1.1] -Backport from trunk: - Fix: Callback result for airport layout name was incorrectly used (r22496) - Fix: Airport preview sprite can depend on the layout, so update the cached SpriteID when the layout changes (r22494) - Fix: Engine IDs for coal and mail wagons were swapped in the TTO savegame conversion [FS#4622] (r22487) - Fix: The caption of centered windows could be moved out of the main window and thus become inaccessible when resizing the main window (r22485, r22484) --- src/airport_gui.cpp | 7 ++----- src/newgrf_airport.cpp | 2 +- src/saveload/oldloader_sl.cpp | 10 +++++----- src/settings_gui.cpp | 2 ++ src/window.cpp | 27 +++++++-------------------- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 649fef4a2c..75f222306a 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -422,11 +422,6 @@ public: _selected_airport_index = airport_index; _selected_airport_layout = 0; - if (_selected_airport_index != -1) { - const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index); - this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout); - } - this->UpdateSelectSize(); this->SetDirty(); } @@ -445,6 +440,8 @@ public: if (rotation == DIR_E || rotation == DIR_W) Swap(w, h); SetTileSelectSize(w, h); + this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout); + this->SetWidgetDisabledState(BAIRW_LAYOUT_DECREASE, _selected_airport_layout == 0); this->SetWidgetDisabledState(BAIRW_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table); diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index ad02efd8d8..f5918c8ee4 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -249,5 +249,5 @@ StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callb group = SpriteGroup::Resolve(as->grf_prop.spritegroup[0], &object); if (group == NULL) return STR_UNDEFINED; - return GetGRFStringID(as->grf_prop.grffile->grfid, 0xD000 + group->GetResult()); + return GetGRFStringID(as->grf_prop.grffile->grfid, 0xD000 + group->GetCallbackResult()); } diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index 9a4092e92c..d44ba6ed0b 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -355,14 +355,14 @@ static bool FixTTOEngines() static const EngineID ttd_to_tto[] = { 0, 255, 255, 255, 255, 255, 255, 255, 5, 7, 8, 9, 10, 11, 12, 13, 255, 255, 255, 255, 255, 255, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 25, 26, 27, 29, 28, 30, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31, 255, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 45, 46, 255, 255, 255, 255, 47, 48, 255, 49, 50, - 255, 255, 255, 255, 51, 52, 255, 53, 54, 255, 55, 56, 255, 57, 58, 255, - 59, 60, 255, 61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 51, 52, 255, 53, 54, 255, 55, 56, 255, 57, 59, 255, + 58, 60, 255, 61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 67, 68, 69, 70, @@ -374,8 +374,8 @@ static bool FixTTOEngines() /** TTO->TTD remapping of engines. SVXConverter uses the same table. */ static const EngineID tto_to_ttd[] = { 0, 0, 8, 8, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 15, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 55, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 116, 116, 117, 118, 123, + 23, 24, 25, 26, 27, 29, 28, 30, 31, 32, 33, 34, 35, 36, 37, 55, + 57, 59, 58, 60, 61, 62, 63, 64, 65, 66, 67, 116, 116, 117, 118, 123, 124, 126, 127, 132, 133, 135, 136, 138, 139, 141, 142, 144, 145, 147, 148, 150, 151, 153, 154, 204, 205, 206, 207, 208, 211, 212, 211, 212, 211, 212, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 0656ed60f4..2a7477afcb 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -475,6 +475,8 @@ struct GameOptionsWindow : Window { missing_files = BaseMusic::GetUsedSet()->GetNumInvalid() == 0; this->GetWidget(GOW_BASE_MUSIC_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_MUSIC_STATUS, STR_NULL); + + InitGRFTownGeneratorNames(); } }; diff --git a/src/window.cpp b/src/window.cpp index b167cbb787..e5f5250d8c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1550,12 +1550,13 @@ static void EnsureVisibleCaption(Window *w, int nx, int ny) /* Make sure the title bar isn't hidden behind the main tool bar or the status bar. */ PreventHiding(&nx, &ny, caption_rect, FindWindowById(WC_MAIN_TOOLBAR, 0), w->left, PHD_DOWN); PreventHiding(&nx, &ny, caption_rect, FindWindowById(WC_STATUS_BAR, 0), w->left, PHD_UP); - - if (w->viewport != NULL) { - w->viewport->left += nx - w->left; - w->viewport->top += ny - w->top; - } } + + if (w->viewport != NULL) { + w->viewport->left += nx - w->left; + w->viewport->top += ny - w->top; + } + w->left = nx; w->top = ny; } @@ -2801,25 +2802,11 @@ void RelocateAllWindows(int neww, int newh) top = w->top; if (top + (w->height >> 1) >= newh) top = newh - w->height; - - const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - if (wt != NULL) { - if (top < wt->height && wt->left < (w->left + w->width) && (wt->left + wt->width) > w->left) top = wt->height; - if (top >= newh) top = newh - 1; - } else { - if (top < 0) top = 0; - } break; } } - if (w->viewport != NULL) { - w->viewport->left += left - w->left; - w->viewport->top += top - w->top; - } - - w->left = left; - w->top = top; + EnsureVisibleCaption(w, left, top); } }