File diff r18852:267bfa8199f1 → r18853:205086193fac
src/saveload/afterload.cpp
Show inline comments
 
@@ -2708,68 +2708,68 @@ bool AfterLoadGame()
 
	}
 

	
 
	/* When any NewGRF has been changed the availability of some vehicles might
 
	 * have been changed too. e->company_avail must be set to 0 in that case
 
	 * 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) {
 
			UpdateTownCargoes(town);
 
		}
 
	}
 

	
 
	/* Road stops is 'only' updating some caches */
 
	AfterLoadRoadStops();
 
	AfterLoadLabelMaps();
 
	AfterLoadCompanyStats();
 

	
 
	GamelogPrintDebug(1);
 

	
 
	InitializeWindowsAndCaches();
 
	/* Restore the signals */
 
	ResetSignalHandlers();
 
	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()
 
{
 
	/* reload grf data */
 
	GfxLoadSprites();
 
	LoadStringWidthTable();
 
	RecomputePrices();
 
	/* reload vehicles */
 
	ResetVehiclePosHash();
 
	ResetVehicleHash();
 
	AfterLoadVehicles(false);
 
	StartupEngines();
 
	GroupStatistics::UpdateAfterLoad();
 
	/* update station graphics */
 
	AfterLoadStations();
 
	/* Update company statistics. */
 
	AfterLoadCompanyStats();
 
	/* Check and update house and town values */
 
	UpdateHousesAndTowns();
 
	/* Delete news referring to no longer existing entities */
 
	DeleteInvalidEngineNews();
 
	/* Update livery selection windows */
 
	for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) InvalidateWindowData(WC_COMPANY_COLOUR, i);
 
	/* Update company infrastructure counts. */
 
	InvalidateWindowClassesData(WC_COMPANY_INFRASTRUCTURE);
 
	/* redraw the whole screen */
 
	MarkWholeScreenDirty();
 
	CheckTrainsLengths();
 
}