mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Remove shrink_to_fit for more lists.
A comment about "will actually do nothing" is out of date as that is not the case with std::vector. These lists are always short lived (either within a command handler or in a window) so don't shrink_to_fit.
This commit is contained in:
parent
33aedc43a5
commit
440a633fcc
|
@ -374,8 +374,6 @@ static void FiosGetFileList(SaveLoadOperation fop, bool show_dirs, FiosGetTypeAn
|
||||||
|
|
||||||
/* Show drives */
|
/* Show drives */
|
||||||
FiosGetDrives(file_list);
|
FiosGetDrives(file_list);
|
||||||
|
|
||||||
file_list.shrink_to_fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -108,11 +108,6 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||||
|
|
||||||
BuildDepotVehicleListData bdvld{engines, wagons, type, individual_wagons};
|
BuildDepotVehicleListData bdvld{engines, wagons, type, individual_wagons};
|
||||||
FindVehicleOnPos(tile, &bdvld, BuildDepotVehicleListProc);
|
FindVehicleOnPos(tile, &bdvld, BuildDepotVehicleListProc);
|
||||||
|
|
||||||
/* Ensure the lists are not wasting too much space. If the lists are fresh
|
|
||||||
* (i.e. built within a command) then this will actually do nothing. */
|
|
||||||
engines->shrink_to_fit();
|
|
||||||
if (wagons != nullptr && wagons != engines) wagons->shrink_to_fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,6 +171,5 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list->shrink_to_fit();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue