1
0
Fork 0

Codefix: 'Declaration hides variable'

pull/13582/head
Rubidium 2025-02-15 16:03:27 +01:00 committed by rubidium42
parent 443d7ece29
commit 2d30df8110
3 changed files with 3 additions and 5 deletions

View File

@ -666,7 +666,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlags flags, bool wago
* Note: The vehicle attach callback is disabled here :) */
if (!flags.Test(DoCommandFlag::Execute)) {
/* Separate the head, so we can reattach the old vehicles */
Train *second = Train::From(old_head)->GetNextUnit();
second = Train::From(old_head)->GetNextUnit();
if (second != nullptr) CmdMoveVehicle(second, nullptr, {DoCommandFlag::Execute, DoCommandFlag::AutoReplace}, true);
assert(Train::From(old_head)->GetNextUnit() == nullptr);

View File

@ -259,8 +259,7 @@ std::optional<FileHandle> FioFOpenFile(const std::string &filename, const char *
/* Resolve ".." */
std::istringstream ss(resolved_name);
std::vector<std::string> tokens;
std::string token;
while (std::getline(ss, token, PATHSEPCHAR)) {
for (std::string token; std::getline(ss, token, PATHSEPCHAR); /* nothing */) {
if (token == "..") {
if (tokens.size() < 2) return std::nullopt;
tokens.pop_back();

View File

@ -1773,8 +1773,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
i->type = type;
auto &industries = Industry::industries[type];
auto it = std::ranges::lower_bound(industries, i->index);
it = industries.emplace(it, i->index);
industries.emplace(std::ranges::lower_bound(industries, i->index), i->index);
for (size_t index = 0; index < std::size(indspec->produced_cargo); ++index) {
if (!IsValidCargoType(indspec->produced_cargo[index])) break;