mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 19:54:06 +01:00
Codefix: some coding style improvements
This commit is contained in:
@@ -988,7 +988,7 @@ static bool AircraftController(Aircraft *v)
|
||||
}
|
||||
|
||||
/* Get distance from destination pos to current pos. */
|
||||
uint dist = abs(x + amd.x - v->x_pos) + abs(y + amd.y - v->y_pos);
|
||||
uint dist = abs(x + amd.x - v->x_pos) + abs(y + amd.y - v->y_pos);
|
||||
|
||||
/* Need exact position? */
|
||||
if (!amd.flags.Test(AirportMovingDataFlag::ExactPosition) && dist <= (amd.flags.Test(AirportMovingDataFlag::SlowTurn) ? 8U : 4U)) return true;
|
||||
@@ -1021,10 +1021,21 @@ static bool AircraftController(Aircraft *v)
|
||||
uint speed_limit = SPEED_LIMIT_TAXI;
|
||||
bool hard_limit = true;
|
||||
|
||||
if (amd.flags.Test(AirportMovingDataFlag::NoSpeedClamp)) speed_limit = SPEED_LIMIT_NONE;
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Hold)) { speed_limit = SPEED_LIMIT_HOLD; hard_limit = false; }
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Land)) { speed_limit = SPEED_LIMIT_APPROACH; hard_limit = false; }
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Brake)) { speed_limit = SPEED_LIMIT_TAXI; hard_limit = false; }
|
||||
if (amd.flags.Test(AirportMovingDataFlag::NoSpeedClamp)) {
|
||||
speed_limit = SPEED_LIMIT_NONE;
|
||||
}
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Hold)) {
|
||||
speed_limit = SPEED_LIMIT_HOLD;
|
||||
hard_limit = false;
|
||||
}
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Land)) {
|
||||
speed_limit = SPEED_LIMIT_APPROACH;
|
||||
hard_limit = false;
|
||||
}
|
||||
if (amd.flags.Test(AirportMovingDataFlag::Brake)) {
|
||||
speed_limit = SPEED_LIMIT_TAXI;
|
||||
hard_limit = false;
|
||||
}
|
||||
|
||||
int count = UpdateAircraftSpeed(v, speed_limit, hard_limit);
|
||||
if (count == 0) return false;
|
||||
@@ -1181,7 +1192,7 @@ static bool HandleCrashedAircraft(Aircraft *v)
|
||||
Station *st = GetTargetAirportIfValid(v);
|
||||
|
||||
/* make aircraft crash down to the ground */
|
||||
if (v->crashed_counter < 500 && st == nullptr && ((v->crashed_counter % 3) == 0) ) {
|
||||
if (v->crashed_counter < 500 && st == nullptr && ((v->crashed_counter % 3) == 0)) {
|
||||
int z = GetSlopePixelZ(Clamp(v->x_pos, 0, Map::MaxX() * TILE_SIZE), Clamp(v->y_pos, 0, Map::MaxY() * TILE_SIZE));
|
||||
v->z_pos -= 1;
|
||||
if (v->z_pos <= z) {
|
||||
@@ -1814,7 +1825,7 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
|
||||
{
|
||||
/* error handling */
|
||||
if (v->pos >= apc->nofelements) {
|
||||
Debug(misc, 0, "[Ap] position {} is not valid for current airport. Max position is {}", v->pos, apc->nofelements-1);
|
||||
Debug(misc, 0, "[Ap] position {} is not valid for current airport. Max position is {}", v->pos, apc->nofelements - 1);
|
||||
assert(v->pos < apc->nofelements);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user