本文整理汇总了C++中NetConnection::GetZonePort方法的典型用法代码示例。如果您正苦于以下问题:C++ NetConnection::GetZonePort方法的具体用法?C++ NetConnection::GetZonePort怎么用?C++ NetConnection::GetZonePort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetConnection
的用法示例。
在下文中一共展示了NetConnection::GetZonePort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateWindowTitle
void UpdateWindowTitle(char* iNewTitle) {
#ifdef WIN32
char tmp[500];
if (iNewTitle) {
snprintf(tmp, sizeof(tmp), "%i: %s", net.GetZonePort(), iNewTitle);
}
else {
if (zone) {
#if defined(GOTFRAGS) || defined(_DEBUG)
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients, %i", net.GetZonePort(), zone->GetShortName(), numclients, getpid());
#else
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients", net.GetZonePort(), zone->GetShortName(), numclients);
#endif
}
else {
#if defined(GOTFRAGS) || defined(_DEBUG)
snprintf(tmp, sizeof(tmp), "%i: sleeping, %i", net.GetZonePort(), getpid());
#else
snprintf(tmp, sizeof(tmp), "%i: sleeping", net.GetZonePort());
#endif
}
}
SetConsoleTitle(tmp);
#endif
}
示例2: SetConnectInfo
void WorldServer::SetConnectInfo()
{
ServerPacket* pack = new ServerPacket(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
sci->port = net.GetZonePort();
strcpy(sci->address, net.GetZoneAddress());
SendPacket(pack);
safe_delete(pack);//delete pack;
}
示例3: main
//.........这里部分代码省略.........
}
#ifdef CATCH_CRASH
}
catch(...){
error = 2;
}
#endif
}
}
DBAsyncWork* dbaw = 0;
while ((dbaw = MTdbafq->Pop())) {
DispatchFinishedDBAsync(dbaw);
}
if (InterserverTimer.Check()
#ifdef CATCH_CRASH
&& !error
#endif
) {
#ifdef CATCH_CRASH
try{
#endif
InterserverTimer.Start();
database.ping();
AsyncLoadVariables();
// NPC::GetAILevel(true);
entity_list.UpdateWho();
if (worldserver.TryReconnect() && (!worldserver.Connected()))
worldserver.AsyncConnect();
#ifdef CATCH_CRASH
}
catch(...)
{
error = 16;
RunLoops = false;
}
#endif
}
#ifdef CATCH_CRASH
if (error){
RunLoops = false;
}
#endif
#if defined(_DEBUG) && defined(DEBUG_PC)
QueryPerformanceCounter(&tmp3);
mainloop_time += tmp3.QuadPart - tmp2.QuadPart;
if (!--tmp0) {
tmp0 = 200;
printf("Elapsed Tics : %9.0f (%1.4f sec)\n", (double)mainloop_time, ((double)mainloop_time/tmp.QuadPart));
printf("NPCAI Tics : %9.0f (%1.2f%%)\n", (double)npcai_time, ((double)npcai_time/mainloop_time)*100);
printf("FindSpell Tics: %9.0f (%1.2f%%)\n", (double)findspell_time, ((double)findspell_time/mainloop_time)*100);
printf("AtkAllowd Tics: %9.0f (%1.2f%%)\n", (double)IsAttackAllowed_time, ((double)IsAttackAllowed_time/mainloop_time)*100);
printf("ClientPro Tics: %9.0f (%1.2f%%)\n", (double)clientprocess_time, ((double)clientprocess_time/mainloop_time)*100);
printf("ClientAtk Tics: %9.0f (%1.2f%%)\n", (double)clientattack_time, ((double)clientattack_time/mainloop_time)*100);
mainloop_time = 0;
npcai_time = 0;
findspell_time = 0;
IsAttackAllowed_time = 0;
clientprocess_time = 0;
clientattack_time = 0;
}
#endif
Sleep(1);
}
#ifdef CATCH_CRASH
if (error)
FilePrint("eqemudebug.log",true,true,"Zone %i crashed. Errorcode: %i/%i. Current zone loaded:%s. Current clients:%i. Caused by: %s",net.GetZonePort(), error,adverrornum, zone->GetShortName(), numclients,errorname);
try{
entity_list.Message(0, 15, "ZONEWIDE_MESSAGE: This zone caused a fatal error and will shut down now. Your character will be restored to the last saved status. We are sorry for any inconvenience!");
}
catch(...){}
if (error){
#ifdef WIN32
ExitProcess(error);
#else
entity_list.Clear();
safe_delete(zone);
#endif
}
#endif
entity_list.Clear();
if (zone != 0
#ifdef CATCH_CRASH
& !error
#endif
)
Zone::Shutdown(true);
//Fix for Linux world server problem.
eqns.Close();
worldserver.Disconnect();
dbasync->CommitWrites();
dbasync->StopThread();
#ifdef NEW_LoadSPDat
safe_delete(spells_delete);
#endif
CheckEQEMuErrorAndPause();
return 0;
}
示例4: Process
//.........这里部分代码省略.........
worldserver.SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
cout << "Zone shutdown by " << zst->adminname << endl;
Zone::Shutdown();
}
break;
}
case ServerOP_ZoneBootup:
{
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
if (ZoneLoaded)
{
SetZone(zone->GetShortName());
if (strcasecmp(Database::Instance()->GetZoneName(zst->zoneid), zone->GetShortName()) == 0)
{
// This packet also doubles as "incomming client" notification, lets not shut down before they get here
zone->StartShutdownTimer(AUTHENTICATION_TIMEOUT * 1000);
}
else
{
worldserver.SendEmoteMessage(zst->adminname, 0, 0, "Zone bootup failed: Already running '%s'", zone->GetShortName());
}
break;
}
if (zst->adminname[0] != 0)
{
cout << "Zone bootup by " << zst->adminname << endl;
}
if (!(Zone::Bootup(Database::Instance()->GetZoneName(zst->zoneid))))
{
worldserver.SendChannelMessage(0, 0, 10, 0, 0, "%s:%i Zone::Bootup failed: %s", net.GetZoneAddress(), net.GetZonePort(), Database::Instance()->GetZoneName(zst->zoneid));
}
break;
}
case ServerOP_ZonePlayer:
{
ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer;
Client* client = entity_list.GetClientByName(szp->name);
if (client != 0)
{
if (strcasecmp(szp->adminname, szp->name) == 0)
{
client->Message(BLACK, "Zoning to: %s", szp->zone);
}
else if (client->GetAnon() == 1 && client->Admin() > szp->adminrank)
{
break;
}
else
{
worldserver.SendEmoteMessage(szp->adminname, 0, 0, "Summoning %s to %s %1.1f, %1.1f, %1.1f", szp->name, szp->zone, szp->x_pos, szp->y_pos, szp->z_pos);
}
client->SetIsZoning(true);
client->SetUsingSoftCodedZoneLine(true);
client->SetZoningHeading(client->GetHeading());
client->SetZoningX(szp->x_pos);
client->SetZoningY(szp->y_pos);
client->SetZoningZ(szp->z_pos);
client->ZonePC(szp->zone, szp->x_pos, szp->y_pos, szp->z_pos);
}
break;
}
// Cofruben: used to send a packet directly to a client.