use of SAFE_CHECK

This commit is contained in:
2023-08-15 19:33:09 +02:00
parent 7b8c13612c
commit 1f94ae2586
2 changed files with 56 additions and 48 deletions

View File

@@ -50,7 +50,9 @@ void WorldClient::HandlePacket(const protocol::SpawnMobPacket* packet) {
void WorldClient::HandlePacket(const protocol::UpgradeTowerPacket* packet) {
game::TowerPtr tower = GetTowerById(packet->GetTowerID());
if (tower == nullptr) return; // this should not happen but who knows ?
SAFE_CHECK(tower);
tower->Upgrade(packet->GetTowerLevel().GetLevel(), packet->GetTowerLevel().GetPath());
}
@@ -63,9 +65,9 @@ void WorldClient::HandlePacket(const protocol::WorldAddTowerPacket* packet) {
void WorldClient::HandlePacket(const protocol::RemoveTowerPacket* packet) {
game::TowerPtr tower = RemoveTower(packet->GetTowerID());
if (tower != nullptr) {
GetWorldNotifier().NotifyListeners(&WorldListener::OnTowerRemove, tower);
}
SAFE_CHECK(tower);
GetWorldNotifier().NotifyListeners(&WorldListener::OnTowerRemove, tower);
}
void WorldClient::HandlePacket(const protocol::UpdateMobStatesPacket* packet) {