fix vehicle copy on GetAllCars, TSetOfVehicleData is now vector<>

This commit is contained in:
Lion Kortlepel
2021-03-31 12:12:01 +02:00
parent 7231c69e10
commit 56a02f0215
5 changed files with 50 additions and 26 deletions

View File

@@ -339,15 +339,15 @@ int lua_GetCars(lua_State* L) {
auto MaybeClient = GetClient(Engine().Server(), ID);
if (MaybeClient && !MaybeClient.value().expired()) {
auto Client = MaybeClient.value().lock();
TClient::TSetOfVehicleData VehicleData;
TClient::TSetOfVehicleData* VehicleData;
{ // Vehicle Data Lock Scope
auto LockedData = Client->GetAllCars();
VehicleData = LockedData.VehicleData;
} // End Vehicle Data Lock Scope
if (VehicleData.empty())
if (VehicleData->empty())
return 0;
lua_newtable(L);
for (const auto& v : VehicleData) {
for (const auto& v : *VehicleData) {
lua_pushinteger(L, v.ID());
lua_pushstring(L, v.Data().substr(3).c_str());
lua_settable(L, -3);