mirror of https://github.com/OpenTTD/OpenTTD
(svn r24923) -Fix [FS#5441]: When an object built on a river is removed, restore the river, if possible also on slopes (based on patch by Supercheese)
parent
5fb6b7b9eb
commit
42883b9543
|
@ -161,7 +161,9 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o)
|
||||||
|
|
||||||
/* Autoslope might turn an originally canal or river tile into land */
|
/* Autoslope might turn an originally canal or river tile into land */
|
||||||
int z;
|
int z;
|
||||||
if (GetTileSlope(tile, &z) != SLOPE_FLAT) {
|
Slope slope = GetTileSlope(tile, &z);
|
||||||
|
|
||||||
|
if (slope != SLOPE_FLAT) {
|
||||||
if (wc == WATER_CLASS_CANAL) {
|
if (wc == WATER_CLASS_CANAL) {
|
||||||
/* If we clear the canal, we have to remove it from the infrastructure count as well. */
|
/* If we clear the canal, we have to remove it from the infrastructure count as well. */
|
||||||
Company *c = Company::GetIfValid(o);
|
Company *c = Company::GetIfValid(o);
|
||||||
|
@ -169,10 +171,16 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o)
|
||||||
c->infrastructure.water--;
|
c->infrastructure.water--;
|
||||||
DirtyCompanyInfrastructureWindows(c->index);
|
DirtyCompanyInfrastructureWindows(c->index);
|
||||||
}
|
}
|
||||||
}
|
/* Sloped canals are locks and no natural water remains whatever the slope direction */
|
||||||
wc = WATER_CLASS_INVALID;
|
wc = WATER_CLASS_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* There must not be water sloped invalidly, whatever class it may be */
|
||||||
|
if (GetInclinedSlopeDirection(slope) == INVALID_DIAGDIR) {
|
||||||
|
wc = WATER_CLASS_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wc == WATER_CLASS_SEA && z > 0) {
|
if (wc == WATER_CLASS_SEA && z > 0) {
|
||||||
/* Update company infrastructure count. */
|
/* Update company infrastructure count. */
|
||||||
Company *c = Company::GetIfValid(o);
|
Company *c = Company::GetIfValid(o);
|
||||||
|
|
Loading…
Reference in New Issue