本文整理汇总了C++中WorldServer::Connected方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldServer::Connected方法的具体用法?C++ WorldServer::Connected怎么用?C++ WorldServer::Connected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer
的用法示例。
在下文中一共展示了WorldServer::Connected方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: WorldServerLoop
// this should always be called in a new thread
void WorldServerLoop(void *tmp)
{
WorldLoopRunning = true;
while(RunLoops)
{
if (worldserver.Connected())
{
if (!(worldserver.ReceiveData() && worldserver.SendPacketQueue()))
{
worldserver.Disconnect();
}
}
else if (worldserver.GetState() == WSCS_Ready)
{
if (worldserver.ReconnectTimer->Check())
{
worldserver.Connect();
}
}
Sleep(1);
}
WorldLoopRunning = false;
}
示例3: main
//.........这里部分代码省略.........
#ifdef CLIENT_LOGS
LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_buf);
LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_fmt);
LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_pva);
#endif
if (!worldserver.Connect()) {
_log(ZONE__INIT_ERR, "worldserver.Connect() FAILED!");
}
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
#ifdef EQPROFILE
#ifdef PROFILE_DUMP_TIME
Timer profile_dump_timer(PROFILE_DUMP_TIME*1000);
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()));
示例4: GuildCommand
//.........这里部分代码省略.........
Message(BLACK, "Error: invalid rank #.");
}
else
{
char* tmptar = 0;
if (sep->arg[3][0] != 0)
{
tmptar = sep->argplus[3];
}
else if (tmptar == 0 && target != 0 && target->IsClient())
{
tmptar = target->CastToClient()->GetName();
}
if (tmptar == 0)
{
Message(BLACK, "You must target someone or specify a character name.");
}
else
{
zgm.SendGuildDemotePacket(tmptar);
}
}
}
else if (strcasecmp(sep->arg[1], "motd") == 0)
{
if (guilddbid == 0)
{
Message(BLACK, "You arent in a guild!");
}
else if (!guilds[guildeqid].rank[guildrank].motd)
{
Message(BLACK, "You dont have permission to change the motd.");
}
else if (!worldserver.Connected())
{
Message(BLACK, "Error: World server dirconnected");
}
else
{
char tmp[255];
if (strcasecmp(sep->argplus[2], "none") == 0)
{
strcpy(tmp, "");
}
else
{
snprintf(tmp, sizeof(tmp), "%s - %s", this->GetName(), sep->argplus[2]);
}
if (Database::Instance()->SetGuildMOTD(guilddbid, tmp))
{
// Dark-Prince - 10/05/2008 - Code Consolidation
/*
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_RefreshGuild;
pack->size = 5;
pack->pBuffer = new uchar[pack->size];
memcpy(pack->pBuffer, &guildeqid, 4);
worldserver.SendPacket(pack);
safe_delete(pack);//delete pack;
*/
}
else
{
this->Message(BLACK, "Motd update failed.");
示例5: main
//.........这里部分代码省略.........
//database.LoadGuildAlliances();
#endif
// New Load function. keeping it commented till I figure out why its not working correctly in linux. Trump.
// NewLoadSPDat();
LogFile->write(EQEMuLog::Status, "Loading guilds");
database.LoadGuilds(guilds);
LogFile->write(EQEMuLog::Status, "Loading factions");
database.LoadFactionData();
LogFile->write(EQEMuLog::Status, "Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes);
LogFile->write(EQEMuLog::Status, "Loading what ever is left");
database.ExtraOptions();
AutoDelete<Parser> ADparse(&parse, new Parser);
#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) {