Core/Chat Commands: Allow to add overlapping teles .

Allow to add overlapping teles like "abc" even if "abcde" already exists. This wasn't possible and a "Teleport already exists" error was thrown instead.
This commit is contained in:
jackpoz
2013-10-25 21:50:52 +02:00
parent a14bbf773e
commit daf5a4b5c3
3 changed files with 21 additions and 1 deletions
+19
View File
@@ -7808,6 +7808,25 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
return alt;
}
GameTele const* ObjectMgr::GetGameTeleExactName(const std::string& name) const
{
// explicit name case
std::wstring wname;
if (!Utf8toWStr(name, wname))
return NULL;
// converting string that we try to find to lower case
wstrToLower(wname);
for (GameTeleContainer::const_iterator itr = _gameTeleStore.begin(); itr != _gameTeleStore.end(); ++itr)
{
if (itr->second.wnameLow == wname)
return &itr->second;
}
return NULL;
}
bool ObjectMgr::AddGameTele(GameTele& tele)
{
// find max id
+1
View File
@@ -1161,6 +1161,7 @@ class ObjectMgr
return &itr->second;
}
GameTele const* GetGameTele(std::string const& name) const;
GameTele const* GetGameTeleExactName(std::string const& name) const;
GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
bool AddGameTele(GameTele& data);
bool DeleteGameTele(std::string const& name);
+1 -1
View File
@@ -65,7 +65,7 @@ public:
std::string name = args;
if (sObjectMgr->GetGameTele(name))
if (sObjectMgr->GetGameTeleExactName(name))
{
handler->SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST);
handler->SetSentErrorMessage(true);