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

Method OnInvalidateData

src/vehicle_gui.cpp:2234–2250  ·  view source on GitHub ↗

* Some data on this window has become invalid. * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */

Source from the content-addressed store, hash-verified

2232 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
2233 */
2234 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
2235 {
2236 if (!gui_scope && HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
2237 /* Needs to be done in command-scope, so everything stays valid */
2238 this->vli.SetIndex(GB(data, 0, 20));
2239 this->window_number = this->vli.ToWindowNumber();
2240 this->vehgroups.ForceRebuild();
2241 return;
2242 }
2243
2244 if (data == 0) {
2245 /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
2246 this->vehgroups.ForceRebuild();
2247 } else {
2248 this->vehgroups.ForceResort();
2249 }
2250 }
2251};
2252
2253static WindowDesc _vehicle_list_desc[] = {

Callers

nothing calls this directly

Calls 6

HasBitFunction · 0.85
GBFunction · 0.85
ToWindowNumberMethod · 0.80
ForceRebuildMethod · 0.80
ForceResortMethod · 0.80
SetIndexMethod · 0.45

Tested by

no test coverage detected