Changeset - r26006:f409c56041d2
[Not reviewed]
master
0 3 0
SamuXarick - 3 years ago 2021-10-03 10:54:19
43006711+SamuXarick@users.noreply.github.com
Fix #9591: Update station docking tiles upon placing a water object on a docking tile (#9594)
3 files changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/object_cmd.cpp
Show inline comments
 
@@ -29,12 +29,13 @@
 
#include "object_base.h"
 
#include "newgrf_config.h"
 
#include "newgrf_object.h"
 
#include "date_func.h"
 
#include "newgrf_debug.h"
 
#include "vehicle_func.h"
 
#include "station_func.h"
 

	
 
#include "table/strings.h"
 
#include "table/object_land.h"
 

	
 
#include "safeguards.h"
 

	
 
@@ -118,13 +119,15 @@ void BuildObject(ObjectType type, TileIn
 
		WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
 
		/* Update company infrastructure counts for objects build on canals owned by nobody. */
 
		if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, OWNER_WATER))) {
 
			Company::Get(owner)->infrastructure.water++;
 
			DirtyCompanyInfrastructureWindows(owner);
 
		}
 
		bool remove = IsDockingTile(t);
 
		MakeObject(t, owner, o->index, wc, Random());
 
		if (remove) RemoveDockingTile(t);
 
		MarkTileDirtyByTile(t);
 
	}
 

	
 
	Object::IncTypeCount(type);
 
	if (spec->flags & OBJECT_FLAG_ANIMATION) TriggerObjectAnimation(o, OAT_BUILT, spec);
 
}
src/saveload/afterload.cpp
Show inline comments
 
@@ -3103,14 +3103,14 @@ bool AfterLoadGame()
 
			if (IsTileType(t, MP_STATION)) {
 
				if (IsDock(t) || IsOilRig(t)) Station::GetByTile(t)->ship_station.Add(t);
 
			}
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_DOCK_DOCKINGTILES)) {
 
		/* All tiles around docks may be docking tiles. */
 
	if (IsSavegameVersionBefore(SLV_REPAIR_OBJECT_DOCKING_TILES)) {
 
		/* Placing objects on docking tiles was not updating adjacent station's docking tiles. */
 
		for (Station *st : Station::Iterate()) {
 
			if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st);
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) {
src/saveload/saveload.h
Show inline comments
 
@@ -335,13 +335,14 @@ enum SaveLoadVersion : uint16 {
 
	SLV_SAVELOAD_LIST_LENGTH,               ///< 293  PR#9374 Consistency in list length with SL_STRUCT / SL_STRUCTLIST / SL_DEQUE / SL_REFLIST.
 
	SLV_RIFF_TO_ARRAY,                      ///< 294  PR#9375 Changed many CH_RIFF chunks to CH_ARRAY chunks.
 

	
 
	SLV_TABLE_CHUNKS,                       ///< 295  PR#9322 Introduction of CH_TABLE and CH_SPARSE_TABLE.
 
	SLV_SCRIPT_INT64,                       ///< 296  PR#9415 SQInteger is 64bit but was saved as 32bit.
 
	SLV_LINKGRAPH_TRAVEL_TIME,              ///< 297  PR#9457 v12.0-RC1  Store travel time in the linkgraph.
 
	SLV_DOCK_DOCKINGTILES,                  ///< 298  PR#9578 v12.0  All tiles around docks may be docking tiles.
 
	SLV_DOCK_DOCKINGTILES,                  ///< 298  PR#9578 All tiles around docks may be docking tiles.
 
	SLV_REPAIR_OBJECT_DOCKING_TILES,        ///< 299  PR#9594 v12.0  Fixing issue with docking tiles overlapping objects.
 

	
 
	SL_MAX_VERSION,                         ///< Highest possible saveload version
 
};
 

	
 
/** Save or load result codes. */
 
enum SaveOrLoadResult {
0 comments (0 inline, 0 general)