review changes (squash)

This commit is contained in:
aw20368 2019-06-16 12:23:17 -04:00 committed by Tulio Leao
parent c76378bc8b
commit d2e5c29ce0
3 changed files with 6 additions and 5 deletions

View File

@ -3591,8 +3591,8 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords)
return; return;
} }
// search for appropriate z value for ghost, up to max ride height (2^12 - 16) // search for appropriate z value for ghost, up to max ride height
int numAttempts = (z <= 2032 ? (2032 - z) / 8 + 1 : 2); int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2);
for (int zAttempts = numAttempts; zAttempts > 1; zAttempts--) for (int zAttempts = numAttempts; zAttempts > 1; zAttempts--)
{ {
window_ride_construction_update_state( window_ride_construction_update_state(
@ -3855,8 +3855,8 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords)
return; return;
} }
// search for appropriate z value, up to max ride height (2^12 - 16) // search for z value to build at, up to max ride height
int numAttempts = (z <= 2032 ? (2032 - z) / 8 + 1 : 2); int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2);
for (int32_t zAttempts = numAttempts; zAttempts > 0; zAttempts--) for (int32_t zAttempts = numAttempts; zAttempts > 0; zAttempts--)
{ {

View File

@ -224,7 +224,7 @@ public:
clearanceZ = (clearanceZ / 8) + baseZ; clearanceZ = (clearanceZ / 8) + baseZ;
if (clearanceZ >= 255) if (clearanceZ > MAX_TRACK_HEIGHT)
{ {
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_HIGH); return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_TOO_HIGH);
} }

View File

@ -78,6 +78,7 @@ enum
}; };
#define MAX_STATION_PLATFORM_LENGTH 32 #define MAX_STATION_PLATFORM_LENGTH 32
constexpr uint16_t const MAX_TRACK_HEIGHT = 254;
enum enum
{ {