Changeset - r26794:e2431112c56e
[Not reviewed]
master
0 1 0
Tyler Trahan - 17 months ago 2023-01-23 17:08:19
tyler@tylertrahan.com
Fix #10395: When loading old saves, don't forcibly bar level crossings (#10400)
1 file changed with 2 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/saveload/afterload.cpp
Show inline comments
 
@@ -1976,31 +1976,24 @@ bool AfterLoadGame()
 
				default: break;
 
			}
 
		}
 
	}
 

	
 
	/* Reserve all tracks trains are currently on. */
 
	if (IsSavegameVersionBefore(SLV_101)) {
 
		for (const Train *t : Train::Iterate()) {
 
			if (t->First() == t) t->ReserveTrackUnderConsist();
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_102)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			/* Now all crossings should be in correct state */
 
			if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_103)) {
 
		/* Non-town-owned roads now store the closest town */
 
		UpdateNearestTownForRoadTiles(false);
 

	
 
		/* signs with invalid owner left from older savegames */
 
		for (Sign *si : Sign::Iterate()) {
 
			if (si->owner != OWNER_NONE && !Company::IsValidID(si->owner)) si->owner = OWNER_NONE;
 
		}
 

	
 
		/* Station can get named based on an industry type, but the current ones
 
		 * are not, so mark them as if they are not named by an industry. */
 
		for (Station *st : Station::Iterate()) {
 
@@ -3187,27 +3180,27 @@ bool AfterLoadGame()
 
					u->x_pos = x;
 
					u->y_pos = y;
 
					u->z_pos = GetSlopePixelZ(x, y);
 

	
 
					u->vehstatus |= VS_HIDDEN;
 
					u->state = RVSB_IN_DEPOT;
 
					u->UpdatePosition();
 
				}
 
				RoadVehLeaveDepot(rv, false);
 
			}
 
		}
 

	
 
		/* Refresh all level crossings to bar adjacent crossing tiles. */
 
		/* Refresh all level crossings to bar adjacent crossing tiles, if needed. */
 
		for (TileIndex tile = 0; tile < Map::Size(); tile++) {
 
			if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile, false, true);
 
			if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile, false);
 
		}
 
	}
 

	
 
	/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
 
	Station::RecomputeCatchmentForAll();
 

	
 
	/* Station acceptance is some kind of cache */
 
	if (IsSavegameVersionBefore(SLV_127)) {
 
		for (Station *st : Station::Iterate()) UpdateStationAcceptance(st, false);
 
	}
 

	
 
	AfterLoadLabelMaps();
0 comments (0 inline, 0 general)