Buoys have no owner and can be cleared by anyone, but the underlying tile (e.g. canal) should not be cleared if has a different owner.
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include "heightmap.h"
|
#include "heightmap.h"
|
||||||
#include "clear_map.h"
|
#include "clear_map.h"
|
||||||
#include "spritecache.h"
|
#include "spritecache.h"
|
||||||
|
#include "station_map.h"
|
||||||
#include "viewport_func.h"
|
#include "viewport_func.h"
|
||||||
#include "command_func.h"
|
#include "command_func.h"
|
||||||
#include "landscape.h"
|
#include "landscape.h"
|
||||||
@@ -682,9 +683,12 @@ CommandCost CmdLandscapeClear(DoCommandFlags flags, TileIndex tile)
|
|||||||
/* Test for stuff which results in water when cleared. Then add the cost to also clear the water. */
|
/* Test for stuff which results in water when cleared. Then add the cost to also clear the water. */
|
||||||
if (flags.Test(DoCommandFlag::ForceClearTile) && HasTileWaterClass(tile) && IsTileOnWater(tile) && !IsWaterTile(tile) && !IsCoastTile(tile)) {
|
if (flags.Test(DoCommandFlag::ForceClearTile) && HasTileWaterClass(tile) && IsTileOnWater(tile) && !IsWaterTile(tile) && !IsCoastTile(tile)) {
|
||||||
if (flags.Test(DoCommandFlag::Auto) && GetWaterClass(tile) == WaterClass::Canal) return CommandCost(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
if (flags.Test(DoCommandFlag::Auto) && GetWaterClass(tile) == WaterClass::Canal) return CommandCost(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||||
|
/* Buoy tiles are special as they can be cleared by anyone, but the underlying tile shouldn't be cleared if it has a different owner. */
|
||||||
|
if (!IsBuoyTile(tile) || GetTileOwner(tile) == _current_company) {
|
||||||
do_clear = true;
|
do_clear = true;
|
||||||
cost.AddCost(GetWaterClass(tile) == WaterClass::Canal ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
cost.AddCost(GetWaterClass(tile) == WaterClass::Canal ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Company *c = flags.Any({DoCommandFlag::Auto, DoCommandFlag::Bankrupt}) ? nullptr : Company::GetIfValid(_current_company);
|
Company *c = flags.Any({DoCommandFlag::Auto, DoCommandFlag::Bankrupt}) ? nullptr : Company::GetIfValid(_current_company);
|
||||||
if (c != nullptr && (int)GB(c->clear_limit, 16, 16) < 1) {
|
if (c != nullptr && (int)GB(c->clear_limit, 16, 16) < 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user