aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2015-10-04 14:53:05 +0200
committerShauren <shauren.trinity@gmail.com>2015-10-31 19:11:41 +0100
commitdf88c7f2789e5e07cc4ec9ea400dacfea518a102 (patch)
tree0bc410da791ff32811db87ce5352b31b62ebfdfb /src/server/scripts/Commands
parentf7e6f7a1054a1fbd44491dd347d46d7389d8b704 (diff)
Core/Misc: removed some useless map checks
(cherry picked from commit cf1e80e3d09067ca4d0078a8113a09227a9f91ae)
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp28
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 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;