File diff r17372:5735d885db8e → r17373:97cac55958cb
src/saveload/afterload.cpp
Show inline comments
 
@@ -661,49 +661,49 @@ bool AfterLoadGame()
 
	/* Oilrig was moved from id 15 to 9. We have to do this conversion
 
	 * here as AfterLoadVehicles can check it indirectly via the newgrf
 
	 * code. */
 
	if (IsSavegameVersionBefore(139)) {
 
		Station *st;
 
		FOR_ALL_STATIONS(st) {
 
			if (st->airport.tile != INVALID_TILE && st->airport.type == 15) {
 
				st->airport.type = AT_OILRIG;
 
			}
 
		}
 
	}
 

	
 
	/* Update all vehicles */
 
	AfterLoadVehicles(true);
 

	
 
	/* Make sure there is an AI attached to an AI company */
 
	{
 
		Company *c;
 
		FOR_ALL_COMPANIES(c) {
 
			if (c->is_ai && c->ai_instance == NULL) AI::StartNew(c->index);
 
		}
 
	}
 

	
 
	/* make sure there is a town in the game */
 
	if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, UINT_MAX)) {
 
	if (_game_mode == GM_NORMAL && Town::GetNumItems() == 0) {
 
		SetSaveLoadError(STR_ERROR_NO_TOWN_IN_SCENARIO);
 
		/* Restore the signals */
 
		ResetSignalHandlers();
 
		return false;
 
	}
 

	
 
	/* The void tiles on the southern border used to belong to a wrong class (pre 4.3).
 
	 * This problem appears in savegame version 21 too, see r3455. But after loading the
 
	 * savegame and saving again, the buggy map array could be converted to new savegame
 
	 * version. It didn't show up before r12070. */
 
	if (IsSavegameVersionBefore(87)) UpdateVoidTiles();
 

	
 
	/* If Load Scenario / New (Scenario) Game is used,
 
	 *  a company does not exist yet. So create one here.
 
	 * 1 exeption: network-games. Those can have 0 companies
 
	 *   But this exeption is not true for non dedicated network_servers! */
 
	if (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated))) {
 
		DoStartupNewCompany(false);
 
	}
 

	
 
	/* Fix the cache for cargo payments. */
 
	CargoPayment *cp;
 
	FOR_ALL_CARGO_PAYMENTS(cp) {
 
		cp->front->cargo_payment = cp;