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

Function ChangeVehicleViewports

src/window.cpp:3513–3521  ·  view source on GitHub ↗

* Switches viewports following vehicles, which get autoreplaced * @param from_index the old vehicle ID * @param to_index the new vehicle ID */

Source from the content-addressed store, hash-verified

3511 * @param to_index the new vehicle ID
3512 */
3513void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index)
3514{
3515 for (const Window *w : Window::Iterate()) {
3516 if (w->viewport != nullptr && w->viewport->follow_vehicle == from_index) {
3517 w->viewport->follow_vehicle = to_index;
3518 w->SetDirty();
3519 }
3520 }
3521}
3522
3523
3524/**

Callers 1

CopyHeadSpecificThingsFunction · 0.85

Calls 1

SetDirtyMethod · 0.45

Tested by

no test coverage detected