MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / RoadToolbar_CtrlChanged

Function RoadToolbar_CtrlChanged

src/road_gui.cpp:329–342  ·  view source on GitHub ↗

* Updates the Remove button because of Ctrl state change * @param w window the button belongs to * @return true iff the remove button was changed */

Source from the content-addressed store, hash-verified

327 * @return true iff the remove button was changed
328 */
329static bool RoadToolbar_CtrlChanged(Window *w)
330{
331 if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
332
333 /* allow ctrl to switch remove mode only for these widgets */
334 for (WidgetID i = WID_ROT_ROAD_X; i <= WID_ROT_AUTOROAD; i++) {
335 if (w->IsWidgetLowered(i)) {
336 ToggleRoadButton_Remove(w);
337 return true;
338 }
339 }
340
341 return false;
342}
343
344/** Road toolbar window handler. */
345struct BuildRoadToolbarWindow : Window {

Callers 2

OnClickMethod · 0.85
OnCTRLStateChangeMethod · 0.85

Calls 3

ToggleRoadButton_RemoveFunction · 0.85
IsWidgetDisabledMethod · 0.80
IsWidgetLoweredMethod · 0.80

Tested by

no test coverage detected