Remove global variable for terraforming errors

Add sanity checks on error tile in CcTerraform
This commit is contained in:
Jonathan G Rennison
2022-10-13 20:49:21 +01:00
parent 02cb1dc2c4
commit 4c61d4ce8b
2 changed files with 17 additions and 17 deletions

View File

@@ -52,8 +52,10 @@ void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2
if (result.Succeeded()) {
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
} else {
extern TileIndex _terraform_err_tile;
SetRedErrorSquare(_terraform_err_tile);
TileIndex err_tile = result.GetTile();
if (err_tile == INVALID_TILE || IsValidTile(err_tile)) {
SetRedErrorSquare(err_tile);
}
}
}