Fix function locals shadowing parameters

pull/491/head
Jonathan G Rennison 1 year ago
parent 796924ec32
commit 3e7a625e0e

@ -98,15 +98,15 @@ bool TryReserveRailTrackdir(const Train *v, TileIndex tile, Trackdir td, bool tr
/**
* Try to reserve a specific track on a tile
* @param tile the tile
* @param t the track
* @param track the track
* @param trigger_stations whether to call station randomisation trigger
* @return \c true if reservation was successful, i.e. the track was
* free and didn't cross any other reserved tracks.
*/
bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
bool TryReserveRailTrack(TileIndex tile, Track track, bool trigger_stations)
{
assert_msg_tile((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(t)) != 0, tile,
"%X, %X, %X", TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)), t, TrackToTrackBits(t));
assert_msg_tile((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(track)) != 0, tile,
"%X, %X, %X", TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)), track, TrackToTrackBits(track));
if (_settings_client.gui.show_track_reservation) {
/* show the reserved rail if needed */
@ -119,7 +119,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
switch (GetTileType(tile)) {
case MP_RAILWAY:
if (IsPlainRail(tile)) return TryReserveTrack(tile, t);
if (IsPlainRail(tile)) return TryReserveTrack(tile, track);
if (IsRailDepot(tile)) {
if (!HasDepotReservation(tile)) {
SetDepotReservation(tile, true);
@ -166,7 +166,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
return true;
}
if (IsBridge(tile)) {
if (TryReserveRailBridgeHead(tile, t)) {
if (TryReserveRailBridgeHead(tile, track)) {
MarkBridgeOrTunnelDirtyOnReservationChange(tile, VMDF_NOT_MAP_MODE);
return true;
}

@ -1555,9 +1555,9 @@ static void DrawInstructionString(const TraceRestrictProgram *prog, TraceRestric
case TRPPAF_PRESET: {
instruction_string = STR_TRACE_RESTRICT_PF_PENALTY_ITEM_PRESET;
uint16 index = GetTraceRestrictValue(item);
assert(index < TRPPPI_END);
SetDParam(0, _pf_penalty_dropdown_str[index]);
uint16 idx = GetTraceRestrictValue(item);
assert(idx < TRPPPI_END);
SetDParam(0, _pf_penalty_dropdown_str[idx]);
break;
}

@ -537,7 +537,7 @@ void GenerateTrees()
/**
* Plant a tree.
* @param tile end tile of area-drag
* @param end_tile end tile of area-drag
* @param flags type of operation
* @param p1 various bitstuffed data.
* - p1 = (bit 0 - 7) - tree type, TREE_INVALID means random.
@ -546,7 +546,7 @@ void GenerateTrees()
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdPlantTree(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
StringID msg = INVALID_STRING_ID;
CommandCost cost(EXPENSES_OTHER);
@ -559,7 +559,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
Company *c = (_game_mode != GM_EDITOR) ? Company::GetIfValid(_current_company) : nullptr;
int limit = (c == nullptr ? INT32_MAX : GB(c->tree_limit, 16, 16));
OrthogonalOrDiagonalTileIterator iter(tile, p2, HasBit(p1, 8));
OrthogonalOrDiagonalTileIterator iter(end_tile, p2, HasBit(p1, 8));
for (; *iter != INVALID_TILE; ++iter) {
TileIndex tile = *iter;
switch (GetTileType(tile)) {

@ -548,11 +548,11 @@ struct ViewportRedrawRegion {
static std::vector<ViewportRedrawRegion> _vp_redraw_regions;
static void DoViewportRedrawRegions(const Window *w, int left, int top, int width, int height)
static void DoViewportRedrawRegions(const Window *w_start, int left, int top, int width, int height)
{
if (width <= 0 || height <= 0) return;
for (const Window *w : Window::IterateFromBack<const Window>(w)) {
for (const Window *w : Window::IterateFromBack<const Window>(w_start)) {
if (left + width > w->left &&
w->left + w->width > left &&
top + height > w->top &&
@ -645,7 +645,7 @@ static void DoSetViewportPositionFillRegion(int left, int top, int width, int he
DrawOverlappedWindowForAll(left, top, left + width, top + height);
};
static void DoSetViewportPosition(Window *w, const int left, const int top, const int width, const int height)
static void DoSetViewportPosition(Window *w, const int vp_left, const int vp_top, const int vp_width, const int vp_height)
{
const int xo = _vp_move_offs.x;
const int yo = _vp_move_offs.y;
@ -654,9 +654,9 @@ static void DoSetViewportPosition(Window *w, const int left, const int top, cons
IncrementWindowUpdateNumber();
_vp_redraw_regions.clear();
DoViewportRedrawRegions(w, left, top, width, height);
DoViewportRedrawRegions(w, vp_left, vp_top, vp_width, vp_height);
if (abs(xo) >= width || abs(yo) >= height) {
if (abs(xo) >= vp_width || abs(yo) >= vp_height) {
/* fully outside */
for (ViewportRedrawRegion &vrr : _vp_redraw_regions) {
RedrawScreenRect(vrr.coords.left, vrr.coords.top, vrr.coords.right, vrr.coords.bottom);

Loading…
Cancel
Save