mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r15151) -Fix: tile 0 can now be highlighted as error tile
This commit is contained in:
parent
49e69399a6
commit
8b04787d09
|
@ -70,6 +70,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date)
|
||||||
_realtime_tick = 0;
|
_realtime_tick = 0;
|
||||||
_date_fract = 0;
|
_date_fract = 0;
|
||||||
_cur_tileloop_tile = 0;
|
_cur_tileloop_tile = 0;
|
||||||
|
_thd.redsq = INVALID_TILE;
|
||||||
MakeNewgameSettingsLive();
|
MakeNewgameSettingsLive();
|
||||||
|
|
||||||
if (reset_date) {
|
if (reset_date) {
|
||||||
|
|
|
@ -505,7 +505,7 @@ public:
|
||||||
|
|
||||||
~ErrmsgWindow()
|
~ErrmsgWindow()
|
||||||
{
|
{
|
||||||
SetRedErrorSquare(0);
|
SetRedErrorSquare(INVALID_TILE);
|
||||||
extern StringID _switch_mode_errorstr;
|
extern StringID _switch_mode_errorstr;
|
||||||
_switch_mode_errorstr = INVALID_STRING_ID;
|
_switch_mode_errorstr = INVALID_STRING_ID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,9 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
|
||||||
if ((x <= 1) || (y <= 1) || (x >= MapMaxX() - 1) || (y >= MapMaxY() - 1)) {
|
if ((x <= 1) || (y <= 1) || (x >= MapMaxX() - 1) || (y >= MapMaxY() - 1)) {
|
||||||
/*
|
/*
|
||||||
* Determine a sensible error tile
|
* Determine a sensible error tile
|
||||||
* Note: If x and y are both zero this will disable the error tile. (Tile 0 cannot be highlighted :( )
|
|
||||||
*/
|
*/
|
||||||
if ((x == 1) && (y != 0)) x = 0;
|
if (x == 1) x = 0;
|
||||||
if ((y == 1) && (x != 0)) y = 0;
|
if (y == 1) y = 0;
|
||||||
_terraform_err_tile = TileXY(x, y);
|
_terraform_err_tile = TileXY(x, y);
|
||||||
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
|
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
|
||||||
}
|
}
|
||||||
|
|
|
@ -878,7 +878,7 @@ static void DrawAutorailSelection(const TileInfo *ti, uint autorail_type)
|
||||||
static void DrawTileSelection(const TileInfo *ti)
|
static void DrawTileSelection(const TileInfo *ti)
|
||||||
{
|
{
|
||||||
/* Draw a red error square? */
|
/* Draw a red error square? */
|
||||||
bool is_redsq = _thd.redsq != 0 && _thd.redsq == ti->tile;
|
bool is_redsq = _thd.redsq == ti->tile;
|
||||||
if (is_redsq) DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING);
|
if (is_redsq) DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING);
|
||||||
|
|
||||||
/* no selection active? */
|
/* no selection active? */
|
||||||
|
@ -2085,8 +2085,8 @@ void SetRedErrorSquare(TileIndex tile)
|
||||||
_thd.redsq = tile;
|
_thd.redsq = tile;
|
||||||
|
|
||||||
if (tile != old) {
|
if (tile != old) {
|
||||||
if (tile != 0) MarkTileDirtyByTile(tile);
|
if (tile != INVALID_TILE) MarkTileDirtyByTile(tile);
|
||||||
if (old != 0) MarkTileDirtyByTile(old);
|
if (old != INVALID_TILE) MarkTileDirtyByTile(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue