From df88c7f2789e5e07cc4ec9ea400dacfea518a102 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 4 Oct 2015 14:53:05 +0200 Subject: Core/Misc: removed some useless map checks (cherry picked from commit cf1e80e3d09067ca4d0078a8113a09227a9f91ae) --- src/server/scripts/Commands/cs_instance.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index e51b7bcc594..5651aaa12ee 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -168,22 +168,22 @@ public: static bool HandleInstanceSaveDataCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!((InstanceMap*)map)->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); return false; } - ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); + map->GetInstanceScript()->SaveToDB(); return true; } @@ -225,15 +225,15 @@ public: return false; } - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!map->ToInstanceMap()->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); @@ -244,14 +244,14 @@ public: state = atoi(param2); // Reject improper values. - if (state > TO_BE_DECIDED || encounterId > map->ToInstanceMap()->GetInstanceScript()->GetEncounterCount()) + if (state > TO_BE_DECIDED || encounterId > map->GetInstanceScript()->GetEncounterCount()) { handler->PSendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } - map->ToInstanceMap()->GetInstanceScript()->SetBossState(encounterId, (EncounterState)state); + map->GetInstanceScript()->SetBossState(encounterId, EncounterState(state)); std::string stateName = InstanceScript::GetBossStateName(state); handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state, stateName); return true; @@ -292,15 +292,15 @@ public: return false; } - Map* map = player->GetMap(); - if (!map->IsDungeon()) + InstanceMap* map = player->GetMap()->ToInstanceMap(); + if (!map) { handler->PSendSysMessage(LANG_NOT_DUNGEON); handler->SetSentErrorMessage(true); return false; } - if (!map->ToInstanceMap()->GetInstanceScript()) + if (!map->GetInstanceScript()) { handler->PSendSysMessage(LANG_NO_INSTANCE_DATA); handler->SetSentErrorMessage(true); @@ -309,14 +309,14 @@ public: encounterId = atoi(param1); - if (encounterId > map->ToInstanceMap()->GetInstanceScript()->GetEncounterCount()) + if (encounterId > map->GetInstanceScript()->GetEncounterCount()) { handler->PSendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } - uint8 state = map->ToInstanceMap()->GetInstanceScript()->GetBossState(encounterId); + uint32 state = map->GetInstanceScript()->GetBossState(encounterId); std::string stateName = InstanceScript::GetBossStateName(state); handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state, stateName); return true; -- cgit v1.2.3