1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 02:12:37 +01:00

Codechange: replace INVALID_X with XID::Invalid() for PoolIDs

This commit is contained in:
Rubidium
2025-02-16 19:29:53 +01:00
committed by rubidium42
parent d13b0e0813
commit fd4adc55e3
157 changed files with 744 additions and 772 deletions

View File

@@ -2369,7 +2369,7 @@ static EventState HandleViewportScroll()
return ES_NOT_HANDLED;
}
if (_last_scroll_window == GetMainWindow() && _last_scroll_window->viewport->follow_vehicle != INVALID_VEHICLE) {
if (_last_scroll_window == GetMainWindow() && _last_scroll_window->viewport->follow_vehicle != VehicleID::Invalid()) {
/* If the main window is following a vehicle, then first let go of it! */
const Vehicle *veh = Vehicle::Get(_last_scroll_window->viewport->follow_vehicle);
ScrollMainWindowTo(veh->x_pos, veh->y_pos, veh->z_pos, true); // This also resets follow_vehicle
@@ -2691,17 +2691,17 @@ static void HandleAutoscroll()
/* If we succeed at scrolling in any direction, stop following a vehicle. */
static const int SCROLLSPEED = 3;
if (x - 15 < 0) {
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->follow_vehicle = VehicleID::Invalid();
w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * SCROLLSPEED, vp->zoom);
} else if (15 - (vp->width - x) > 0) {
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->follow_vehicle = VehicleID::Invalid();
w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * SCROLLSPEED, vp->zoom);
}
if (y - 15 < 0) {
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->follow_vehicle = VehicleID::Invalid();
w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * SCROLLSPEED, vp->zoom);
} else if (15 - (vp->height - y) > 0) {
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->follow_vehicle = VehicleID::Invalid();
w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * SCROLLSPEED, vp->zoom);
}
}
@@ -2769,7 +2769,7 @@ static void HandleKeyScrolling()
if (_game_mode != GM_MENU && _game_mode != GM_BOOTSTRAP) {
/* Key scrolling stops following a vehicle. */
GetMainWindow()->viewport->follow_vehicle = INVALID_VEHICLE;
GetMainWindow()->viewport->follow_vehicle = VehicleID::Invalid();
}
ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);