forked from rosebudai/OpenRCT2-Web
Merge variable declarations and assignment into one line
This commit is contained in:
1 parent
42d69af5b5
commit
71d636e6b1
13 files changed
+30
-61
No files matched your search
@@ -41,12 +41,11 @@ namespace OpenRCT2::Compression
|
||||
if (sourceLength > source.GetLength() - source.GetPosition())
|
||||
throw IOException("Not Enough Data to Compress");
|
||||
|
||||
int ret;
|
||||
StreamReadBuffer sourceBuf(source, sourceLength, kZlibChunkSize);
|
||||
StreamWriteBuffer destBuf(dest, zlibCompressBound(sourceLength), kZlibChunkSize);
|
||||
|
||||
z_stream strm{};
|
||||
ret = deflateInit2(&strm, level, Z_DEFLATED, kZlibWindowBits[static_cast<int>(header)], 8, Z_DEFAULT_STRATEGY);
|
||||
int ret = deflateInit2(&strm, level, Z_DEFLATED, kZlibWindowBits[static_cast<int>(header)], 8, Z_DEFAULT_STRATEGY);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
LOG_ERROR("Failed to initialise stream");
|
||||
@@ -88,12 +87,11 @@ namespace OpenRCT2::Compression
|
||||
if (sourceLength > source.GetLength() - source.GetPosition())
|
||||
throw IOException("Not Enough Data to Decompress");
|
||||
|
||||
int ret;
|
||||
StreamReadBuffer sourceBuf(source, sourceLength, kZlibChunkSize);
|
||||
StreamWriteBuffer destBuf(dest, decompressLength, kZlibChunkSize);
|
||||
|
||||
z_stream strm{};
|
||||
ret = inflateInit2(&strm, kZlibWindowBits[static_cast<int>(header)]);
|
||||
int ret = inflateInit2(&strm, kZlibWindowBits[static_cast<int>(header)]);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
LOG_ERROR("Failed to initialise stream");
|
||||
@@ -157,7 +155,6 @@ namespace OpenRCT2::Compression
|
||||
if (sourceLength > source.GetLength() - source.GetPosition())
|
||||
throw IOException("Not Enough Data to Compress");
|
||||
|
||||
size_t ret;
|
||||
StreamReadBuffer sourceBuf(source, sourceLength, ZSTD_CStreamInSize());
|
||||
StreamWriteBuffer destBuf(dest, zstdCompressBound(sourceLength), ZSTD_CStreamOutSize());
|
||||
unsigned metaFlags = static_cast<unsigned>(metadata);
|
||||
@@ -170,7 +167,7 @@ namespace OpenRCT2::Compression
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = ZSTD_CCtx_setParameter(ctx.get(), ZSTD_c_compressionLevel, level);
|
||||
size_t ret = ZSTD_CCtx_setParameter(ctx.get(), ZSTD_c_compressionLevel, level);
|
||||
if (ZSTD_isError(ret))
|
||||
{
|
||||
LOG_ERROR("Failed to set compression level with error: %s", ZSTD_getErrorName(ret));
|
||||
|
||||
@@ -4355,10 +4355,9 @@ void Guest::UpdateRideLeaveVehicle()
|
||||
return;
|
||||
}
|
||||
|
||||
CoordsXYZ waypointLoc;
|
||||
const auto& rtd = ride->getRideTypeDescriptor();
|
||||
waypointLoc = { rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation),
|
||||
exitLocation.z + ride->getRideTypeDescriptor().Heights.PlatformHeight };
|
||||
CoordsXYZ waypointLoc = { rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation),
|
||||
exitLocation.z + ride->getRideTypeDescriptor().Heights.PlatformHeight };
|
||||
|
||||
rideEntry = vehicle->GetRideEntry();
|
||||
carEntry = &rideEntry->Cars[vehicle->vehicle_type];
|
||||
@@ -4559,10 +4558,9 @@ void Guest::UpdateRideApproachVehicleWaypoints()
|
||||
|
||||
void UpdateRideApproachVehicleWaypointsMotionSimulator(Guest& guest, const CoordsXY& loc, int16_t& xy_distance)
|
||||
{
|
||||
int16_t actionZ;
|
||||
auto ride = GetRide(guest.CurrentRide);
|
||||
// Motion simulators have steps this moves the peeps up the steps
|
||||
actionZ = ride->getStation(guest.CurrentRideStation).GetBaseZ() + 2;
|
||||
// Motion simulators have steps. This moves the peeps up the steps.
|
||||
int16_t actionZ = ride->getStation(guest.CurrentRideStation).GetBaseZ() + 2;
|
||||
|
||||
uint8_t waypoint = guest.Var37 & 3;
|
||||
if (waypoint == 2)
|
||||
@@ -6487,11 +6485,8 @@ bool Loc690FD0(Guest& guest, RideId* rideToView, uint8_t* rideSeatToView, TileEl
|
||||
*/
|
||||
static bool GuestFindRideToLookAt(Guest& guest, uint8_t edge, RideId* rideToView, uint8_t* rideSeatToView)
|
||||
{
|
||||
TileElement* tileElement;
|
||||
|
||||
auto surfaceElement = MapGetSurfaceElementAt(guest.NextLoc);
|
||||
|
||||
tileElement = reinterpret_cast<TileElement*>(surfaceElement);
|
||||
TileElement* tileElement = reinterpret_cast<TileElement*>(surfaceElement);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -25,12 +25,10 @@ bool EntityBase::Is<Litter>() const
|
||||
|
||||
static bool IsLocationLitterable(const CoordsXYZ& mapPos)
|
||||
{
|
||||
TileElement* tileElement;
|
||||
|
||||
if (!MapIsLocationOwned(mapPos))
|
||||
return false;
|
||||
|
||||
tileElement = MapGetFirstElementAt(mapPos);
|
||||
TileElement* tileElement = MapGetFirstElementAt(mapPos);
|
||||
if (tileElement == nullptr)
|
||||
return false;
|
||||
do
|
||||
|
||||
@@ -1221,11 +1221,9 @@ void PeepUpdateCrowdNoise()
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t volume;
|
||||
|
||||
// Formula to scale peeps to dB where peeps [0, 120] scales approximately logarithmically to [-3314, -150] dB/100
|
||||
// 207360000 maybe related to DSBVOLUME_MIN which is -10,000 (dB/100)
|
||||
volume = 120 - std::min(visiblePeeps, 120);
|
||||
int32_t volume = 120 - std::min(visiblePeeps, 120);
|
||||
volume = volume * volume * volume * volume;
|
||||
volume = (viewport->zoom.ApplyInversedTo(207360000 - volume) - 207360000) / 65536 - 150;
|
||||
|
||||
|
||||
@@ -108,8 +108,7 @@ static bool InvalidArguments(bool* invalid, bool arguments);
|
||||
static int32_t ConsoleParseInt(const std::string& src, bool* valid)
|
||||
{
|
||||
utf8* end;
|
||||
int32_t value;
|
||||
value = static_cast<int32_t>(strtol(src.c_str(), &end, 10));
|
||||
int32_t value = static_cast<int32_t>(strtol(src.c_str(), &end, 10));
|
||||
*valid = (*end == '\0');
|
||||
return value;
|
||||
}
|
||||
@@ -117,8 +116,7 @@ static int32_t ConsoleParseInt(const std::string& src, bool* valid)
|
||||
static double ConsoleParseDouble(const std::string& src, bool* valid)
|
||||
{
|
||||
utf8* end;
|
||||
double value;
|
||||
value = strtod(src.c_str(), &end);
|
||||
double value = strtod(src.c_str(), &end);
|
||||
*valid = (*end == '\0');
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -227,9 +227,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
|
||||
int32_t WindowGetScrollDataIndex(const WindowBase& w, WidgetIndex widget_index)
|
||||
{
|
||||
int32_t i, result;
|
||||
|
||||
result = 0;
|
||||
int32_t i, result = 0;
|
||||
for (i = 0; i < widget_index; i++)
|
||||
{
|
||||
const auto& widget = w.widgets[i];
|
||||
|
||||
@@ -345,8 +345,6 @@ namespace OpenRCT2::PathFinding
|
||||
static PathSearchResult FootpathElementNextInDirection(
|
||||
TileCoordsXYZ loc, PathElement* pathElement, Direction chosenDirection)
|
||||
{
|
||||
TileElement* nextTileElement;
|
||||
|
||||
if (pathElement->IsSloped())
|
||||
{
|
||||
if (pathElement->GetSlopeDirection() == chosenDirection)
|
||||
@@ -356,7 +354,7 @@ namespace OpenRCT2::PathFinding
|
||||
}
|
||||
|
||||
loc += TileDirectionDelta[chosenDirection];
|
||||
nextTileElement = MapGetFirstElementAt(loc);
|
||||
TileElement* nextTileElement = MapGetFirstElementAt(loc);
|
||||
do
|
||||
{
|
||||
if (nextTileElement == nullptr)
|
||||
|
||||
@@ -489,11 +489,10 @@ bool TrackCircuitIteratorsMatch(const TrackCircuitIterator* firstIt, const Track
|
||||
|
||||
void TrackGetBack(const CoordsXYE& input, CoordsXYE* output)
|
||||
{
|
||||
CoordsXYE lastTrack;
|
||||
CoordsXYE lastTrack = input;
|
||||
TrackBeginEnd currentTrack;
|
||||
bool result;
|
||||
|
||||
lastTrack = input;
|
||||
do
|
||||
{
|
||||
result = TrackBlockGetPrevious(lastTrack, ¤tTrack);
|
||||
|
||||
@@ -4141,13 +4141,11 @@ void Vehicle::UpdateTopSpinOperating()
|
||||
*/
|
||||
void Vehicle::UpdateShowingFilm()
|
||||
{
|
||||
int32_t currentTime, totalTime;
|
||||
|
||||
if (_vehicleBreakdown == 0)
|
||||
return;
|
||||
|
||||
totalTime = kRideFilmLength[sub_state];
|
||||
currentTime = current_time + 1;
|
||||
int32_t totalTime = kRideFilmLength[sub_state];
|
||||
int32_t currentTime = current_time + 1;
|
||||
if (currentTime <= totalTime)
|
||||
{
|
||||
current_time = currentTime;
|
||||
|
||||
@@ -782,15 +782,14 @@ void FootpathChainRideQueue(
|
||||
RideId rideIndex, StationIndex entranceIndex, const CoordsXY& initialFootpathPos, TileElement* const initialTileElement,
|
||||
int32_t direction)
|
||||
{
|
||||
TileElement *lastPathElement, *lastQueuePathElement;
|
||||
TileElement* lastPathElement = nullptr;
|
||||
TileElement* lastQueuePathElement = nullptr;
|
||||
auto tileElement = initialTileElement;
|
||||
auto curQueuePos = initialFootpathPos;
|
||||
auto lastPath = curQueuePos;
|
||||
int32_t baseZ = tileElement->GetBaseZ();
|
||||
int32_t lastPathDirection = direction;
|
||||
|
||||
lastPathElement = nullptr;
|
||||
lastQueuePathElement = nullptr;
|
||||
for (;;)
|
||||
{
|
||||
if (tileElement->GetType() == TileElementType::Path)
|
||||
|
||||
@@ -572,13 +572,12 @@ int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope)
|
||||
int8_t quad = 0, quad_extra = 0; // which quadrant the element is in?
|
||||
// quad_extra is for extra height tiles
|
||||
|
||||
uint8_t xl, yl; // coordinates across this tile
|
||||
// coordinates across this tile
|
||||
uint8_t xl = loc.x & 0x1f;
|
||||
uint8_t yl = loc.y & 0x1f;
|
||||
|
||||
uint8_t TILE_SIZE = 32;
|
||||
|
||||
xl = loc.x & 0x1f;
|
||||
yl = loc.y & 0x1f;
|
||||
|
||||
// Slope logic:
|
||||
// Each of the four bits in slope represents that corner being raised
|
||||
// slope == 15 (all four bits) is not used and slope == 0 is flat
|
||||
@@ -1769,13 +1768,11 @@ void MapInvalidateElement(const CoordsXY& elementPos, TileElement* tileElement)
|
||||
|
||||
void MapInvalidateRegion(const CoordsXY& mins, const CoordsXY& maxs)
|
||||
{
|
||||
int32_t x0, y0, x1, y1, left, right, top, bottom;
|
||||
|
||||
x0 = mins.x + 16;
|
||||
y0 = mins.y + 16;
|
||||
|
||||
x1 = maxs.x + 16;
|
||||
y1 = maxs.y + 16;
|
||||
int32_t x0 = mins.x + 16;
|
||||
int32_t y0 = mins.y + 16;
|
||||
int32_t x1 = maxs.x + 16;
|
||||
int32_t y1 = maxs.y + 16;
|
||||
int32_t left, right, top, bottom;
|
||||
|
||||
MapGetBoundingBox({ x0, y0, x1, y1 }, &left, &top, &right, &bottom);
|
||||
|
||||
|
||||
@@ -126,9 +126,7 @@ int32_t LargeSceneryText::MeasureHeight(std::string_view text) const
|
||||
|
||||
void SceneryUpdateTile(const CoordsXY& sceneryPos)
|
||||
{
|
||||
TileElement* tileElement;
|
||||
|
||||
tileElement = MapGetFirstElementAt(sceneryPos);
|
||||
TileElement* tileElement = MapGetFirstElementAt(sceneryPos);
|
||||
if (tileElement == nullptr)
|
||||
return;
|
||||
do
|
||||
|
||||
@@ -44,9 +44,7 @@ void WallRemoveAtZ(const CoordsXYZ& wallPos)
|
||||
*/
|
||||
void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direction)
|
||||
{
|
||||
TileElement* tileElement;
|
||||
|
||||
tileElement = MapGetFirstElementAt(wallPos);
|
||||
TileElement* tileElement = MapGetFirstElementAt(wallPos);
|
||||
if (tileElement == nullptr)
|
||||
return;
|
||||
do
|
||||
@@ -125,9 +123,7 @@ uint8_t GetWallSlopeFromEdgeSlope(uint8_t Slope, uint8_t Edge)
|
||||
*/
|
||||
bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction)
|
||||
{
|
||||
TileElement* tileElement;
|
||||
|
||||
tileElement = MapGetFirstElementAt(fencePos);
|
||||
TileElement* tileElement = MapGetFirstElementAt(fencePos);
|
||||
if (tileElement == nullptr)
|
||||
return false;
|
||||
do
|
||||
|
||||
Reference in new issue
Block a user