Changeset - r23500:c75b85278ae0
[Not reviewed]
master
0 2 0
Peter Nelson - 5 years ago 2019-03-24 00:12:31
peter1138@openttd.org
Fix #7400: Water class for tree tiles was not converted for old saves preventing industry creation.

As the information is always available from the tree ground type, unconditionally
update the map array for tree tiles.
2 files changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/saveload/afterload.cpp
Show inline comments
 
@@ -3108,12 +3108,19 @@ bool AfterLoadGame()
 
	} else {
 
		/* Link neutral station back to industry, as this is not saved. */
 
		Industry *ind;
 
		FOR_ALL_INDUSTRIES(ind) if (ind->neutral_station != NULL) ind->neutral_station->industry = ind;
 
	}
 

	
 
	{
 
		/* Update water class for trees for all current savegame versions. */
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			if (IsTileType(t, MP_TREES)) SetWaterClass(t, GetTreeGround(t) == TREE_GROUND_SHORE ? WATER_CLASS_SEA : WATER_CLASS_INVALID);
 
		}
 
	}
 

	
 
	/* 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)) {
 
		Station *st;
src/tree_map.h
Show inline comments
 
@@ -274,12 +274,13 @@ static inline void SetTreeCounter(TileIn
 
 * @param density the density (not the number of trees)
 
 */
 
static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density)
 
{
 
	SetTileType(t, MP_TREES);
 
	SetTileOwner(t, OWNER_NONE);
 
	SetWaterClass(t, ground == TREE_GROUND_SHORE ? WATER_CLASS_SEA : WATER_CLASS_INVALID);
 
	_m[t].m2 = ground << 6 | density << 4 | 0;
 
	_m[t].m3 = type;
 
	_m[t].m4 = 0 << 5 | 0 << 2;
 
	_m[t].m5 = count << 6 | growth;
 
	SB(_me[t].m6, 2, 4, 0);
 
	_me[t].m7 = 0;
0 comments (0 inline, 0 general)