mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use range-for instead of indexed loop. (#12191)
parent
59420d57ec
commit
e93d081a4a
|
@ -670,9 +670,7 @@ CommandCost CmdMassStartStopVehicle(DoCommandFlag flags, TileIndex tile, bool do
|
||||||
BuildDepotVehicleList(vli.vtype, tile, &list, nullptr);
|
BuildDepotVehicleList(vli.vtype, tile, &list, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < list.size(); i++) {
|
for (const Vehicle *v : list) {
|
||||||
const Vehicle *v = list[i];
|
|
||||||
|
|
||||||
if (!!(v->vehstatus & VS_STOPPED) != do_start) continue;
|
if (!!(v->vehstatus & VS_STOPPED) != do_start) continue;
|
||||||
|
|
||||||
if (!vehicle_list_window && !v->IsChainInDepot()) continue;
|
if (!vehicle_list_window && !v->IsChainInDepot()) continue;
|
||||||
|
@ -705,8 +703,8 @@ CommandCost CmdDepotSellAllVehicles(DoCommandFlag flags, TileIndex tile, Vehicle
|
||||||
|
|
||||||
CommandCost last_error = CMD_ERROR;
|
CommandCost last_error = CMD_ERROR;
|
||||||
bool had_success = false;
|
bool had_success = false;
|
||||||
for (uint i = 0; i < list.size(); i++) {
|
for (const Vehicle *v : list) {
|
||||||
CommandCost ret = Command<CMD_SELL_VEHICLE>::Do(flags, list[i]->index, true, false, INVALID_CLIENT_ID);
|
CommandCost ret = Command<CMD_SELL_VEHICLE>::Do(flags, v->index, true, false, INVALID_CLIENT_ID);
|
||||||
if (ret.Succeeded()) {
|
if (ret.Succeeded()) {
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
had_success = true;
|
had_success = true;
|
||||||
|
@ -736,9 +734,7 @@ CommandCost CmdDepotMassAutoReplace(DoCommandFlag flags, TileIndex tile, Vehicle
|
||||||
/* Get the list of vehicles in the depot */
|
/* Get the list of vehicles in the depot */
|
||||||
BuildDepotVehicleList(vehicle_type, tile, &list, &list, true);
|
BuildDepotVehicleList(vehicle_type, tile, &list, &list, true);
|
||||||
|
|
||||||
for (uint i = 0; i < list.size(); i++) {
|
for (const Vehicle *v : list) {
|
||||||
const Vehicle *v = list[i];
|
|
||||||
|
|
||||||
/* Ensure that the vehicle completely in the depot */
|
/* Ensure that the vehicle completely in the depot */
|
||||||
if (!v->IsChainInDepot()) continue;
|
if (!v->IsChainInDepot()) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue