From c5387508ebc3d5cfec9464402f673107343e31a9 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 25 Aug 2011 13:21:25 +0000 Subject: [PATCH] (svn r22837) [1.1] -Backport from trunk: - Fix: [NewGRF] Always draw NewGRF supplied texts with a default colour (r22725) - Fix: [NewGRF] Do not restrict AdvVarAct2 to 255 operations (r22723) - Fix: If there is no point in opening the rail/air toolbar, do not open it for people who use hotkeys either rather than only for those using GUI elements (r22716, r22715, r22714) - Fix: [NoAI] Allow AIAirport::GetNoiseLevelIncrease() also for expired airports [FS#4704] (r22710) --- src/ai/api/ai_airport.cpp | 2 +- src/ai/api/ai_airport.hpp | 1 + src/airport_gui.cpp | 2 ++ src/industry_gui.cpp | 2 +- src/newgrf_spritegroup.h | 2 +- src/object_gui.cpp | 2 +- src/rail_gui.cpp | 2 ++ 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp index c52e5abd2d..ac0dd6422c 100644 --- a/src/ai/api/ai_airport.cpp +++ b/src/ai/api/ai_airport.cpp @@ -131,7 +131,7 @@ extern uint8 GetAirportNoiseLevelForTown(const AirportSpec *as, TileIndex town_tile, TileIndex tile); if (!::IsValidTile(tile)) return -1; - if (!IsValidAirportType(type)) return -1; + if (!IsAirportInformationAvailable(type)) return -1; if (_settings_game.economy.station_noise_level) { const AirportSpec *as = ::AirportSpec::Get(type); diff --git a/src/ai/api/ai_airport.hpp b/src/ai/api/ai_airport.hpp index a058209c64..a889b32890 100644 --- a/src/ai/api/ai_airport.hpp +++ b/src/ai/api/ai_airport.hpp @@ -180,6 +180,7 @@ public: * built at this tile. * @param tile The tile to check. * @param type The AirportType to check. + * @pre IsAirportInformationAvailable(type). * @return The amount of noise added to the nearest town. * @note The noise will be added to the town with TownID GetNearestTown(tile, type). */ diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 29b21d66da..4c4314cad9 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -26,6 +26,7 @@ #include "widgets/dropdown_type.h" #include "core/geometry_func.hpp" #include "hotkeys.h" +#include "vehicle_func.h" #include "sprite.h" #include "table/strings.h" @@ -195,6 +196,7 @@ Window *ShowBuildAirToolbar() EventState AirportToolbarGlobalHotkeys(uint16 key, uint16 keycode) { + if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED; int num = CheckHotkeyMatch(_airtoolbar_hotkeys, keycode, NULL, true); if (num == -1) return ES_NOT_HANDLED; Window *w = ShowBuildAirToolbar(); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 9ab371a1f3..5483370b46 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -792,7 +792,7 @@ public: /* Use all the available space left from where we stand up to the * end of the window. We ALSO enlarge the window if needed, so we * can 'go' wild with the bottom of the window. */ - y = DrawStringMultiLine(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, y, UINT16_MAX, message); + y = DrawStringMultiLine(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, y, UINT16_MAX, message, TC_BLACK); StopTextRefStackUsage(); } } diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index a7fdfbbeb6..452d71aed3 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -197,7 +197,7 @@ struct DeterministicSpriteGroup : SpriteGroup { VarSpriteGroupScope var_scope; DeterministicSpriteGroupSize size; - byte num_adjusts; + uint num_adjusts; byte num_ranges; DeterministicSpriteGroupAdjust *adjusts; DeterministicSpriteGroupRange *ranges; // Dynamically allocated diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 034e143a8b..f66ee7d631 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -240,7 +240,7 @@ public: /* Use all the available space left from where we stand up to the * end of the window. We ALSO enlarge the window if needed, so we * can 'go' wild with the bottom of the window. */ - int y = DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, message) - r.top; + int y = DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, message, TC_ORANGE) - r.top; StopTextRefStackUsage(); if (y > this->info_height) { BuildObjectWindow *bow = const_cast(this); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 36576a3ca2..b088fef046 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -31,6 +31,7 @@ #include "core/geometry_func.hpp" #include "hotkeys.h" #include "engine_base.h" +#include "vehicle_func.h" #include "station_map.h" #include "tunnelbridge_map.h" @@ -849,6 +850,7 @@ Window *ShowBuildRailToolbar(RailType railtype) EventState RailToolbarGlobalHotkeys(uint16 key, uint16 keycode) { + if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED; extern RailType _last_built_railtype; int num = CheckHotkeyMatch(_railtoolbar_hotkeys, keycode, NULL, true); if (num == -1) return ES_NOT_HANDLED;