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

Method UpdateAutoRefitState

src/order_gui.cpp:759–767  ·  view source on GitHub ↗

Cache auto-refittability of the vehicle chain. */

Source from the content-addressed store, hash-verified

757
758 /** Cache auto-refittability of the vehicle chain. */
759 void UpdateAutoRefitState()
760 {
761 this->can_do_refit = false;
762 this->can_do_autorefit = false;
763 for (const Vehicle *w = this->vehicle; w != nullptr; w = w->IsGroundVehicle() ? w->Next() : nullptr) {
764 if (IsEngineRefittable(w->engine_type)) this->can_do_refit = true;
765 if (Engine::Get(w->engine_type)->info.misc_flags.Test(EngineMiscFlag::AutoRefit)) this->can_do_autorefit = true;
766 }
767 }
768
769public:
770 OrdersWindow(WindowDesc &desc, const Vehicle *v) : Window(desc)

Callers 2

OrdersWindowMethod · 0.95
OnInvalidateDataMethod · 0.95

Calls 4

IsEngineRefittableFunction · 0.85
TestMethod · 0.80
IsGroundVehicleMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected