Receive (Tile)CoordsXYZD by const ref instead of copy

This commit is contained in:
Tulio Leao 2020-02-29 00:03:16 -03:00
parent 4c2a0f279b
commit 473bb4683b
22 changed files with 24 additions and 24 deletions

View File

@ -25,7 +25,7 @@ private:
public:
BannerPlaceAction() = default;
BannerPlaceAction(CoordsXYZD loc, uint8_t bannerType, BannerIndex bannerIndex, uint8_t primaryColour)
BannerPlaceAction(const CoordsXYZD& loc, uint8_t bannerType, BannerIndex bannerIndex, uint8_t primaryColour)
: _loc(loc)
, _bannerType(bannerType)
, _bannerIndex(bannerIndex)

View File

@ -22,7 +22,7 @@ private:
public:
BannerRemoveAction() = default;
BannerRemoveAction(CoordsXYZD loc)
BannerRemoveAction(const CoordsXYZD& loc)
: _loc(loc)
{
}

View File

@ -24,7 +24,7 @@ private:
public:
BannerSetColourAction() = default;
BannerSetColourAction(CoordsXYZD loc, uint8_t primaryColour)
BannerSetColourAction(const CoordsXYZD& loc, uint8_t primaryColour)
: _loc(loc)
, _primaryColour(primaryColour)
{

View File

@ -25,7 +25,7 @@
*
* rct2: 0x00666F4E
*/
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc)
money32 park_entrance_place_ghost(const CoordsXYZD& entranceLoc)
{
park_entrance_remove_ghost();

View File

@ -56,7 +56,7 @@ private:
public:
LargeSceneryPlaceAction() = default;
LargeSceneryPlaceAction(CoordsXYZD loc, uint8_t sceneryType, uint8_t primaryColour, uint8_t secondaryColour)
LargeSceneryPlaceAction(const CoordsXYZD& loc, uint8_t sceneryType, uint8_t primaryColour, uint8_t secondaryColour)
: _loc(loc)
, _sceneryType(sceneryType)
, _primaryColour(primaryColour)

View File

@ -32,7 +32,7 @@ private:
public:
LargeSceneryRemoveAction() = default;
LargeSceneryRemoveAction(CoordsXYZD location, uint16_t tileIndex)
LargeSceneryRemoveAction(const CoordsXYZD& location, uint16_t tileIndex)
: _loc(location)
, _tileIndex(tileIndex)
{

View File

@ -25,7 +25,7 @@ private:
public:
LargeScenerySetColourAction() = default;
LargeScenerySetColourAction(CoordsXYZD loc, uint8_t tileIndex, uint8_t primaryColour, uint8_t secondaryColour)
LargeScenerySetColourAction(const CoordsXYZD& loc, uint8_t tileIndex, uint8_t primaryColour, uint8_t secondaryColour)
: _loc(loc)
, _tileIndex(tileIndex)
, _primaryColour(primaryColour)

View File

@ -58,7 +58,7 @@ public:
MazeSetTrackAction()
{
}
MazeSetTrackAction(CoordsXYZD location, bool initialPlacement, NetworkRideId_t rideIndex, uint8_t mode)
MazeSetTrackAction(const CoordsXYZD& location, bool initialPlacement, NetworkRideId_t rideIndex, uint8_t mode)
: _loc(location)
, _initialPlacement(initialPlacement)
, _rideIndex(rideIndex)

View File

@ -31,7 +31,7 @@ public:
PlaceParkEntranceAction()
{
}
PlaceParkEntranceAction(CoordsXYZD location)
PlaceParkEntranceAction(const CoordsXYZD& location)
: _loc(location)
{
}

View File

@ -28,7 +28,7 @@ public:
PlacePeepSpawnAction()
{
}
PlacePeepSpawnAction(CoordsXYZD location)
PlacePeepSpawnAction(const CoordsXYZD& location)
: _location(location)
{
}

View File

@ -30,7 +30,7 @@ private:
public:
RideSetColourSchemeAction() = default;
RideSetColourSchemeAction(CoordsXYZD location, int32_t trackType, uint16_t newColourScheme)
RideSetColourSchemeAction(const CoordsXYZD& location, int32_t trackType, uint16_t newColourScheme)
: _loc(location)
, _trackType(trackType)
, _newColourScheme(newColourScheme)

View File

@ -64,7 +64,7 @@ public:
SmallSceneryPlaceAction() = default;
SmallSceneryPlaceAction(
CoordsXYZD loc, uint8_t quadrant, uint8_t sceneryType, uint8_t primaryColour, uint8_t secondaryColour)
const CoordsXYZD& loc, uint8_t quadrant, uint8_t sceneryType, uint8_t primaryColour, uint8_t secondaryColour)
: _loc(loc)
, _quadrant(quadrant)
, _sceneryType(sceneryType)

View File

@ -44,7 +44,7 @@ private:
public:
TrackDesignAction() = default;
TrackDesignAction(CoordsXYZD location, const TrackDesign& td)
TrackDesignAction(const CoordsXYZD& location, const TrackDesign& td)
: _loc(location)
, _td(td)
{

View File

@ -59,7 +59,7 @@ public:
}
TrackPlaceAction(
NetworkRideId_t rideIndex, int32_t trackType, CoordsXYZD origin, int32_t brakeSpeed, int32_t colour,
NetworkRideId_t rideIndex, int32_t trackType, const CoordsXYZD& origin, int32_t brakeSpeed, int32_t colour,
int32_t seatRotation, int32_t liftHillAndAlternativeState)
: _rideIndex(rideIndex)
, _trackType(trackType)

View File

@ -31,7 +31,7 @@ public:
{
}
TrackRemoveAction(int32_t trackType, int32_t sequence, CoordsXYZD origin)
TrackRemoveAction(int32_t trackType, int32_t sequence, const CoordsXYZD& origin)
: _trackType(trackType)
, _sequence(sequence)
, _origin(origin)

View File

@ -35,7 +35,7 @@ public:
{
}
WallSetColourAction(CoordsXYZD loc, int32_t primaryColour, int32_t secondaryColour, int32_t tertiaryColour)
WallSetColourAction(const CoordsXYZD& loc, int32_t primaryColour, int32_t secondaryColour, int32_t tertiaryColour)
: _loc(loc)
, _primaryColour(primaryColour)
, _secondaryColour(secondaryColour)

View File

@ -3221,7 +3221,7 @@ void ride_check_all_reachable()
* rct2: 0x006B7C59
* @return true if the coordinate is reachable or has no entrance, false otherwise
*/
static bool ride_entrance_exit_is_reachable(TileCoordsXYZD coordinates)
static bool ride_entrance_exit_is_reachable(const TileCoordsXYZD& coordinates)
{
if (coordinates.isNull())
return true;

View File

@ -422,12 +422,12 @@ void ride_clear_exit_location(Ride* ride, const int32_t stationIndex)
ride->stations[stationIndex].Exit.setNull();
}
void ride_set_entrance_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD location)
void ride_set_entrance_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD& location)
{
ride->stations[stationIndex].Entrance = location;
}
void ride_set_exit_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD location)
void ride_set_exit_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD& location)
{
ride->stations[stationIndex].Exit = location;
}

View File

@ -23,5 +23,5 @@ TileCoordsXYZD ride_get_exit_location(const Ride* ride, const int32_t stationInd
void ride_clear_entrance_location(Ride* ride, const int32_t stationIndex);
void ride_clear_exit_location(Ride* ride, const int32_t stationIndex);
void ride_set_entrance_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD location);
void ride_set_exit_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD location);
void ride_set_entrance_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD& location);
void ride_set_exit_location(Ride* ride, const int32_t stationIndex, const TileCoordsXYZD& location);

View File

@ -42,7 +42,7 @@ extern CoordsXYZD gRideEntranceExitGhostPosition;
extern uint8_t gRideEntranceExitGhostStationIndex;
void park_entrance_remove_ghost();
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
money32 park_entrance_place_ghost(const CoordsXYZD& entranceLoc);
void reset_park_entrance();
void maze_entrance_hedge_replacement(const CoordsXYE& entrance);

View File

@ -1986,7 +1986,7 @@ static void footpath_remove_edges_towards(const CoordsXYRangedZ& footPathPos, in
// Returns true when there is an element at the given coordinates that want to connect to a path with the given direction (ride
// entrances and exits, shops, paths).
bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const TileElement* const elementToBeRemoved)
bool tile_element_wants_path_connection_towards(const TileCoordsXYZD& coords, const TileElement* const elementToBeRemoved)
{
TileElement* tileElement = map_get_first_element_at(coords.ToCoordsXY());
if (tileElement == nullptr)

View File

@ -211,7 +211,7 @@ void tile_element_iterator_restart_for_tile(tile_element_iterator* it);
void map_update_tiles();
int32_t map_get_highest_z(const CoordsXY& loc);
bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const TileElement* const elementToBeRemoved);
bool tile_element_wants_path_connection_towards(const TileCoordsXYZD& coords, const TileElement* const elementToBeRemoved);
void map_remove_out_of_range_elements();
void map_extend_boundary_surface();