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

Function SetScriptButtonColour

src/script/script_gui.cpp:646–657  ·  view source on GitHub ↗

* Set the widget colour of a button based on the * state of the script. (dead or alive) * @param button the button to update. * @param dead true if the script is dead, otherwise false. * @param paused true if the script is paused, otherwise false. * @return true if the colour was changed and the window need to be marked as dirty. */

Source from the content-addressed store, hash-verified

644 * @return true if the colour was changed and the window need to be marked as dirty.
645 */
646static bool SetScriptButtonColour(NWidgetCore &button, bool dead, bool paused)
647{
648 /* Dead scripts are indicated with red background and
649 * paused scripts are indicated with yellow background. */
650 Colours colour = dead ? COLOUR_RED :
651 (paused ? COLOUR_YELLOW : COLOUR_GREY);
652 if (button.colour != colour) {
653 button.colour = colour;
654 return true;
655 }
656 return false;
657}
658
659/**
660 * Window with everything an AI prints via ScriptLog.

Callers 2

UpdateAIButtonsStateMethod · 0.85
UpdateGSButtonStateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected