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

Function UpdateElement

src/story.cpp:106–127  ·  view source on GitHub ↗

* This helper for Create/Update PageElement Cmd procedure updates a page * element with new content data. * @param pe The page element to update * @param tile The tile parameter of the DoCommand proc * @param reference The reference parameter of the DoCommand proc (p2) * @param text The text parameter of the DoCommand proc */

Source from the content-addressed store, hash-verified

104 * @param text The text parameter of the DoCommand proc
105 */
106static void UpdateElement(StoryPageElement &pe, TileIndex tile, uint32_t reference, const EncodedString &text)
107{
108 switch (pe.type) {
109 case SPET_TEXT:
110 pe.text = text;
111 break;
112 case SPET_LOCATION:
113 pe.text = text;
114 pe.referenced_id = tile.base();
115 break;
116 case SPET_GOAL:
117 pe.referenced_id = reference;
118 break;
119 case SPET_BUTTON_PUSH:
120 case SPET_BUTTON_TILE:
121 case SPET_BUTTON_VEHICLE:
122 pe.text = text;
123 pe.referenced_id = reference;
124 break;
125 default: NOT_REACHED();
126 }
127}
128
129/** Set the button background colour. */
130void StoryPageButtonData::SetColour(Colours button_colour)

Callers 2

Calls 2

NOT_REACHEDFunction · 0.85
baseMethod · 0.45

Tested by

no test coverage detected