本文整理汇总了C++中WorldServer::Process方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldServer::Process方法的具体用法?C++ WorldServer::Process怎么用?C++ WorldServer::Process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer
的用法示例。
在下文中一共展示了WorldServer::Process方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessLoop
void ProcessLoop(void *tmp) {
#else
void *ProcessLoop(void *tmp) {
#endif
srand(time(NULL));
bool worldwasconnected = worldserver.Connected();
ProcessLoopRunning = true;
while(RunLoops) {
if (worldserver.Connected()) {
worldserver.Process();
worldwasconnected = true;
}
else {
if (worldwasconnected && ZoneLoaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (ZoneLoaded) {
if (numclients > 0) // Don't run entity_list Process() unless there are clients inside.
entity_list.Process();
else
entity_list.BoatProcessOnly(); // Tazadar : We move boats even if the zone is empty !
if (!zone->Process()) {
Zone::Shutdown();
}
}
Sleep(1);
}
ProcessLoopRunning = false;
#ifndef WIN32
return 0;
#endif
}
示例2: main
//.........这里部分代码省略.........
profile_dump_timer.Start();
#endif
#endif
if (!strlen(zone_name) || !strcmp(zone_name,".")) {
_log(ZONE__INIT, "Entering sleep mode");
} else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance
_log(ZONE__INIT_ERR, "Zone bootup FAILED!");
zone = 0;
}
//register all the patches we have avaliable with the stream identifier.
EQStreamIdentifier stream_identifier;
RegisterAllPatches(stream_identifier);
#ifndef WIN32
_log(COMMON__THREADS, "Main thread running with thread id %d", pthread_self());
#endif
Timer quest_timers(100);
UpdateWindowTitle();
bool worldwasconnected = worldserver.Connected();
EQStream* eqss;
EQStreamInterface *eqsi;
Timer temp_timer(10);
temp_timer.Start();
while(RunLoops) {
{ //profiler block to omit the sleep from times
_ZP(net_main);
//Advance the timer to our current point in time
Timer::SetCurrentTime();
//process stuff from world
worldserver.Process();
if (!eqsf.IsOpen() && Config->ZonePort!=0) {
_log(ZONE__INIT, "Starting EQ Network server on port %d",Config->ZonePort);
if (!eqsf.Open(Config->ZonePort)) {
_log(ZONE__INIT_ERR, "Failed to open port %d",Config->ZonePort);
ZoneConfig::SetZonePort(0);
worldserver.Disconnect();
worldwasconnected = false;
}
}
//check the factory for any new incoming streams.
while ((eqss = eqsf.Pop())) {
//pull the stream out of the factory and give it to the stream identifier
//which will figure out what patch they are running, and set up the dynamic
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqss->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
stream_identifier.AddStream(eqss); //takes the stream
}
//give the stream identifier a chance to do its work....
stream_identifier.Process();
//check the stream identifier for any now-identified streams
while((eqsi = stream_identifier.PopIdentified())) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
_log(WORLD__CLIENT, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
示例3: main
//.........这里部分代码省略.........
#ifdef ADDONCMD
LogFile->write(EQEMuLog::Status, "Looding addon commands from dll");
if ( !addonCmd.openLib() ) {
LogFile->write(EQEMuLog::Error, "Loading addons failed =(");
}
#endif
if (!worldserver.Connect()) {
LogFile->write(EQEMuLog::Error, "worldserver.Connect() FAILED!");
}
if (strcmp(zone_name, ".") == 0 || strcasecmp(zone_name, "sleep") == 0) {
LogFile->write(EQEMuLog::Status, "Entering sleep mode");
} else if (!Zone::Bootup(database.GetZoneID(zone_name), true)) {
LogFile->write(EQEMuLog::Error, "Zone bootup FAILED!");
zone = 0;
}
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
UpdateWindowTitle();
bool worldwasconnected = worldserver.Connected();
EQNetworkConnection* eqnc;
while(RunLoops) {
Timer::SetCurrentTime();
while ((eqnc = eqns.NewQueuePop())) {
struct in_addr in;
in.s_addr = eqnc->GetrIP();
LogFile->write(EQEMuLog::Status, "%i New client from ip:%s port:%i", Timer::GetCurrentTime(), inet_ntoa(in), ntohs(eqnc->GetrPort()));
Client* client = new Client(eqnc);
entity_list.AddClient(client);
}
#ifdef CATCH_CRASH
try{
#endif
worldserver.Process();
#ifdef CATCH_CRASH
}
catch(...){
error = 1;
adverrornum = worldserver.GetErrorNumber();
worldserver.Disconnect();
worldwasconnected = false;
}
#endif
if (worldserver.Connected()) {
worldwasconnected = true;
}
else {
if (worldwasconnected && ZoneLoaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (ZoneLoaded) {
{
#ifdef CATCH_CRASH
try{
#endif
entity_list.Process();
#ifdef CATCH_CRASH
}
catch(...){
error = 4;
}
try{
#endif
zoneprocess= zone->Process();
if (!zoneprocess) {