mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +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);
|
auto MaybeClient = GetClient(Engine().Server(), ID);
|
||||||
if (MaybeClient && !MaybeClient.value().expired()) {
|
if (MaybeClient && !MaybeClient.value().expired()) {
|
||||||
auto Client = MaybeClient.value().lock();
|
auto Client = MaybeClient.value().lock();
|
||||||
TClient::TSetOfVehicleData* VehicleData;
|
TClient::TSetOfVehicleData VehicleData;
|
||||||
{ // Vehicle Data Lock Scope
|
{ // Vehicle Data Lock Scope
|
||||||
auto LockedData = Client->GetAllCars();
|
auto LockedData = Client->GetAllCars();
|
||||||
VehicleData = LockedData.VehicleData;
|
VehicleData = *LockedData.VehicleData;
|
||||||
} // End Vehicle Data Lock Scope
|
} // End Vehicle Data Lock Scope
|
||||||
if (VehicleData->empty())
|
if (VehicleData.empty())
|
||||||
return 0;
|
return 0;
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (const auto& v : *VehicleData) {
|
for (const auto& v : VehicleData) {
|
||||||
lua_pushinteger(L, v.ID());
|
lua_pushinteger(L, v.ID());
|
||||||
lua_pushstring(L, v.Data().substr(3).c_str());
|
lua_pushstring(L, v.Data().substr(3).c_str());
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
@ -585,12 +585,12 @@ void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr, bool kicked
|
|||||||
TClient& c = *LockedClientPtr;
|
TClient& c = *LockedClientPtr;
|
||||||
info(c.GetName() + (" Connection Terminated"));
|
info(c.GetName() + (" Connection Terminated"));
|
||||||
std::string Packet;
|
std::string Packet;
|
||||||
TClient::TSetOfVehicleData* VehicleData;
|
TClient::TSetOfVehicleData VehicleData;
|
||||||
{ // Vehicle Data Lock Scope
|
{ // Vehicle Data Lock Scope
|
||||||
auto LockedData = c.GetAllCars();
|
auto LockedData = c.GetAllCars();
|
||||||
VehicleData = LockedData.VehicleData;
|
VehicleData = *LockedData.VehicleData;
|
||||||
} // End Vehicle Data Lock Scope
|
} // 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());
|
Packet = "Od:" + std::to_string(c.GetID()) + "-" + std::to_string(v.ID());
|
||||||
SendToAll(&c, Packet, false, true);
|
SendToAll(&c, Packet, false, true);
|
||||||
}
|
}
|
||||||
@ -841,13 +841,13 @@ bool TNetwork::SyncClient(const std::weak_ptr<TClient>& c) {
|
|||||||
} else
|
} else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TClient::TSetOfVehicleData* VehicleData;
|
TClient::TSetOfVehicleData VehicleData;
|
||||||
{ // Vehicle Data Lock Scope
|
{ // Vehicle Data Lock Scope
|
||||||
auto LockedData = client->GetAllCars();
|
auto LockedData = client->GetAllCars();
|
||||||
VehicleData = LockedData.VehicleData;
|
VehicleData = *LockedData.VehicleData;
|
||||||
} // End Vehicle Data Lock Scope
|
} // End Vehicle Data Lock Scope
|
||||||
if (client != LockedClient) {
|
if (client != LockedClient) {
|
||||||
for (auto& v : *VehicleData) {
|
for (auto& v : VehicleData) {
|
||||||
if (LockedClient->GetStatus() < 0) {
|
if (LockedClient->GetStatus() < 0) {
|
||||||
Return = true;
|
Return = true;
|
||||||
res = false;
|
res = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user