Plans: Fix adding plan lines in viewport map mode

pull/195/head
Jonathan G Rennison 4 years ago
parent 3b47b7b091
commit 38ebad6123

@ -107,7 +107,7 @@ struct PlansWindow : Window {
DoCommandP(0, _local_company, 0, CMD_ADD_PLAN, CcAddPlan);
break;
case WID_PLN_ADD_LINES:
if (_current_plan) HandlePlacePushButton(this, widget, SPR_CURSOR_MOUSE, HT_POINT);
if (_current_plan) HandlePlacePushButton(this, widget, SPR_CURSOR_MOUSE, HT_POINT | HT_MAP);
break;
case WID_PLN_DELETE:
if (this->selected != INT_MAX) {
@ -416,7 +416,7 @@ void CcAddPlan(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2,
((PlansWindow *) w)->SelectPlan(_current_plan->index);
if (!w->IsWidgetLowered(WID_PLN_ADD_LINES)) {
w->SetWidgetDisabledState(WID_PLN_ADD_LINES, false);
HandlePlacePushButton(w, WID_PLN_ADD_LINES, SPR_CURSOR_MOUSE, HT_POINT);
HandlePlacePushButton(w, WID_PLN_ADD_LINES, SPR_CURSOR_MOUSE, HT_POINT | HT_MAP);
}
}
}

@ -30,6 +30,7 @@ enum HighLightStyle {
HT_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
HT_TUNNEL = 0x1000,///< tunnel highlight hint
HT_MAP = 0x2000,///< Allow in viewport map mode
/* lower bits (used with HT_LINE and HT_RAIL):
* (see ASCII art in table/autorail.h for a visual interpretation) */

@ -4060,7 +4060,7 @@ bool HandleViewportDoubleClicked(Window *w, int x, int y)
bool HandleViewportClicked(const Viewport *vp, int x, int y, bool double_click)
{
/* No click in smallmap mode except for plan making. */
if (vp->zoom >= ZOOM_LVL_DRAW_MAP && !(_thd.place_mode == HT_POINT && _thd.select_proc == DDSP_DRAW_PLANLINE)) return true;
if (vp->zoom >= ZOOM_LVL_DRAW_MAP && !(_thd.place_mode & HT_MAP)) return true;
const Vehicle *v = CheckClickOnVehicle(vp, x, y);
@ -4086,6 +4086,8 @@ bool HandleViewportClicked(const Viewport *vp, int x, int y, bool double_click)
return true;
}
if (vp->zoom >= ZOOM_LVL_DRAW_MAP) return true;
if (CheckClickOnViewportSign(vp, x, y)) return true;
bool result = CheckClickOnLandscape(vp, x, y);

Loading…
Cancel
Save