1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 08:14:38 +01:00

Give a variable for an arithmetic operation used as a condition

Avoid reverse logic around if-statement for the sake of readability.

Reported by PVS-Studio (Warning: V793).

Fix 4/7.

Issue: 12523
This commit is contained in:
Vinicius Sa
2020-10-03 00:51:26 -03:00
parent d583911997
commit 59e9162137

View File

@@ -35,18 +35,23 @@ void vehicle_visual_observation_tower(
int32_t baseImage_id = (vehicle->restraints_position / 64);
if (vehicle->restraints_position >= 64)
{
if ((imageDirection / 8) && (imageDirection / 8) != 3)
auto directionOffset = imageDirection / 8;
if ((directionOffset == 0) || (directionOffset == 3))
{
baseImage_id *= 2;
baseImage_id += vehicleEntry->base_image_id + 28;
if ((imageDirection / 8) != 1)
{
baseImage_id -= 6;
}
baseImage_id = vehicleEntry->base_image_id + 8;
}
else
{
baseImage_id = vehicleEntry->base_image_id + 8;
baseImage_id *= 2;
baseImage_id += vehicleEntry->base_image_id;
if (directionOffset == 1)
{
baseImage_id += 28;
}
else
{
baseImage_id += 22;
}
}
}
else