diff options
author | rubidium <rubidium@openttd.org> | 2009-12-13 19:33:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-13 19:33:07 +0000 |
commit | 0e78fdb54cd4805e5470e071e42ce17804efd02e (patch) | |
tree | be409f44d9d3541384a30f0f7994df7351fd0bec /src | |
parent | 43abfbd426d7437535ecd8edf0d9c75990c6917b (diff) | |
download | openttd-0e78fdb54cd4805e5470e071e42ce17804efd02e.tar.xz |
(svn r18486) -Fix: when switching language and you're getting a different font, recalculate the coordinates/sizes of the viewport signs. Otherwise it gets glitchy or abbreviated (in the smallmap)
Diffstat (limited to 'src')
-rw-r--r-- | src/main_gui.cpp | 4 | ||||
-rw-r--r-- | src/saveload/afterload.cpp | 17 | ||||
-rw-r--r-- | src/settings_gui.cpp | 3 | ||||
-rw-r--r-- | src/viewport_func.h | 2 |
4 files changed, 17 insertions, 9 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 2f7682cd3..5ba32dfac 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -188,8 +188,6 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w) } } -extern void UpdateAllStationVirtCoords(); - /** Widgets of the main window. */ enum MainWindowWidgets { MW_VIEWPORT, ///< Main window viewport. @@ -293,7 +291,7 @@ struct MainWindow : Window break; case '2' | WKC_ALT: // Update the coordinates of all station signs - UpdateAllStationVirtCoords(); + UpdateAllVirtCoords(); break; #endif diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 05c759846..39dcfde85 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -210,6 +210,16 @@ static inline RailType UpdateRailType(RailType rt, RailType min) } /** + * Update the viewport coordinates of all signs. + */ +void UpdateAllVirtCoords() +{ + UpdateAllStationVirtCoords(); + UpdateAllSignVirtCoords(); + UpdateAllTownVirtCoords(); +} + +/** * Initialization of the windows and several kinds of caches. * This is not done directly in AfterLoadGame because these * functions require that all saveload conversions have been @@ -224,12 +234,9 @@ static void InitializeWindowsAndCaches() ResetWindowSystem(); SetupColoursAndInitialWindow(); - ResetViewportAfterLoadGame(); - /* Update coordinates of the signs. */ - UpdateAllStationVirtCoords(); - UpdateAllSignVirtCoords(); - UpdateAllTownVirtCoords(); + UpdateAllVirtCoords(); + ResetViewportAfterLoadGame(); Company *c; FOR_ALL_COMPANIES(c) { diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index bf5614322..6d892f4e3 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -32,6 +32,7 @@ #include "base_media_base.h" #include "company_base.h" #include "company_func.h" +#include "viewport_func.h" #include <map> #include "table/sprites.h" @@ -380,7 +381,7 @@ struct GameOptionsWindow : Window { case GOW_LANG_DROPDOWN: // Change interface language ReadLanguagePack(index); CheckForMissingGlyphsInLoadedLanguagePack(); - UpdateAllStationVirtCoords(); + UpdateAllVirtCoords(); ReInitAllWindows(); break; diff --git a/src/viewport_func.h b/src/viewport_func.h index b8eb706d2..2f631a55f 100644 --- a/src/viewport_func.h +++ b/src/viewport_func.h @@ -70,6 +70,8 @@ bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant = false); bool ScrollMainWindowToTile(TileIndex tile, bool instant = false); bool ScrollMainWindowTo(int x, int y, int z = -1, bool instant = false); +void UpdateAllVirtCoords(); + extern Point _tile_fract_coords; #endif /* VIEWPORT_FUNC_H */ |