mirror of https://github.com/OpenTTD/OpenTTD
(svn r21648) -Codechange: unduplicate a bit of code
parent
744616bb36
commit
b98c758e0b
|
@ -973,31 +973,14 @@ static void DrawTileSelection(const TileInfo *ti)
|
||||||
if ((_thd.drawstyle & HT_DRAG_MASK) == HT_NONE) return;
|
if ((_thd.drawstyle & HT_DRAG_MASK) == HT_NONE) return;
|
||||||
|
|
||||||
if (_thd.diagonal) { // We're drawing a 45 degrees rotated (diagonal) rectangle
|
if (_thd.diagonal) { // We're drawing a 45 degrees rotated (diagonal) rectangle
|
||||||
if (IsInsideRotatedRectangle((int)ti->x, (int)ti->y)) {
|
if (IsInsideRotatedRectangle((int)ti->x, (int)ti->y)) goto draw_inner;
|
||||||
if (_thd.drawstyle & HT_RECT) { // Highlighting a square (clear land)
|
|
||||||
/* Don't mark tiles outside the map. */
|
|
||||||
if (!IsValidTile(ti->tile)) return;
|
|
||||||
|
|
||||||
SpriteID image = SPR_SELECT_TILE + SlopeToSpriteOffset(ti->tileh);
|
|
||||||
DrawSelectionSprite(image, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE, ti, 7, FOUNDATION_PART_NORMAL);
|
|
||||||
} else { // Highlighting a dot (level land)
|
|
||||||
/* Figure out the Z coordinate for the single dot. */
|
|
||||||
byte z = ti->z;
|
|
||||||
if (ti->tileh & SLOPE_N) {
|
|
||||||
z += TILE_HEIGHT;
|
|
||||||
if (!(ti->tileh & SLOPE_S) && (ti->tileh & SLOPE_STEEP)) {
|
|
||||||
z += TILE_HEIGHT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AddTileSpriteToDraw(_cur_dpi->zoom != 2 ? SPR_DOT : SPR_DOT_SMALL, PAL_NONE, ti->x, ti->y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inside the inner area? */
|
/* Inside the inner area? */
|
||||||
if (IsInsideBS(ti->x, _thd.pos.x, _thd.size.x) &&
|
if (IsInsideBS(ti->x, _thd.pos.x, _thd.size.x) &&
|
||||||
IsInsideBS(ti->y, _thd.pos.y, _thd.size.y)) {
|
IsInsideBS(ti->y, _thd.pos.y, _thd.size.y)) {
|
||||||
|
draw_inner:
|
||||||
if (_thd.drawstyle & HT_RECT) {
|
if (_thd.drawstyle & HT_RECT) {
|
||||||
if (!is_redsq) DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
|
if (!is_redsq) DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
|
||||||
} else if (_thd.drawstyle & HT_POINT) {
|
} else if (_thd.drawstyle & HT_POINT) {
|
||||||
|
@ -2865,7 +2848,7 @@ void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowC
|
||||||
_thd.window_class = window_class;
|
_thd.window_class = window_class;
|
||||||
_thd.window_number = window_num;
|
_thd.window_number = window_num;
|
||||||
|
|
||||||
if (mode == HT_SPECIAL) { // special tools, like tunnels or docks start with presizing mode
|
if ((mode & HT_DRAG_MASK) == HT_SPECIAL) { // special tools, like tunnels or docks start with presizing mode
|
||||||
VpStartPreSizing();
|
VpStartPreSizing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue