void Channel::HandleListRequest(WorldPacket& recvPacket) { ChannelPlayerList cpl; uint8 unk; uint32 size; uint64 guid; uint8 mode, flags; // mode: player flags; flags: channel flags std::string name; bool must_delay = false; recvPacket >> unk >> name >> flags >> size; for(uint32 i = 0; i < size; i++) { recvPacket >> guid >> mode; // all player names in this packet must be known before we can continue if(_worldSession->GetOrRequestPlayerName(guid).empty()) { must_delay = true; } cpl[guid] = mode; } if(must_delay) { _worldSession->_DelayWorldPacket(recvPacket, uint32(_worldSession->GetLagMS() * 1.2f)); return; } // store list of GUIDs in: @ChannelList - see below DefList *l = _worldSession->GetInstance()->GetScripts()->lists.Get("@ChannelList"); l->clear(); std::string pname; bool muted,mod; logcustom(0,WHITE,"Player channel list, %u players:",size); for(ChannelPlayerList::iterator i = cpl.begin(); i != cpl.end(); i++) { pname = _worldSession->GetOrRequestPlayerName(i->first); // all names should be known now mode = i->second; if(pname.empty()) pname = "<unknown>"; muted = mode & MEMBER_FLAG_MUTED; mod = mode & MEMBER_FLAG_MODERATOR; while(pname.length() < MAX_PLAYERNAME_LENGTH) pname += " "; // for better formatting logcustom(0,WHITE,"%s ["I64FMT"] %s %s",pname.c_str(),i->first,muted?"(muted)":"",mod?"(moderator)":""); // DefScript binding l->push_back(DefScriptTools::toString(guid)); } }
int main(int argc, char* argv[]) { try { std::set_new_handler(_new_handler); log_prepare("logfile.txt","a"); logcustom(0,LGREEN,"+----------------------------------+"); logcustom(0,LGREEN,"| (C) 2006-2009 Snowstorm Software |"); logcustom(0,LGREEN,"| http://www.mangosclient.org |"); logcustom(0,LGREEN,"+----------------------------------+"); logcustom(0,GREEN,"Platform: %s",PLATFORM_NAME); logcustom(0,GREEN,"Compiler: %s ("COMPILER_VERSION_OUT")",COMPILER_NAME,COMPILER_VERSION); logcustom(0,GREEN,"Compiled: %s %s",__DATE__,__TIME__); _HookSignals(); MemoryDataHolder::Init(); // 1 instance is enough for now PseuInstanceRunnable *r=new PseuInstanceRunnable(); ZThread::Thread t(r); instanceList.push_back(r); t.setPriority((ZThread::Priority)2); //... t.wait(); //... log_close(); _UnhookSignals(); raise(SIGABRT); // this way to terminate is not nice but the only way to quit the CLI thread raise(SIGQUIT); return 0; } catch (...) { printf("ERROR: Unhandled exception in main thread!\n"); raise(SIGABRT); return 1; } }
void Engine::PrintSystemSpecs(void) { logcustom(0, LGREEN, "System/Engine specs:"); logcustom(0, LGREEN, "----------------------------------"); logcustom(0, LGREEN, "Platform: %s", PLATFORM_NAME); logcustom(0, LGREEN, "Compiler: %s (" COMPILER_VERSION_OUT ")", COMPILER_NAME, COMPILER_VERSION); logcustom(0, LGREEN, "Endian: %s", IS_LITTLE_ENDIAN ? "little" : "big"); logcustom(0, LGREEN, "Bits: %u", SYSTEM_BITS); logcustom(0, LGREEN, "----------------------------------"); #ifdef _DEBUG logcustom(0, LGREEN, "uint8 size: %u%s", sizeof(uint8), sizeof(uint8) == 1 ? "" : " [WRONG, should be 1]"); logcustom(0, LGREEN, "uint16 size: %u%s", sizeof(uint16), sizeof(uint16) == 2 ? "" : " [WRONG, should be 2]"); logcustom(0, LGREEN, "uint32 size: %u%s", sizeof(uint32), sizeof(uint32) == 4 ? "" : " [WRONG, should be 4]"); logcustom(0, LGREEN, "uint64 size: %u%s", sizeof(uint64), sizeof(uint64) == 8 ? "" : " [WRONG, should be 8]"); logcustom(0, LGREEN, "int size: %u", sizeof(int)); // int size is officially compiler/OS dependant, its here just for reference logcustom(0, LGREEN, "float size: %u%s", sizeof(float), sizeof(float) == 4 ? "" : " [WRONG, should be 4]"); logcustom(0, LGREEN, "double size: %u%s", sizeof(double), sizeof(double) == 8 ? "" : " [WRONG, should be 8]"); logcustom(0, LGREEN, "----------------------------------"); logcustom(0, LGREEN, "Falcon::uint8 size: %u%s", sizeof(Falcon::uint8), sizeof(Falcon::uint8) == 1 ? "" : " [WRONG, should be 1]"); logcustom(0, LGREEN, "Falcon::uint16 size: %u%s", sizeof(Falcon::uint16), sizeof(Falcon::uint16) == 2 ? "" : " [WRONG, should be 2]"); logcustom(0, LGREEN, "Falcon::uint32 size: %u%s", sizeof(Falcon::uint32), sizeof(Falcon::uint32) == 4 ? "" : " [WRONG, should be 4]"); logcustom(0, LGREEN, "Falcon::uint64 size: %u%s", sizeof(Falcon::uint64), sizeof(Falcon::uint64) == 8 ? "" : " [WRONG, should be 8]"); logcustom(0, LGREEN, "Falcon::numeric size: %u%s", sizeof(Falcon::numeric), sizeof(Falcon::numeric) == 8 ? "" : " [WRONG, should be 4]"); logcustom(0, LGREEN, "----------------------------------"); #endif }