summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-02 11:26:25 +0000
committerfrosch <frosch@openttd.org>2008-08-02 11:26:25 +0000
commit0fc769bb6c02e3974c8c1bc38e336e480d60d093 (patch)
treeb97cb40953be7e1c6358fb063d63f445d3847aad /src/viewport.cpp
parentb92520ddfdd60f9536790b4ab98228c5970853a7 (diff)
downloadopenttd-0fc769bb6c02e3974c8c1bc38e336e480d60d093.tar.xz
(svn r13922) -Codechange: Move measurement-tooltip related stuff out of the general tooltip window.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 91420c30e..d6ab2eef9 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2201,6 +2201,17 @@ void UpdateTileSelection()
}
}
+/** Displays the measurement tooltips when selecting multiple tiles
+ * @param str String to be displayed
+ * @param paramcount number of params to deal with
+ * @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
+ */
+static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const uint64 params[])
+{
+ if (!_settings_client.gui.measure_tooltip) return;
+ GuiShowTooltips(str, paramcount, params, true);
+}
+
/** highlighting tiles while only going over them with the mouse */
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
{
@@ -2254,7 +2265,7 @@ void VpSetPresizeRange(TileIndex from, TileIndex to)
_thd.next_drawstyle = HT_RECT;
/* show measurement only if there is any length to speak of */
- if (distance > 1) GuiShowTooltipsWithArgs(STR_MEASURE_LENGTH, 1, &distance);
+ if (distance > 1) ShowMeasurementTooltips(STR_MEASURE_LENGTH, 1, &distance);
}
static void VpStartPreSizing()
@@ -2535,7 +2546,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
if (heightdiff != 0) params[index++] = heightdiff;
}
- GuiShowTooltipsWithArgs(measure_strings_length[index], index, params);
+ ShowMeasurementTooltips(measure_strings_length[index], index, params);
}
thd->selend.x = x;
@@ -2614,7 +2625,7 @@ calc_heightdiff_single_direction:;
if (heightdiff != 0) params[index++] = heightdiff;
}
- GuiShowTooltipsWithArgs(measure_strings_length[index], index, params);
+ ShowMeasurementTooltips(measure_strings_length[index], index, params);
} break;
case VPM_X_AND_Y_LIMITED: { /* drag an X by Y constrained rect area */
@@ -2654,7 +2665,7 @@ calc_heightdiff_single_direction:;
if (heightdiff != 0) params[index++] = heightdiff;
}
- GuiShowTooltipsWithArgs(measure_strings_area[index], index, params);
+ ShowMeasurementTooltips(measure_strings_area[index], index, params);
}
break;