2023 * in the case of a rect (HT_RECT, HT_POINT): DIR_S, DIR_E |
2023 * in the case of a rect (HT_RECT, HT_POINT): DIR_S, DIR_E |
2024 * For example dragging a rectangle area from south to north should be swapped to |
2024 * For example dragging a rectangle area from south to north should be swapped to |
2025 * north-south (DIR_S) to obtain the same results with less code. This is what |
2025 * north-south (DIR_S) to obtain the same results with less code. This is what |
2026 * the return value signifies. |
2026 * the return value signifies. |
2027 * @param style HighLightStyle dragging style |
2027 * @param style HighLightStyle dragging style |
2028 * @param start_tile, end_tile start and end tile of drag |
2028 * @param start_tile start tile of drag |
2029 * @param boolean value which when true means start/end should be swapped */ |
2029 * @param end_tile end tile of drag |
|
2030 * @return boolean value which when true means start/end should be swapped */ |
2030 static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex end_tile) |
2031 static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex end_tile) |
2031 { |
2032 { |
2032 uint start_x = TileX(start_tile); |
2033 uint start_x = TileX(start_tile); |
2033 uint start_y = TileY(start_tile); |
2034 uint start_y = TileY(start_tile); |
2034 uint end_x = TileX(end_tile); |
2035 uint end_x = TileX(end_tile); |
2049 /** Calculates height difference between one tile and another |
2050 /** Calculates height difference between one tile and another |
2050 * Multiplies the result to suit the standard given by minimap - 50 meters high |
2051 * Multiplies the result to suit the standard given by minimap - 50 meters high |
2051 * To correctly get the height difference we need the direction we are dragging |
2052 * To correctly get the height difference we need the direction we are dragging |
2052 * in, as well as with what kind of tool we are dragging. For example a horizontal |
2053 * in, as well as with what kind of tool we are dragging. For example a horizontal |
2053 * autorail tool that starts in bottom and ends at the top of a tile will need the |
2054 * autorail tool that starts in bottom and ends at the top of a tile will need the |
2054 * maximum of SW,S and SE,N corners respectively. This is handled by the lookup table below |
2055 * maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below |
2055 * See _tileoffs_by_dir in map.c for the direction enums if you can't figure out |
2056 * See _tileoffs_by_dir in map.c for the direction enums if you can't figure out |
2056 * the values yourself. |
2057 * the values yourself. |
2057 * @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.) |
2058 * @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.) |
2058 * @param distance amount of tiles dragged, important for horizontal/vertical drags |
2059 * @param distance amount of tiles dragged, important for horizontal/vertical drags |
2059 * ignored for others |
2060 * ignored for others |
2394 if (_special_mouse_mode != WSM_SIZING) return true; |
2395 if (_special_mouse_mode != WSM_SIZING) return true; |
2395 |
2396 |
2396 e.we.place.userdata = _thd.userdata; |
2397 e.we.place.userdata = _thd.userdata; |
2397 |
2398 |
2398 /* stop drag mode if the window has been closed */ |
2399 /* stop drag mode if the window has been closed */ |
2399 w = BaseWindow::FindById(_thd.window_class,_thd.window_number); |
2400 w = BaseWindow::FindById(_thd.window_class, _thd.window_number); |
2400 if (w == NULL) { |
2401 if (w == NULL) { |
2401 ResetObjectToPlace(); |
2402 ResetObjectToPlace(); |
2402 return false; |
2403 return false; |
2403 } |
2404 } |
2404 |
2405 |