2292 calc_heightdiff_single_direction:; |
2292 calc_heightdiff_single_direction:; |
2293 if (_patches.measure_tooltip) { |
2293 if (_patches.measure_tooltip) { |
2294 TileIndex t0 = TileVirtXY(sx, sy); |
2294 TileIndex t0 = TileVirtXY(sx, sy); |
2295 TileIndex t1 = TileVirtXY(x, y); |
2295 TileIndex t1 = TileVirtXY(x, y); |
2296 uint distance = DistanceManhattan(t0, t1) + 1; |
2296 uint distance = DistanceManhattan(t0, t1) + 1; |
2297 int heightdiff = CalcHeightdiff((_thd.next_drawstyle & HT_DRAG_MASK) | style, 0, t0, t1); |
2297 /* With current code passing a HT_LINE style to calculate the height |
|
2298 * difference is enough. However if/when a point-tool is created |
|
2299 * with this method, function should be called with new_style (below) |
|
2300 * instead of HT_LINE | style case HT_POINT is handled specially |
|
2301 * new_style := (_thd.next_drawstyle & HT_RECT) ? HT_LINE | style : _thd.next_drawstyle; */ |
|
2302 int heightdiff = CalcHeightdiff(HT_LINE | style, 0, t0, t1); |
2298 uint params[2]; |
2303 uint params[2]; |
2299 |
2304 |
2300 params[0] = distance; |
2305 params[0] = distance; |
2301 if (heightdiff == 0) { |
2306 if (heightdiff == 0) { |
2302 GuiShowTooltipsWithArgs(STR_MEASURE_LENGTH, 1, params); |
2307 GuiShowTooltipsWithArgs(STR_MEASURE_LENGTH, 1, params); |
2315 if (_patches.measure_tooltip) { |
2320 if (_patches.measure_tooltip) { |
2316 TileIndex t0 = TileVirtXY(sx, sy); |
2321 TileIndex t0 = TileVirtXY(sx, sy); |
2317 TileIndex t1 = TileVirtXY(x, y); |
2322 TileIndex t1 = TileVirtXY(x, y); |
2318 uint dx = abs(TileX(t0) - TileX(t1)) + 1; |
2323 uint dx = abs(TileX(t0) - TileX(t1)) + 1; |
2319 uint dy = abs(TileY(t0) - TileY(t1)) + 1; |
2324 uint dy = abs(TileY(t0) - TileY(t1)) + 1; |
2320 HighLightStyle style = _thd.next_drawstyle; |
|
2321 int heightdiff; |
2325 int heightdiff; |
2322 uint params[3]; |
2326 uint params[3]; |
2323 |
2327 |
2324 /* If dragging an area (eg dynamite tool) and it is actually a single |
2328 /* If dragging an area (eg dynamite tool) and it is actually a single |
2325 * row/column, change the type to 'line' to get proper calculation for height */ |
2329 * row/column, change the type to 'line' to get proper calculation for height */ |
|
2330 style = _thd.next_drawstyle; |
2326 if (style & HT_RECT) { |
2331 if (style & HT_RECT) { |
2327 if (dx == 1) { |
2332 if (dx == 1) { |
2328 style = HT_LINE | HT_DIR_Y; |
2333 style = HT_LINE | HT_DIR_Y; |
2329 } else if (dy == 1) { |
2334 } else if (dy == 1) { |
2330 style = HT_LINE | HT_DIR_X; |
2335 style = HT_LINE | HT_DIR_X; |