highlighting tiles while only going over them with the mouse */
| 2796 | |
| 2797 | /** highlighting tiles while only going over them with the mouse */ |
| 2798 | void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process) |
| 2799 | { |
| 2800 | _thd.select_method = method; |
| 2801 | _thd.select_proc = process; |
| 2802 | _thd.selend.x = TileX(tile) * TILE_SIZE; |
| 2803 | _thd.selstart.x = TileX(tile) * TILE_SIZE; |
| 2804 | _thd.selend.y = TileY(tile) * TILE_SIZE; |
| 2805 | _thd.selstart.y = TileY(tile) * TILE_SIZE; |
| 2806 | |
| 2807 | /* Needed so several things (road, autoroad, bridges, ...) are placed correctly. |
| 2808 | * In effect, placement starts from the centre of a tile |
| 2809 | */ |
| 2810 | if (method == VPM_X_OR_Y || method == VPM_FIX_X || method == VPM_FIX_Y) { |
| 2811 | _thd.selend.x += TILE_SIZE / 2; |
| 2812 | _thd.selend.y += TILE_SIZE / 2; |
| 2813 | _thd.selstart.x += TILE_SIZE / 2; |
| 2814 | _thd.selstart.y += TILE_SIZE / 2; |
| 2815 | } |
| 2816 | |
| 2817 | HighLightStyle others = _thd.place_mode & ~(HT_DRAG_MASK | HT_DIR_MASK); |
| 2818 | if ((_thd.place_mode & HT_DRAG_MASK) == HT_RECT) { |
| 2819 | _thd.place_mode = HT_SPECIAL | others; |
| 2820 | _thd.next_drawstyle = HT_RECT | others; |
| 2821 | } else if (_thd.place_mode & (HT_RAIL | HT_LINE)) { |
| 2822 | _thd.place_mode = HT_SPECIAL | others; |
| 2823 | _thd.next_drawstyle = _thd.drawstyle | others; |
| 2824 | } else { |
| 2825 | _thd.place_mode = HT_SPECIAL | others; |
| 2826 | _thd.next_drawstyle = HT_POINT | others; |
| 2827 | } |
| 2828 | _special_mouse_mode = WSM_SIZING; |
| 2829 | } |
| 2830 | |
| 2831 | /** Drag over the map while holding the left mouse down. */ |
| 2832 | void VpStartDragging(ViewportDragDropSelectionProcess process) |
no test coverage detected