mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
revert copy-fix, it broke mutex locked contexts
This commit is contained in:
parent
56a02f0215
commit
d4d773b769
@ -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;
|
||||
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);
|
||||
|
@ -585,12 +585,12 @@ void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr, bool kicked
|
||||
TClient& c = *LockedClientPtr;
|
||||
info(c.GetName() + (" Connection Terminated"));
|
||||
std::string Packet;
|
||||
TClient::TSetOfVehicleData* VehicleData;
|
||||
TClient::TSetOfVehicleData VehicleData;
|
||||
{ // Vehicle Data Lock Scope
|
||||
auto LockedData = c.GetAllCars();
|
||||
VehicleData = LockedData.VehicleData;
|
||||
VehicleData = *LockedData.VehicleData;
|
||||
} // End Vehicle Data Lock Scope
|
||||
for (auto& v : *VehicleData) {
|
||||
for (auto& v : VehicleData) {
|
||||
Packet = "Od:" + std::to_string(c.GetID()) + "-" + std::to_string(v.ID());
|
||||
SendToAll(&c, Packet, false, true);
|
||||
}
|
||||
@ -841,13 +841,13 @@ bool TNetwork::SyncClient(const std::weak_ptr<TClient>& c) {
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
TClient::TSetOfVehicleData* VehicleData;
|
||||
TClient::TSetOfVehicleData VehicleData;
|
||||
{ // Vehicle Data Lock Scope
|
||||
auto LockedData = client->GetAllCars();
|
||||
VehicleData = LockedData.VehicleData;
|
||||
VehicleData = *LockedData.VehicleData;
|
||||
} // End Vehicle Data Lock Scope
|
||||
if (client != LockedClient) {
|
||||
for (auto& v : *VehicleData) {
|
||||
for (auto& v : VehicleData) {
|
||||
if (LockedClient->GetStatus() < 0) {
|
||||
Return = true;
|
||||
res = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user