From 40b6736f69403b5fabee5ef39fa114aa9b301136 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 22 Feb 2015 12:44:24 +0100 Subject: Core/DataStores: Added iterator class for DBCStorage and DB2Storage --- src/server/scripts/Commands/cs_lookup.cpp | 44 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'src/server/scripts/Commands') 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); -- cgit v1.2.3