diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-02-22 12:44:24 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-02-22 12:44:24 +0100 |
commit | 40b6736f69403b5fabee5ef39fa114aa9b301136 (patch) | |
tree | a9e5f3fb5b3422f8e0928ef6ba23e90d73aed6df /src/server/scripts/Commands | |
parent | 8214a14ef889d91c561861c8e6189782be493d86 (diff) |
Core/DataStores: Added iterator class for DBCStorage and DB2Storage
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r-- | src/server/scripts/Commands/cs_lookup.cpp | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 9119fdbe76d..9ad77c9c666 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -949,35 +949,31 @@ public: int32 locale = handler->GetSessionDbcLocale(); // Search in TaxiNodes.dbc - for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) + for (TaxiNodesEntry const* nodeEntry : sTaxiNodesStore) { - TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); - if (nodeEntry) - { - std::string name = nodeEntry->Name_lang->Str[locale]; - if (name.empty()) - continue; + std::string name = nodeEntry->Name_lang->Str[locale]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wNamePart)) - continue; + if (!Utf8FitTo(name, wNamePart)) + continue; - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), "", - nodeEntry->MapID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z); - else - handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), "", - nodeEntry->MapID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z); + // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, nodeEntry->ID, nodeEntry->ID, name.c_str(), "", + nodeEntry->MapID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z); + else + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, nodeEntry->ID, name.c_str(), "", + nodeEntry->MapID, nodeEntry->Pos.X, nodeEntry->Pos.Y, nodeEntry->Pos.Z); - if (!found) - found = true; - } + if (!found) + found = true; } if (!found) handler->SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND); |