remove player cast

This commit is contained in:
David Markowitz 2024-01-12 03:17:01 -08:00
parent f4a6086e4c
commit 87d5bd0229

View File

@ -453,15 +453,10 @@ void SGCannon::SpawnNewModel(Entity* self) {
void SGCannon::RemovePlayer(LWOOBJID playerID) { void SGCannon::RemovePlayer(LWOOBJID playerID) {
auto* player = Game::entityManager->GetEntity(playerID); auto* player = Game::entityManager->GetEntity(playerID);
if (player == nullptr) if (!player) return;
return;
auto* playerObject = dynamic_cast<Player*>(player); auto* character = player->GetCharacter();
if (playerObject == nullptr) auto* characterComponent = player->GetComponent<CharacterComponent>();
return;
auto* character = playerObject->GetCharacter();
auto* characterComponent = playerObject->GetComponent<CharacterComponent>();
if (characterComponent && character) { if (characterComponent && character) {
characterComponent->SendToZone(character->GetLastNonInstanceZoneID()); characterComponent->SendToZone(character->GetLastNonInstanceZoneID());
} }