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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user