Fix #13838: Formatted error message of sub-errors may be lost. (#13840)

This commit is contained in:
Peter Nelson
2025-03-18 08:39:40 +00:00
committed by GitHub
parent 5255aabe4d
commit 17f7d0950e
14 changed files with 70 additions and 69 deletions
+3 -3
View File
@@ -538,10 +538,10 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlags flags, bool wago
ReplaceChainItem &replacement = replacements.emplace_back(w, nullptr, 0);
CommandCost ret = BuildReplacementVehicle(replacement.old_veh, &replacement.new_veh, true, flags);
cost.AddCost(ret);
replacement.cost = ret.GetCost();
cost.AddCost(std::move(ret));
if (cost.Failed()) break;
replacement.cost = ret.GetCost();
if (replacement.new_veh != nullptr) *nothing_to_do = false;
}
Vehicle *new_head = replacements.front().GetVehicle();
@@ -602,7 +602,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlags flags, bool wago
break;
}
cost.AddCost(res);
cost.AddCost(std::move(res));
if (cost.Failed()) break;
} else {
/* We have reached 'last_engine', continue with the next engine towards the front */