Merge pull request #18256 from rik-smeets/attack-path-virtual-floor-snakes

Code style: remove snakes from path supports & virtual floor
This commit is contained in:
Rik Smeets 2022-10-08 21:23:41 +02:00 committed by GitHub
commit 5e080032d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 58 additions and 58 deletions

View File

@ -158,9 +158,9 @@ void InputManager::HandleModifiers()
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
if (gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z))
virtual_floor_enable();
VirtualFloorEnable();
else
virtual_floor_disable();
VirtualFloorDisable();
}
}

View File

@ -1346,7 +1346,7 @@ static void Sub6E1F34SmallScenery(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outQuadrant = quadrant ^ 2;
@ -1430,7 +1430,7 @@ static void Sub6E1F34SmallScenery(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outQuadrant = 0;
@ -1464,7 +1464,7 @@ static void Sub6E1F34PathItem(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outZ = info.Element->GetBaseZ();
@ -1553,7 +1553,7 @@ static void Sub6E1F34Wall(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outEdges = edge;
@ -1652,7 +1652,7 @@ static void Sub6E1F34LargeScenery(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outDirection = rotation;
@ -1700,7 +1700,7 @@ static void Sub6E1F34Banner(
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_set_height(gSceneryPlaceZ);
VirtualFloorSetHeight(gSceneryPlaceZ);
}
*outDirection = rotation;
@ -2613,7 +2613,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos)
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
virtual_floor_invalidate();
VirtualFloorInvalidate();
}
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;

View File

@ -1168,7 +1168,7 @@ bool MetalBSupportsPaintSetup(
*
* @return Whether supports were drawn
*/
bool path_a_supports_paint_setup(
bool PathASupportsPaintSetup(
paint_session& session, int32_t supportType, int32_t special, int32_t height, ImageId imageTemplate,
const FootpathPaintInfo& pathPaintInfo, bool* underground)
{
@ -1323,7 +1323,7 @@ bool path_a_supports_paint_setup(
*
* @return Whether supports were drawn
*/
bool path_b_supports_paint_setup(
bool PathBSupportsPaintSetup(
paint_session& session, int32_t segment, int32_t special, int32_t height, ImageId imageTemplate,
const FootpathPaintInfo& pathPaintInfo)
{

View File

@ -25,10 +25,10 @@ bool MetalASupportsPaintSetup(
paint_session& session, uint8_t supportType, uint8_t segment, int32_t special, int32_t height, ImageId imageTemplate);
bool MetalBSupportsPaintSetup(
paint_session& session, uint8_t supportType, uint8_t segment, int32_t special, int32_t height, ImageId imageTemplate);
bool path_a_supports_paint_setup(
bool PathASupportsPaintSetup(
paint_session& session, int32_t supportType, int32_t special, int32_t height, ImageId imageTemplate,
const FootpathPaintInfo& pathPaintInfo, bool* underground);
bool path_b_supports_paint_setup(
bool PathBSupportsPaintSetup(
paint_session& session, int32_t supportType, int32_t special, int32_t height, ImageId imageTemplate,
const FootpathPaintInfo& pathPaintInfo);

View File

@ -41,26 +41,26 @@ enum VirtualFloorFlags
VIRTUAL_FLOOR_FORCE_INVALIDATION = (1 << 2),
};
bool virtual_floor_is_enabled()
bool VirtualFloorIsEnabled()
{
return (_virtualFloorFlags & VIRTUAL_FLOOR_FLAG_ENABLED) != 0;
}
void virtual_floor_set_height(int16_t height)
void VirtualFloorSetHeight(int16_t height)
{
if (!virtual_floor_is_enabled())
if (!VirtualFloorIsEnabled())
{
return;
}
if (_virtualFloorHeight != height)
{
virtual_floor_invalidate();
VirtualFloorInvalidate();
_virtualFloorHeight = height;
}
}
static void virtual_floor_reset()
static void VirtualFloorReset()
{
_virtualFloorLastMinPos.x = std::numeric_limits<int32_t>::max();
_virtualFloorLastMinPos.y = std::numeric_limits<int32_t>::max();
@ -69,20 +69,20 @@ static void virtual_floor_reset()
_virtualFloorHeight = 0;
}
void virtual_floor_enable()
void VirtualFloorEnable()
{
if (virtual_floor_is_enabled())
if (VirtualFloorIsEnabled())
{
return;
}
virtual_floor_reset();
VirtualFloorReset();
_virtualFloorFlags |= VIRTUAL_FLOOR_FLAG_ENABLED;
}
void virtual_floor_disable()
void VirtualFloorDisable()
{
if (!virtual_floor_is_enabled())
if (!VirtualFloorIsEnabled())
{
return;
}
@ -91,13 +91,13 @@ void virtual_floor_disable()
// Force invalidation, even if the position hasn't changed.
_virtualFloorFlags |= VIRTUAL_FLOOR_FORCE_INVALIDATION;
virtual_floor_invalidate();
VirtualFloorInvalidate();
_virtualFloorFlags &= ~VIRTUAL_FLOOR_FORCE_INVALIDATION;
virtual_floor_reset();
VirtualFloorReset();
}
void virtual_floor_invalidate()
void VirtualFloorInvalidate()
{
PROFILED_FUNCTION();
@ -174,9 +174,9 @@ void virtual_floor_invalidate()
}
}
bool virtual_floor_tile_is_floor(const CoordsXY& loc)
bool VirtualFloorTileIsFloor(const CoordsXY& loc)
{
if (!virtual_floor_is_enabled())
if (!VirtualFloorIsEnabled())
{
return false;
}
@ -206,7 +206,7 @@ bool virtual_floor_tile_is_floor(const CoordsXY& loc)
return false;
}
static void virtual_floor_get_tile_properties(
static void VirtualFloorGetTileProperties(
const CoordsXY& loc, int16_t height, bool* outOccupied, bool* tileOwned, uint8_t* outOccupiedEdges, bool* outBelowGround,
bool* aboveGround, bool* outLit)
{
@ -292,7 +292,7 @@ static void virtual_floor_get_tile_properties(
}
}
void virtual_floor_paint(paint_session& session)
void VirtualFloorPaint(paint_session& session)
{
PROFILED_FUNCTION();
@ -322,7 +322,7 @@ void virtual_floor_paint(paint_session& session)
bool weAreAboveGround;
uint8_t litEdges = 0;
virtual_floor_get_tile_properties(
VirtualFloorGetTileProperties(
session.MapPosition, virtualFloorClipHeight, &weAreOccupied, &weAreOwned, &occupiedEdges, &weAreBelowGround,
&weAreAboveGround, &weAreLit);
@ -345,7 +345,7 @@ void virtual_floor_paint(paint_session& session)
bool theyAreOwned;
bool theyAreAboveGround;
virtual_floor_get_tile_properties(
VirtualFloorGetTileProperties(
theirLocation, virtualFloorClipHeight, &theyAreOccupied, &theyAreOwned, &theirOccupiedEdges, &theyAreBelowGround,
&theyAreAboveGround, &theyAreLit);
@ -412,7 +412,7 @@ void virtual_floor_paint(paint_session& session)
}
}
uint16_t virtual_floor_get_height()
uint16_t VirtualFloorGetHeight()
{
return _virtualFloorHeight;
}

View File

@ -22,15 +22,15 @@ enum class VirtualFloorStyles : int32_t
struct paint_session;
uint16_t virtual_floor_get_height();
uint16_t VirtualFloorGetHeight();
bool virtual_floor_is_enabled();
void virtual_floor_set_height(int16_t height);
bool VirtualFloorIsEnabled();
void VirtualFloorSetHeight(int16_t height);
void virtual_floor_enable();
void virtual_floor_disable();
void virtual_floor_invalidate();
void VirtualFloorEnable();
void VirtualFloorDisable();
void VirtualFloorInvalidate();
bool virtual_floor_tile_is_floor(const CoordsXY& loc);
bool VirtualFloorTileIsFloor(const CoordsXY& loc);
void virtual_floor_paint(paint_session& session);
void VirtualFloorPaint(paint_session& session);

View File

@ -1134,7 +1134,7 @@ void PathPaintBoxSupport(
}
auto supportType = byte_98D8A4[edges] == 0 ? 0 : 1;
path_a_supports_paint_setup(session, supportType, ax, height, imageTemplate, pathPaintInfo, nullptr);
PathASupportsPaintSetup(session, supportType, ax, height, imageTemplate, pathPaintInfo, nullptr);
height += 32;
if (pathElement.IsSloped())
@ -1291,7 +1291,7 @@ void PathPaintPoleSupport(
{
imageTemplate = ImageId().WithPrimary(supportColour);
}
path_b_supports_paint_setup(session, supports[i], ax, height, imageTemplate, pathPaintInfo);
PathBSupportsPaintSetup(session, supports[i], ax, height, imageTemplate, pathPaintInfo);
}
}

View File

@ -145,7 +145,7 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off)
{
partOfVirtualFloor = virtual_floor_tile_is_floor(session.MapPosition);
partOfVirtualFloor = VirtualFloorTileIsFloor(session.MapPosition);
}
switch (rotation)
@ -204,7 +204,7 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo
if (partOfVirtualFloor)
{
// We must pretend this tile is at least as tall as the virtual floor
max_height = std::max(max_height, virtual_floor_get_height());
max_height = std::max(max_height, VirtualFloorGetHeight());
}
if (screenMinY - (max_height + 32) >= dpi->y + dpi->height)
@ -291,7 +291,7 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo
if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off && partOfVirtualFloor)
{
virtual_floor_paint(session);
VirtualFloorPaint(session);
}
if (!gShowSupportSegmentHeights)

View File

@ -763,7 +763,7 @@ void ride_select_next_section()
}
// Invalidate previous track piece (we may not be changing height!)
virtual_floor_invalidate();
VirtualFloorInvalidate();
CoordsXYE inputElement, outputElement;
inputElement.x = newCoords->x;
@ -777,7 +777,7 @@ void ride_select_next_section()
if (!scenery_tool_is_active())
{
// Set next element's height.
virtual_floor_set_height(tileElement->GetBaseZ());
VirtualFloorSetHeight(tileElement->GetBaseZ());
}
_currentTrackBegin = *newCoords;
@ -830,7 +830,7 @@ void ride_select_previous_section()
}
// Invalidate previous track piece (we may not be changing height!)
virtual_floor_invalidate();
VirtualFloorInvalidate();
track_begin_end trackBeginEnd;
if (track_block_get_previous({ *newCoords, tileElement }, &trackBeginEnd))
@ -844,7 +844,7 @@ void ride_select_previous_section()
if (!scenery_tool_is_active())
{
// Set previous element's height.
virtual_floor_set_height(trackBeginEnd.begin_element->GetBaseZ());
VirtualFloorSetHeight(trackBeginEnd.begin_element->GetBaseZ());
}
window_ride_construction_update_active_elements();
}

View File

@ -64,12 +64,12 @@ money32 place_provisional_track_piece(
viewport_set_visibility(2);
// Invalidate previous track piece (we may not be changing height!)
virtual_floor_invalidate();
VirtualFloorInvalidate();
if (!scenery_tool_is_active())
{
// Set new virtual floor height.
virtual_floor_set_height(trackPos.z);
VirtualFloorSetHeight(trackPos.z);
}
return result.Cost;
@ -106,12 +106,12 @@ money32 place_provisional_track_piece(
viewport_set_visibility(2);
// Invalidate previous track piece (we may not be changing height!)
virtual_floor_invalidate();
VirtualFloorInvalidate();
if (!scenery_tool_is_active())
{
// Set height to where the next track piece would begin
virtual_floor_set_height(trackPos.z - z_begin + z_end);
VirtualFloorSetHeight(trackPos.z - z_begin + z_end);
}
return res.Cost;

View File

@ -166,26 +166,26 @@ money32 FootpathProvisionalSet(
}
// Invalidate previous footpath piece.
virtual_floor_invalidate();
VirtualFloorInvalidate();
if (!scenery_tool_is_active())
{
if (res.Error != GameActions::Status::Ok)
{
// If we can't build this, don't show a virtual floor.
virtual_floor_set_height(0);
VirtualFloorSetHeight(0);
}
else if (
gFootpathConstructSlope == TILE_ELEMENT_SLOPE_FLAT
|| gProvisionalFootpath.Position.z < gFootpathConstructFromPosition.z)
{
// Going either straight on, or down.
virtual_floor_set_height(gProvisionalFootpath.Position.z);
VirtualFloorSetHeight(gProvisionalFootpath.Position.z);
}
else
{
// Going up in the world!
virtual_floor_set_height(gProvisionalFootpath.Position.z + LAND_HEIGHT_STEP);
VirtualFloorSetHeight(gProvisionalFootpath.Position.z + LAND_HEIGHT_STEP);
}
}