mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +00:00
Merge pull request #1265 from DarkflameUniverse/ugc_patch
fix: Ugc Remove async and second id usage
This commit is contained in:
commit
4c10faa852
@ -2523,15 +2523,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
inStream->Read(sd0Size);
|
||||
std::shared_ptr<char[]> sd0Data(new char[sd0Size]);
|
||||
|
||||
if (sd0Data == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (sd0Data == nullptr) return;
|
||||
|
||||
for (uint32_t i = 0; i < sd0Size; ++i) {
|
||||
uint8_t c;
|
||||
inStream->Read(c);
|
||||
sd0Data[i] = c;
|
||||
}
|
||||
inStream->ReadAlignedBytes(reinterpret_cast<unsigned char*>(sd0Data.get()), sd0Size);
|
||||
|
||||
uint32_t timeTaken;
|
||||
inStream->Read(timeTaken);
|
||||
@ -2565,7 +2559,6 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
//We runs this in async because the http library here is blocking, meaning it'll halt the thread.
|
||||
//But we don't want the server to go unresponsive, because then the client would disconnect.
|
||||
auto returnVal = std::async(std::launch::async, [&]() {
|
||||
|
||||
//We need to get a new ID for our model first:
|
||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t newID) {
|
||||
@ -2573,8 +2566,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(newIDL, eObjectBits::PERSISTENT);
|
||||
|
||||
ObjectIDManager::Instance()->RequestPersistentID([=](uint32_t blueprintIDSmall) {
|
||||
blueprintIDSmall = ObjectIDManager::Instance()->GenerateRandomObjectID();
|
||||
uint32_t blueprintIDSmall = ObjectIDManager::Instance()->GenerateRandomObjectID();
|
||||
LWOOBJID blueprintID = blueprintIDSmall;
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
||||
@ -2595,8 +2587,6 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
int templateId = result.getIntField(0);
|
||||
|
||||
result.finalize();
|
||||
|
||||
auto* propertyLookup = Database::CreatePreppedStmt("SELECT * FROM properties WHERE template_id = ? AND clone_id = ?;");
|
||||
|
||||
propertyLookup->setInt(1, templateId);
|
||||
@ -2622,7 +2612,6 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
//whacky stream biz
|
||||
std::string s(sd0Data.get(), sd0Size);
|
||||
std::istringstream iss(s);
|
||||
std::istream& stream = iss;
|
||||
|
||||
ugcs->setBlob(5, &iss);
|
||||
ugcs->setBoolean(6, false);
|
||||
@ -2683,9 +2672,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
bitStream.Write<uint32_t>(sd0Size);
|
||||
|
||||
for (size_t i = 0; i < sd0Size; ++i) {
|
||||
bitStream.Write(sd0Data[i]);
|
||||
}
|
||||
bitStream.WriteAlignedBytes(reinterpret_cast<unsigned char*>(sd0Data.get()), sd0Size);
|
||||
|
||||
SEND_PACKET;
|
||||
|
||||
@ -2722,8 +2709,6 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void GameMessages::HandlePropertyEntranceSync(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||
|
Loading…
Reference in New Issue
Block a user