Range-based for for world/zonelist.cpp

This commit is contained in:
Michael Cook (mackal) 2015-01-08 22:01:37 -05:00
parent 4fde4bba72
commit 4808dcadcf

View File

@ -246,16 +246,16 @@ ZoneServer* ZSList::FindByInstanceID(uint32 InstanceID)
} }
bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) { bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) {
for (int i=0; i<MaxLockedZones; i++) { for (auto &zone : pLockedZones) {
if (iLock) { if (iLock) {
if (pLockedZones[i] == 0) { if (zone == 0) {
pLockedZones[i] = iZoneID; zone = iZoneID;
return true; return true;
} }
} }
else { else {
if (pLockedZones[i] == iZoneID) { if (zone == iZoneID) {
pLockedZones[i] = 0; zone = 0;
return true; return true;
} }
} }
@ -264,8 +264,8 @@ bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) {
} }
bool ZSList::IsZoneLocked(uint16 iZoneID) { bool ZSList::IsZoneLocked(uint16 iZoneID) {
for (int i=0; i<MaxLockedZones; i++) { for (auto &zone : pLockedZones) {
if (pLockedZones[i] == iZoneID) if (zone == iZoneID)
return true; return true;
} }
return false; return false;
@ -273,9 +273,9 @@ bool ZSList::IsZoneLocked(uint16 iZoneID) {
void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) { void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
int x = 0; int x = 0;
for (int i=0; i<MaxLockedZones; i++) { for (auto &zone : pLockedZones) {
if (pLockedZones[i]) { if (zone) {
connection->SendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(pLockedZones[i], true)); connection->SendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(zone, true));
x++; x++;
} }
} }