forked from mirror/OpenTTD
Feature: Region-based pathfinder for ships (#10543)
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "industry.h"
|
||||
#include "water_cmd.h"
|
||||
#include "landscape_cmd.h"
|
||||
#include "pathfinder/water_regions.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -133,6 +134,9 @@ CommandCost CmdBuildShipDepot(DoCommandFlag flags, TileIndex tile, Axis axis)
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
InvalidateWaterRegion(tile);
|
||||
InvalidateWaterRegion(tile2);
|
||||
|
||||
Depot *depot = new Depot(tile);
|
||||
depot->build_date = TimerGameCalendar::date;
|
||||
|
||||
@@ -243,6 +247,7 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o)
|
||||
|
||||
/* Zero map array and terminate animation */
|
||||
DoClearSquare(tile);
|
||||
InvalidateWaterRegion(tile);
|
||||
|
||||
/* Maybe change to water */
|
||||
switch (wc) {
|
||||
@@ -340,6 +345,10 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
InvalidateWaterRegion(tile);
|
||||
InvalidateWaterRegion(tile + delta);
|
||||
InvalidateWaterRegion(tile - delta);
|
||||
|
||||
/* Update company infrastructure counts. */
|
||||
Company *c = Company::GetIfValid(_current_company);
|
||||
if (c != nullptr) {
|
||||
@@ -482,6 +491,8 @@ CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, TileIndex start_t
|
||||
if (!water) cost.AddCost(ret);
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
InvalidateWaterRegion(current_tile);
|
||||
|
||||
if (IsTileType(current_tile, MP_WATER) && IsCanal(current_tile)) {
|
||||
Owner owner = GetTileOwner(current_tile);
|
||||
if (Company::IsValidID(owner)) {
|
||||
@@ -529,8 +540,11 @@ CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, TileIndex start_t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
|
||||
{
|
||||
if (flags & DC_EXEC) InvalidateWaterRegion(tile);
|
||||
|
||||
switch (GetWaterTileType(tile)) {
|
||||
case WATER_TILE_CLEAR: {
|
||||
if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
@@ -1161,6 +1175,8 @@ void DoFloodTile(TileIndex target)
|
||||
}
|
||||
|
||||
if (flooded) {
|
||||
InvalidateWaterRegion(target);
|
||||
|
||||
/* Mark surrounding canal tiles dirty too to avoid glitches */
|
||||
MarkCanalsAndRiversAroundDirty(target);
|
||||
|
||||
|
Reference in New Issue
Block a user