mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
fix: general crashes (#1336)
* Fix crashes fix crash with chat filter fix ldf_config being empty in database on windows debug * WorldServer: Fix further crashes on windows address multi threaded signal handling on worldservers Remove iterator invalidation code in zone manager
This commit is contained in:
parent
c0b969e3f0
commit
511672c5cb
@ -110,3 +110,7 @@ void User::UserOutOfSync() {
|
|||||||
Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
|
Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void User::UpdateBestFriendValue(const std::string_view playerName, const bool newValue) {
|
||||||
|
m_IsBestFriendMap[playerName.data()] = newValue;
|
||||||
|
}
|
||||||
|
@ -43,8 +43,8 @@ public:
|
|||||||
bool GetLastChatMessageApproved() { return m_LastChatMessageApproved; }
|
bool GetLastChatMessageApproved() { return m_LastChatMessageApproved; }
|
||||||
void SetLastChatMessageApproved(bool approved) { m_LastChatMessageApproved = approved; }
|
void SetLastChatMessageApproved(bool approved) { m_LastChatMessageApproved = approved; }
|
||||||
|
|
||||||
std::unordered_map<std::string, bool> GetIsBestFriendMap() { return m_IsBestFriendMap; }
|
const std::unordered_map<std::string, bool>& GetIsBestFriendMap() { return m_IsBestFriendMap; }
|
||||||
void SetIsBestFriendMap(std::unordered_map<std::string, bool> mapToSet) { m_IsBestFriendMap = mapToSet; }
|
void UpdateBestFriendValue(const std::string_view playerName, const bool newValue);
|
||||||
|
|
||||||
bool GetIsMuted() const;
|
bool GetIsMuted() const;
|
||||||
|
|
||||||
|
@ -5578,7 +5578,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
std::unique_ptr<sql::PreparedStatement> stmt(Database::Get()->CreatePreppedStmt("INSERT INTO ugc_modular_build (ugc_id, ldf_config, character_id) VALUES (?,?,?)"));
|
std::unique_ptr<sql::PreparedStatement> stmt(Database::Get()->CreatePreppedStmt("INSERT INTO ugc_modular_build (ugc_id, ldf_config, character_id) VALUES (?,?,?)"));
|
||||||
stmt->setUInt64(1, newIdBig);
|
stmt->setUInt64(1, newIdBig);
|
||||||
stmt->setString(2, GeneralUtils::UTF16ToWTF8(modules));
|
stmt->setString(2, GeneralUtils::UTF16ToWTF8(modules).c_str());
|
||||||
auto* pCharacter = character->GetCharacter();
|
auto* pCharacter = character->GetCharacter();
|
||||||
pCharacter ? stmt->setUInt(3, pCharacter->GetID()) : stmt->setNull(3, sql::DataType::BIGINT);
|
pCharacter ? stmt->setUInt(3, pCharacter->GetID()) : stmt->setNull(3, sql::DataType::BIGINT);
|
||||||
stmt->execute();
|
stmt->execute();
|
||||||
|
@ -359,8 +359,8 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa
|
|||||||
idOfReceiver = characterIdFetch->id;
|
idOfReceiver = characterIdFetch->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const auto& bffMap = user->GetIsBestFriendMap();
|
||||||
if (user->GetIsBestFriendMap().find(receiver) == user->GetIsBestFriendMap().end() && idOfReceiver != LWOOBJID_EMPTY) {
|
if (bffMap.find(receiver) == bffMap.end() && idOfReceiver != LWOOBJID_EMPTY) {
|
||||||
auto bffInfo = Database::Get()->GetBestFriendStatus(entity->GetObjectID(), idOfReceiver);
|
auto bffInfo = Database::Get()->GetBestFriendStatus(entity->GetObjectID(), idOfReceiver);
|
||||||
|
|
||||||
if (bffInfo) {
|
if (bffInfo) {
|
||||||
@ -368,11 +368,9 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isBestFriend) {
|
if (isBestFriend) {
|
||||||
auto tmpBestFriendMap = user->GetIsBestFriendMap();
|
user->UpdateBestFriendValue(receiver, true);
|
||||||
tmpBestFriendMap[receiver] = true;
|
|
||||||
user->SetIsBestFriendMap(tmpBestFriendMap);
|
|
||||||
}
|
}
|
||||||
} else if (user->GetIsBestFriendMap().find(receiver) != user->GetIsBestFriendMap().end()) {
|
} else if (bffMap.find(receiver) != bffMap.end()) {
|
||||||
isBestFriend = true;
|
isBestFriend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "PerformanceManager.h"
|
#include "PerformanceManager.h"
|
||||||
#include "Diagnostics.h"
|
#include "Diagnostics.h"
|
||||||
#include "BinaryPathFinder.h"
|
#include "BinaryPathFinder.h"
|
||||||
|
#include "dPlatforms.h"
|
||||||
|
|
||||||
//RakNet includes:
|
//RakNet includes:
|
||||||
#include "RakNetDefines.h"
|
#include "RakNetDefines.h"
|
||||||
@ -1284,12 +1285,14 @@ void WorldShutdownProcess(uint32_t zoneId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WorldShutdownSequence() {
|
void WorldShutdownSequence() {
|
||||||
if (Game::shouldShutdown || worldShutdownSequenceComplete) {
|
Game::shouldShutdown = true;
|
||||||
|
#ifndef DARKFLAME_PLATFORM_WIN32
|
||||||
|
if (Game::shouldShutdown || worldShutdownSequenceComplete)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::shouldShutdown = true;
|
|
||||||
|
|
||||||
LOG("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID);
|
LOG("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID);
|
||||||
WorldShutdownProcess(Game::server->GetZoneID());
|
WorldShutdownProcess(Game::server->GetZoneID());
|
||||||
FinalizeShutdown();
|
FinalizeShutdown();
|
||||||
@ -1302,11 +1305,17 @@ void FinalizeShutdown() {
|
|||||||
Metrics::Clear();
|
Metrics::Clear();
|
||||||
Database::Destroy("WorldServer");
|
Database::Destroy("WorldServer");
|
||||||
if (Game::chatFilter) delete Game::chatFilter;
|
if (Game::chatFilter) delete Game::chatFilter;
|
||||||
|
Game::chatFilter = nullptr;
|
||||||
if (Game::zoneManager) delete Game::zoneManager;
|
if (Game::zoneManager) delete Game::zoneManager;
|
||||||
|
Game::zoneManager = nullptr;
|
||||||
if (Game::server) delete Game::server;
|
if (Game::server) delete Game::server;
|
||||||
|
Game::server = nullptr;
|
||||||
if (Game::config) delete Game::config;
|
if (Game::config) delete Game::config;
|
||||||
|
Game::config = nullptr;
|
||||||
if (Game::entityManager) delete Game::entityManager;
|
if (Game::entityManager) delete Game::entityManager;
|
||||||
|
Game::entityManager = nullptr;
|
||||||
if (Game::logger) delete Game::logger;
|
if (Game::logger) delete Game::logger;
|
||||||
|
Game::logger = nullptr;
|
||||||
|
|
||||||
worldShutdownSequenceComplete = true;
|
worldShutdownSequenceComplete = true;
|
||||||
|
|
||||||
|
@ -79,8 +79,6 @@ dZoneManager::~dZoneManager() {
|
|||||||
delete p.second;
|
delete p.second;
|
||||||
p.second = nullptr;
|
p.second = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Spawners.erase(p.first);
|
|
||||||
}
|
}
|
||||||
if (m_WorldConfig) delete m_WorldConfig;
|
if (m_WorldConfig) delete m_WorldConfig;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user