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