本文整理汇总了C++中ZoneServer::GetPort方法的典型用法代码示例。如果您正苦于以下问题:C++ ZoneServer::GetPort方法的具体用法?C++ ZoneServer::GetPort怎么用?C++ ZoneServer::GetPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZoneServer
的用法示例。
在下文中一共展示了ZoneServer::GetPort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendZoneStatus
void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection) {
LinkedListIterator<ZoneServer*> iterator(list);
struct in_addr in;
iterator.Reset();
char locked[4];
if (WorldConfig::get()->Locked == true)
strcpy(locked, "Yes");
else
strcpy(locked, "No");
char* output = 0;
uint32 outsize = 0, outlen = 0;
if (connection->IsConsole())
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s\r\n", locked);
else
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s^", locked);
if (connection->IsConsole())
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:\r\n");
else
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:^");
// connection->SendEmoteMessage(to, 0, 0, 0, "World Locked: %s", locked);
// connection->SendEmoteMessage(to, 0, 0, 0, "Zoneservers online:");
int v=0, w=0, x=0, y=0, z=0;
char tmpStatic[2] = { 0, 0 }, tmpZone[64];
memset(tmpZone, 0, sizeof(tmpZone));
ZoneServer* zs = 0;
while(iterator.MoreElements()) {
zs = iterator.GetData();
in.s_addr = zs->GetIP();
if(zs->IsStaticZone())
z++;
else if (zs->GetZoneID() != 0)
w++;
else if(zs->GetZoneID() == 0 && !zs->IsBootingUp())
v++;
if (zs->IsStaticZone())
tmpStatic[0] = 'S';
else
tmpStatic[0] = ' ';
if (admin >= 150) {
if (zs->GetZoneID())
snprintf(tmpZone, sizeof(tmpZone), "%s (%i)", zs->GetZoneName(), zs->GetZoneID());
else if (zs->IsBootingUp())
strcpy(tmpZone, "...");
else
tmpZone[0] = 0;
AppendAnyLenString(&output, &outsize, &outlen, " #%-3i %s %15s:%-5i %2i %s:%i %s", zs->GetID(), tmpStatic, inet_ntoa(in), zs->GetPort(), zs->NumPlayers(), zs->GetCAddress(), zs->GetCPort(), tmpZone);
if (outlen >= 3584) {
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
safe_delete(output);
outsize = 0;
outlen = 0;
}
else {
if (connection->IsConsole())
AppendAnyLenString(&output, &outsize, &outlen, "\r\n");
else
AppendAnyLenString(&output, &outsize, &outlen, "^");
}
x++;
}
else if (zs->GetZoneID() != 0) {
if (zs->GetZoneID())
strcpy(tmpZone, zs->GetZoneName());
else
tmpZone[0] = 0;
AppendAnyLenString(&output, &outsize, &outlen, " #%i %s %s", zs->GetID(), tmpStatic, tmpZone);
if (outlen >= 3584) {
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
safe_delete(output);
outsize = 0;
outlen = 0;
}
else {
if (connection->IsConsole())
AppendAnyLenString(&output, &outsize, &outlen, "\r\n");
else
AppendAnyLenString(&output, &outsize, &outlen, "^");
}
x++;
}
y++;
iterator.Advance();
}
if (connection->IsConsole())
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.\r\n", x, y);
else
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.^", x, y);
AppendAnyLenString(&output, &outsize, &outlen, "%i zones are static zones, %i zones are booted zones, %i zones available.",z,w,v);
// connection->SendEmoteMessage(to, 0, 0, "%i servers listed. %i servers online.", x, y);
// connection->SendEmoteMessage(to,0,0,"%i zones are static zones, %i zones are booted zones, %i zones available.",z,w,v);
if (output)
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
safe_delete(output);
}