summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-21 10:29:16 +0000
committerDarkvater <darkvater@openttd.org>2006-12-21 10:29:16 +0000
commit9b9add65c3780becd471efb9c1695b292e541210 (patch)
treef8281d852173843541f4573083830e5d73025495 /openttd.c
parent739e93fd23f91e433829dfaa5969e75528f861cd (diff)
downloadopenttd-9b9add65c3780becd471efb9c1695b292e541210.tar.xz
(svn r7523) -Feature: Add the possibility to change the newgrf configuration of a running game.
This is only possible in SP (or in the intro menu). During game play you will get a confirmation window when applying the changes as some actions can crash OpenTTD and/or make your current game unplayable.
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/openttd.c b/openttd.c
index c9d59c2f1..8ed10a6b3 100644
--- a/openttd.c
+++ b/openttd.c
@@ -1559,3 +1559,24 @@ bool AfterLoadGame(void)
return true;
}
+
+/** Reload all NewGRF files during a running game. This is a cut-down
+ * version of AfterLoadGame().
+ * XXX - We need to reset the vehicle position hash because with a non-empty
+ * hash AfterLoadVehicles() will loop infinitely. We need AfterLoadVehicles()
+ * to recalculate vehicle data as some NewGRF vehicle sets could have been
+ * removed or added and changed statistics */
+void ReloadNewGRFData(void)
+{
+ /* reload grf data */
+ GfxLoadSprites();
+ LoadStringWidthTable();
+ /* reload vehicles */
+ ResetVehiclePosHash();
+ AfterLoadVehicles();
+ /* update station and waypoint graphics */
+ AfterLoadWaypoints();
+ AfterLoadStations();
+ /* redraw the whole screen */
+ MarkWholeScreenDirty();
+}