* This code is shared for the majority of the pushbuttons. * Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters * * @param w Window which called the function * @param widget ID of the widget (=button) that called this function * @param cursor How should the cursor image change? E.g. cursor with depot image in it * @param mode Tile high
| 61 | * @return true if the button is clicked, false if it's unclicked |
| 62 | */ |
| 63 | bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode) |
| 64 | { |
| 65 | if (w->IsWidgetDisabled(widget)) return false; |
| 66 | |
| 67 | SndClickBeep(); |
| 68 | w->SetDirty(); |
| 69 | |
| 70 | if (w->IsWidgetLowered(widget)) { |
| 71 | ResetObjectToPlace(); |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); |
| 76 | w->LowerWidget(widget); |
| 77 | return true; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | void CcPlaySound_EXPLOSION(Commands, const CommandCost &result, TileIndex tile) |
no test coverage detected