Plans: Fix adding plan lines in viewport map mode
This commit is contained in:
@@ -107,7 +107,7 @@ struct PlansWindow : Window {
|
|||||||
DoCommandP(0, _local_company, 0, CMD_ADD_PLAN, CcAddPlan);
|
DoCommandP(0, _local_company, 0, CMD_ADD_PLAN, CcAddPlan);
|
||||||
break;
|
break;
|
||||||
case WID_PLN_ADD_LINES:
|
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;
|
break;
|
||||||
case WID_PLN_DELETE:
|
case WID_PLN_DELETE:
|
||||||
if (this->selected != INT_MAX) {
|
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);
|
((PlansWindow *) w)->SelectPlan(_current_plan->index);
|
||||||
if (!w->IsWidgetLowered(WID_PLN_ADD_LINES)) {
|
if (!w->IsWidgetLowered(WID_PLN_ADD_LINES)) {
|
||||||
w->SetWidgetDisabledState(WID_PLN_ADD_LINES, false);
|
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_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
|
||||||
HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
|
HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
|
||||||
HT_TUNNEL = 0x1000,///< tunnel highlight hint
|
HT_TUNNEL = 0x1000,///< tunnel highlight hint
|
||||||
|
HT_MAP = 0x2000,///< Allow in viewport map mode
|
||||||
|
|
||||||
/* lower bits (used with HT_LINE and HT_RAIL):
|
/* lower bits (used with HT_LINE and HT_RAIL):
|
||||||
* (see ASCII art in table/autorail.h for a visual interpretation) */
|
* (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)
|
bool HandleViewportClicked(const Viewport *vp, int x, int y, bool double_click)
|
||||||
{
|
{
|
||||||
/* No click in smallmap mode except for plan making. */
|
/* 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);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vp->zoom >= ZOOM_LVL_DRAW_MAP) return true;
|
||||||
|
|
||||||
if (CheckClickOnViewportSign(vp, x, y)) return true;
|
if (CheckClickOnViewportSign(vp, x, y)) return true;
|
||||||
bool result = CheckClickOnLandscape(vp, x, y);
|
bool result = CheckClickOnLandscape(vp, x, y);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user