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
 
@@ -23,24 +23,25 @@
 
#include "cheat_type.h"
 
#include "object.h"
 
#include "cargopacket.h"
 
#include "core/random_func.hpp"
 
#include "core/pool_func.hpp"
 
#include "object_map.h"
 
#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"
 

	
 
ObjectPool _object_pool("Object");
 
INSTANTIATE_POOL_METHODS(Object)
 
uint16 Object::counts[NUM_OBJECTS];
 

	
 
/**
 
 * Get the object associated with a tile.
 
@@ -112,25 +113,27 @@ void BuildObject(ObjectType type, TileIn
 
		}
 
	}
 

	
 
	assert(o->town != nullptr);
 

	
 
	for (TileIndex t : ta) {
 
		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);
 
}
 

	
 
/**
 
 * Increase the animation stage of a whole structure.
 
 * @param tile The tile of the structure.
 
 */
 
static void IncreaseAnimationStage(TileIndex tile)
src/saveload/afterload.cpp
Show inline comments
 
@@ -3097,26 +3097,26 @@ bool AfterLoadGame()
 
			/* Clear docking tile flag from relevant tiles as it
 
			 * was not previously cleared. */
 
			if (IsTileType(t, MP_WATER) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)) {
 
				SetDockingTile(t, false);
 
			}
 
			/* Add docks and oilrigs to Station::ship_station. */
 
			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)) {
 
		/* Reset roadtype/streetcartype info for non-road bridges. */
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) != TRANSPORT_ROAD) {
 
				SetRoadTypes(t, INVALID_ROADTYPE, INVALID_ROADTYPE);
 
			}
 
		}
src/saveload/saveload.h
Show inline comments
 
@@ -329,25 +329,26 @@ enum SaveLoadVersion : uint16 {
 
	SLV_VEH_MOTION_COUNTER,                 ///< 288  PR#8591 Desync safe motion counter
 
	SLV_INDUSTRY_TEXT,                      ///< 289  PR#8576 v1.11.0-RC1  Additional GS text for industries.
 

	
 
	SLV_MAPGEN_SETTINGS_REVAMP,             ///< 290  PR#8891 v1.11  Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type).
 
	SLV_GROUP_REPLACE_WAGON_REMOVAL,        ///< 291  PR#7441 Per-group wagon removal flag.
 
	SLV_CUSTOM_SUBSIDY_DURATION,            ///< 292  PR#9081 Configurable subsidy duration.
 
	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 {
 
	SL_OK     = 0, ///< completed successfully
 
	SL_ERROR  = 1, ///< error that was caught before internal structures were modified
 
	SL_REINIT = 2, ///< error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
 
};
 

	
 
/** Deals with the type of the savegame, independent of extension */
0 comments (0 inline, 0 general)