diff src/saveload/afterload.cpp @ 18560:488cc0d0b505 draft

(svn r23405) -Codechange: Keep a matrix of cargos accepted by houses for each town (michi_cc).
author terkhen <terkhen@openttd.org>
date Sat, 03 Dec 2011 22:21:27 +0000
parents 11637619aa76
children 021a10db1a99
line wrap: on
line diff
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2700,6 +2700,19 @@
 	 * which is done by StartupEngines(). */
 	if (gcf_res != GLC_ALL_GOOD) StartupEngines();
 
+	if (IsSavegameVersionBefore(166)) {
+		/* Update cargo acceptance map of towns. */
+		for (TileIndex t = 0; t < map_size; t++) {
+			if (!IsTileType(t, MP_HOUSE)) continue;
+			Town::Get(GetTownIndex(t))->cargo_accepted.Add(t);
+		}
+
+		Town *town;
+		FOR_ALL_TOWNS(town) {
+			UpdateTownCargos(town);
+		}
+	}
+
 	/* Road stops is 'only' updating some caches */
 	AfterLoadRoadStops();
 	AfterLoadLabelMaps();