if we where to replace the following code.
Code:
uint16 ZSList::GetAvailableZonePort()
{
const WorldConfig *Config=WorldConfig::get();
int i;
uint16 port=0;
if (LastAllocatedPort==0)
i=Config->ZonePortLow;
else
i=LastAllocatedPort+1;
while(i!=LastAllocatedPort && port==0) {
if (i>Config->ZonePortHigh)
i=Config->ZonePortLow;
if (!FindByPort(i)) {
port=i;
break;
}
i++;
}
LastAllocatedPort=port;
return port;
}
with something like.
Code:
uint16 ZSList::GetAvailableZonePort()
{
const WorldConfig *Config=WorldConfig::get();
int i;
uint16 port=0;
if (LastAllocatedPort==0)
i=Zone7000;
else if (LastAllocatedPort==7000)
i=Zone7001;
else if (LastAllocatedPort==7001)
i=Zone7002;
else if (LastAllocatedPort==7002)
i=Zone7003;
else if (LastAllocatedPort==7003)
i=7004;
else if (LastAllocatedPort==7004)
i=7005;
// this would just keep going till theres 400 zones
while(i!=LastAllocatedPort && port==0) {
if (i>Config->ZonePortHigh)
i=Config->ZonePortLow;
if (!FindByPort(i)) {
port=i;
break;
}
i++;
}
LastAllocatedPort=port;
return port;
}