From fd48f42a072da8256afcc2afcc0de89318805c91 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 18 Nov 2011 21:19:18 +0000 Subject: [PATCH] (svn r23259) [1.1] -Backport from trunk: - Fix: 3-column view of NewGRF GUI had too much space for certain font sizes (r23251) - Fix: Ignore special characters, such as the train "character", when determining a fallback font (r23237) - Fix: [NewGRF] Make train var 0xF3 consistent with TTDPatch (r23231) - Fix: Invalidate build vehicle window when changing the setting for wagon speed limits (r23211) --- src/newgrf_engine.cpp | 2 +- src/newgrf_gui.cpp | 25 +++++++++++++------------ src/settings.cpp | 1 + src/strings.cpp | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 711f5edec2..7be1485624 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -792,7 +792,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by switch (variable - 0x80) { case 0x62: return t->track; case 0x66: return t->railtype; - case 0x73: return t->gcache.cached_veh_length; + case 0x73: return 0x80 + VEHICLE_LENGTH - t->gcache.cached_veh_length; case 0x74: return t->gcache.cached_power; case 0x75: return GB(t->gcache.cached_power, 8, 24); case 0x76: return GB(t->gcache.cached_power, 16, 16); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index ec67c05eec..77d4fa7e50 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1347,6 +1347,9 @@ public: this->resize_y = this->avs->resize_y; if (this->acs->resize_y > 0 && (this->resize_y == 0 || this->resize_y > this->acs->resize_y)) this->resize_y = this->acs->resize_y; this->resize_y = LeastCommonMultiple(this->resize_y, this->inf->resize_y); + + /* Make sure the height suits the 3 column (resp. not-editable) format; the 2 column format can easily fill space between the lists */ + this->smallest_y = ComputeMaxSize(min_acs_height, this->smallest_y + this->resize_y - 1, this->resize_y); } virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) @@ -1396,8 +1399,9 @@ public: acs_width = ComputeMaxSize(min_acs_width, acs_width, this->acs->GetHorizontalStepSize(sizing)) - this->acs->padding_left - this->acs->padding_right; - uint avs_height = ComputeMaxSize(this->avs->smallest_y, given_height, this->avs->GetVerticalStepSize(sizing)); - uint acs_height = ComputeMaxSize(this->acs->smallest_y, given_height, this->acs->GetVerticalStepSize(sizing)); + /* Never use fill_y on these; the minimal size is choosen, so that the 3 column view looks nice */ + uint avs_height = ComputeMaxSize(this->avs->smallest_y, given_height, this->avs->resize_y); + uint acs_height = ComputeMaxSize(this->acs->smallest_y, given_height, this->acs->resize_y); /* Assign size and position to the childs. */ if (rtl) { @@ -1433,9 +1437,10 @@ public: uint min_acs_height = this->acs->smallest_y + this->acs->padding_top + this->acs->padding_bottom; uint extra_height = given_height - min_acs_height - min_avs_height; - uint avs_height = ComputeMaxSize(this->avs->smallest_y, this->avs->smallest_y + extra_height / 2, this->avs->GetVerticalStepSize(sizing)); + /* Never use fill_y on these; instead use the INTER_LIST_SPACING as filler */ + uint avs_height = ComputeMaxSize(this->avs->smallest_y, this->avs->smallest_y + extra_height / 2, this->avs->resize_y); if (this->editable) extra_height -= avs_height - this->avs->smallest_y; - uint acs_height = ComputeMaxSize(this->acs->smallest_y, this->acs->smallest_y + extra_height, this->acs->GetVerticalStepSize(sizing)); + uint acs_height = ComputeMaxSize(this->acs->smallest_y, this->acs->smallest_y + extra_height, this->acs->resize_y); /* Assign size and position to the childs. */ if (rtl) { @@ -1443,20 +1448,16 @@ public: this->inf->AssignSizePosition(sizing, x, y + this->inf->padding_top, inf_width, inf_height, rtl); x += inf_width + this->inf->padding_right + INTER_COLUMN_SPACING; - uint ypos = y + this->acs->padding_top; - this->acs->AssignSizePosition(sizing, x + this->acs->padding_left, ypos, acs_width, acs_height, rtl); + this->acs->AssignSizePosition(sizing, x + this->acs->padding_left, y + this->acs->padding_top, acs_width, acs_height, rtl); if (this->editable) { - ypos += acs_height + this->acs->padding_bottom + INTER_LIST_SPACING + this->avs->padding_top; - this->avs->AssignSizePosition(sizing, x + this->avs->padding_left, ypos, avs_width, avs_height, rtl); + this->avs->AssignSizePosition(sizing, x + this->avs->padding_left, y + given_height - avs_height - this->avs->padding_bottom, avs_width, avs_height, rtl); } else { this->avs->AssignSizePosition(sizing, 0, 0, this->avs->smallest_x, this->avs->smallest_y, rtl); } } else { - uint ypos = y + this->acs->padding_top; - this->acs->AssignSizePosition(sizing, x + this->acs->padding_left, ypos, acs_width, acs_height, rtl); + this->acs->AssignSizePosition(sizing, x + this->acs->padding_left, y + this->acs->padding_top, acs_width, acs_height, rtl); if (this->editable) { - ypos += acs_height + this->acs->padding_bottom + INTER_LIST_SPACING + this->avs->padding_top; - this->avs->AssignSizePosition(sizing, x + this->avs->padding_left, ypos, avs_width, avs_height, rtl); + this->avs->AssignSizePosition(sizing, x + this->avs->padding_left, y + given_height - avs_height - this->avs->padding_bottom, avs_width, avs_height, rtl); } else { this->avs->AssignSizePosition(sizing, 0, 0, this->avs->smallest_x, this->avs->smallest_y, rtl); } diff --git a/src/settings.cpp b/src/settings.cpp index 275be0a9c5..77d0436273 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -768,6 +768,7 @@ static bool UpdateConsists(int32 p1) /* Update the consist of all trains so the maximum speed is set correctly. */ if (t->IsFrontEngine() || t->IsFreeWagon()) t->ConsistChanged(true); } + InvalidateWindowClassesData(WC_BUILD_VEHICLE, 0); return true; } diff --git a/src/strings.cpp b/src/strings.cpp index 6aa3d013eb..964ef0d77c 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1785,7 +1785,7 @@ static bool FindMissingGlyphs(const char **str) size = FS_SMALL; } else if (c == SCC_BIGFONT) { size = FS_LARGE; - } else if (IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(size, c) == question_mark[size]) { + } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(size, c) == question_mark[size]) { /* The character is printable, but not in the normal font. This is the case we were testing for. */ return true; }