summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-11-18 20:05:44 +0000
committersmatz <smatz@openttd.org>2007-11-18 20:05:44 +0000
commit001179990dc7259ffa8fa31222066f4435d4fdac (patch)
tree71499f861276cd6a23ddca00b9fefed52e09e1ac /src
parentda6ee7c73b3a50f6061b200757ba7af103714d12 (diff)
downloadopenttd-001179990dc7259ffa8fa31222066f4435d4fdac.tar.xz
(svn r11465) -Fix: more user-friedly placement in X and Y directions (most noticeable with autoroad)
Diffstat (limited to 'src')
-rw-r--r--src/viewport.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 74c774ff2..c1b05288c 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2241,8 +2241,8 @@ void UpdateTileSelection()
x1 = _thd.selend.x;
y1 = _thd.selend.y;
if (x1 != -1) {
- int x2 = _thd.selstart.x;
- int y2 = _thd.selstart.y;
+ int x2 = _thd.selstart.x & ~0xF;
+ int y2 = _thd.selstart.y & ~0xF;
x1 &= ~0xF;
y1 &= ~0xF;
@@ -2305,6 +2305,17 @@ void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process
_thd.selstart.x = TileX(tile) * TILE_SIZE;
_thd.selend.y = TileY(tile) * TILE_SIZE;
_thd.selstart.y = TileY(tile) * TILE_SIZE;
+
+ /* Needed so several things (road, autoroad, bridges, ...) are placed correctly.
+ * In effect, placement starts from the centre of a tile
+ */
+ if (method == VPM_X_OR_Y || method == VPM_FIX_X || method == VPM_FIX_Y) {
+ _thd.selend.x += TILE_SIZE / 2;
+ _thd.selend.y += TILE_SIZE / 2;
+ _thd.selstart.x += TILE_SIZE / 2;
+ _thd.selstart.y += TILE_SIZE / 2;
+ }
+
if (_thd.place_mode == VHM_RECT) {
_thd.place_mode = VHM_SPECIAL;
_thd.next_drawstyle = HT_RECT;
@@ -2652,6 +2663,7 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
return;
}
+ /* Needed so level-land is placed correctly */
if (_thd.next_drawstyle == HT_POINT) {
x += TILE_SIZE / 2;
y += TILE_SIZE / 2;