mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-06-28 15:50:02 +00:00
fix: get entity from manager vs from character
fixes a possible crash due to null entity
This commit is contained in:
parent
1f580491c7
commit
e76d70c9c4
@ -167,6 +167,7 @@ Entity::~Entity() {
|
|||||||
|
|
||||||
if (m_Character) {
|
if (m_Character) {
|
||||||
m_Character->SaveXMLToDatabase();
|
m_Character->SaveXMLToDatabase();
|
||||||
|
m_Character->SetEntity(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CancelAllTimers();
|
CancelAllTimers();
|
||||||
|
@ -526,7 +526,7 @@ void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID
|
|||||||
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneID, character->GetZoneClone(), false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneID, character->GetZoneClone(), false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
||||||
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
if (character) {
|
if (character) {
|
||||||
auto* entity = character->GetEntity();
|
auto* entity = Game::entityManager->GetEntity(character->GetObjectID());
|
||||||
if (entity) {
|
if (entity) {
|
||||||
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
auto* characterComponent = entity->GetComponent<CharacterComponent>();
|
||||||
if (characterComponent) {
|
if (characterComponent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user