changeset 13950:77bfe67f23bd draft

(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)
author rubidium <rubidium@openttd.org>
date Sun, 13 Dec 2009 19:33:07 +0000
parents 351e4bacb2e1
children 443ff91fea9a
files src/main_gui.cpp src/saveload/afterload.cpp src/settings_gui.cpp src/viewport_func.h
diffstat 4 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -188,8 +188,6 @@
 	}
 }
 
-extern void UpdateAllStationVirtCoords();
-
 /** Widgets of the main window. */
 enum MainWindowWidgets {
 	MW_VIEWPORT, ///< Main window viewport.
@@ -293,7 +291,7 @@
 				break;
 
 			case '2' | WKC_ALT: // Update the coordinates of all station signs
-				UpdateAllStationVirtCoords();
+				UpdateAllVirtCoords();
 				break;
 #endif
 
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -210,6 +210,16 @@
 }
 
 /**
+ * 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,13 +234,10 @@
 	ResetWindowSystem();
 	SetupColoursAndInitialWindow();
 
+	/* Update coordinates of the signs. */
+	UpdateAllVirtCoords();
 	ResetViewportAfterLoadGame();
 
-	/* Update coordinates of the signs. */
-	UpdateAllStationVirtCoords();
-	UpdateAllSignVirtCoords();
-	UpdateAllTownVirtCoords();
-
 	Company *c;
 	FOR_ALL_COMPANIES(c) {
 		/* For each company, verify (while loading a scenario) that the inauguration date is the current year and set it
--- 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 @@
 			case GOW_LANG_DROPDOWN: // Change interface language
 				ReadLanguagePack(index);
 				CheckForMissingGlyphsInLoadedLanguagePack();
-				UpdateAllStationVirtCoords();
+				UpdateAllVirtCoords();
 				ReInitAllWindows();
 				break;
 
--- a/src/viewport_func.h
+++ b/src/viewport_func.h
@@ -70,6 +70,8 @@
 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 */