diff options
| author | joschiwald <joschiwald.trinity@gmail.com> | 2015-10-04 14:53:05 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2015-10-04 14:53:05 +0200 |
| commit | cf1e80e3d09067ca4d0078a8113a09227a9f91ae (patch) | |
| tree | a953e93c050b91d72208f5c25e61372ef09d7e92 /src/server/scripts/Commands | |
| parent | 705e5ea5d9ff5344b89be5aa5e0b6504acff5502 (diff) | |
Core/Misc: removed some useless map checks
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_instance.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index 836d4caa22b..e722ec95945 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -170,22 +170,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; } @@ -227,15 +227,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); @@ -246,14 +246,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)); handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state); return true; } @@ -293,15 +293,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); @@ -310,14 +310,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; } - uint32 state = map->ToInstanceMap()->GetInstanceScript()->GetBossState(encounterId); + uint32 state = map->GetInstanceScript()->GetBossState(encounterId); handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state); return true; } |
