summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-12-22 19:24:36 +0000
committeralberth <alberth@openttd.org>2010-12-22 19:24:36 +0000
commit08c6b99294c150a408ea570bb7e046006ca8d7dd (patch)
tree5e89a4ebcb2336d9e15f4b97590567864f91f54c /src
parent1378bdad853d011281c22d5c08884bfa34e5b9f4 (diff)
downloadopenttd-08c6b99294c150a408ea570bb7e046006ca8d7dd.tar.xz
(svn r21600) -Codechange: Remove new_drawstyle and new_diagonal variables from the _thd structure.
Diffstat (limited to 'src')
-rw-r--r--src/tilehighlight_type.h2
-rw-r--r--src/viewport.cpp34
2 files changed, 17 insertions, 19 deletions
diff --git a/src/tilehighlight_type.h b/src/tilehighlight_type.h
index 6e9e9b6a3..b61dda3c5 100644
--- a/src/tilehighlight_type.h
+++ b/src/tilehighlight_type.h
@@ -54,7 +54,6 @@ struct TileHighlightData {
Point new_pos; ///< New value for \a pos; used to determine whether to redraw the selection.
Point new_size; ///< New value for \a size; used to determine whether to redraw the selection.
Point new_outersize; ///< New value for \a outersize; used to determine whether to redraw the selection.
- bool new_diagonal; ///< New value for \a diagonal; used to determine whether to redraw the selection.
byte dirty; ///< Whether the build station window needs to redraw due to the changed selection.
Point selstart; ///< The location where the dragging started.
@@ -62,7 +61,6 @@ struct TileHighlightData {
byte sizelimit; ///< Whether the selection is limited in length, and what the maximum length is.
HighLightStyle drawstyle; ///< Lower bits 0-3 are reserved for detailed highlight information.
- HighLightStyle new_drawstyle; ///< New value for \a drawstyle; used to determine whether to redraw the selection.
HighLightStyle next_drawstyle; ///< Queued, but not yet drawn style.
HighLightStyle place_mode; ///< Method which is used to place the selection.
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 14dfbc3e7..7ededa223 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2037,8 +2037,8 @@ void UpdateTileSelection()
int x1;
int y1;
- _thd.new_drawstyle = HT_NONE;
- _thd.new_diagonal = false;
+ HighLightStyle new_drawstyle = HT_NONE;
+ bool new_diagonal = false;
if (_thd.place_mode == HT_SPECIAL) {
x1 = _thd.selend.x;
@@ -2050,7 +2050,7 @@ void UpdateTileSelection()
y1 &= ~TILE_UNIT_MASK;
if (IsDraggingDiagonal()) {
- _thd.new_diagonal = true;
+ new_diagonal = true;
} else {
if (x1 >= x2) Swap(x1, x2);
if (y1 >= y2) Swap(y1, y2);
@@ -2059,11 +2059,11 @@ void UpdateTileSelection()
_thd.new_pos.y = y1;
_thd.new_size.x = x2 - x1;
_thd.new_size.y = y2 - y1;
- if (!_thd.new_diagonal) {
+ if (!new_diagonal) {
_thd.new_size.x += TILE_SIZE;
_thd.new_size.y += TILE_SIZE;
}
- _thd.new_drawstyle = _thd.next_drawstyle;
+ new_drawstyle = _thd.next_drawstyle;
}
} else if ((_thd.place_mode & HT_DRAG_MASK) != HT_NONE) {
Point pt = GetTileBelowCursor();
@@ -2072,30 +2072,30 @@ void UpdateTileSelection()
if (x1 != -1) {
switch (_thd.place_mode & HT_DRAG_MASK) {
case HT_RECT:
- _thd.new_drawstyle = HT_RECT;
+ new_drawstyle = HT_RECT;
break;
case HT_POINT:
- _thd.new_drawstyle = HT_POINT;
+ new_drawstyle = HT_POINT;
x1 += TILE_SIZE / 2;
y1 += TILE_SIZE / 2;
break;
case HT_RAIL:
/* Draw one highlighted tile in any direction */
- _thd.new_drawstyle = GetAutorailHT(pt.x, pt.y);
+ new_drawstyle = GetAutorailHT(pt.x, pt.y);
break;
case HT_LINE:
switch (_thd.place_mode & HT_DIR_MASK) {
- case HT_DIR_X: _thd.new_drawstyle = HT_LINE | HT_DIR_X; break;
- case HT_DIR_Y: _thd.new_drawstyle = HT_LINE | HT_DIR_Y; break;
+ case HT_DIR_X: new_drawstyle = HT_LINE | HT_DIR_X; break;
+ case HT_DIR_Y: new_drawstyle = HT_LINE | HT_DIR_Y; break;
case HT_DIR_HU:
case HT_DIR_HL:
- _thd.new_drawstyle = (pt.x & TILE_UNIT_MASK) + (pt.y & TILE_UNIT_MASK) <= TILE_SIZE ? HT_LINE | HT_DIR_HU : HT_LINE | HT_DIR_HL;
+ new_drawstyle = (pt.x & TILE_UNIT_MASK) + (pt.y & TILE_UNIT_MASK) <= TILE_SIZE ? HT_LINE | HT_DIR_HU : HT_LINE | HT_DIR_HL;
break;
case HT_DIR_VL:
case HT_DIR_VR:
- _thd.new_drawstyle = (pt.x & TILE_UNIT_MASK) > (pt.y & TILE_UNIT_MASK) ? HT_LINE | HT_DIR_VL : HT_LINE | HT_DIR_VR;
+ new_drawstyle = (pt.x & TILE_UNIT_MASK) > (pt.y & TILE_UNIT_MASK) ? HT_LINE | HT_DIR_VL : HT_LINE | HT_DIR_VR;
break;
default: NOT_REACHED();
@@ -2113,24 +2113,24 @@ void UpdateTileSelection()
}
/* redraw selection */
- if (_thd.drawstyle != _thd.new_drawstyle ||
+ if (_thd.drawstyle != new_drawstyle ||
_thd.pos.x != _thd.new_pos.x || _thd.pos.y != _thd.new_pos.y ||
_thd.size.x != _thd.new_size.x || _thd.size.y != _thd.new_size.y ||
_thd.outersize.x != _thd.new_outersize.x ||
_thd.outersize.y != _thd.new_outersize.y ||
- _thd.diagonal != _thd.new_diagonal) {
+ _thd.diagonal != new_diagonal) {
/* clear the old selection? */
if (_thd.drawstyle) SetSelectionTilesDirty();
- _thd.drawstyle = _thd.new_drawstyle;
+ _thd.drawstyle = new_drawstyle;
_thd.pos = _thd.new_pos;
_thd.size = _thd.new_size;
_thd.outersize = _thd.new_outersize;
- _thd.diagonal = _thd.new_diagonal;
+ _thd.diagonal = new_diagonal;
_thd.dirty = 0xff;
/* draw the new selection? */
- if (_thd.new_drawstyle) SetSelectionTilesDirty();
+ if (new_drawstyle != HT_NONE) SetSelectionTilesDirty();
}
}