本文整理汇总了C++中ConsoleList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ ConsoleList::Add方法的具体用法?C++ ConsoleList::Add怎么用?C++ ConsoleList::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleList
的用法示例。
在下文中一共展示了ConsoleList::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
RegisterExecutablePlatform(ExePlatformWorld);
set_exception_handler();
// Load server configuration
_log(WORLD__INIT, "Loading server configuration..");
if (!WorldConfig::LoadConfig()) {
_log(WORLD__INIT_ERR, "Loading server configuration failed.");
return(1);
}
const WorldConfig *Config=WorldConfig::get();
if(!load_log_settings(Config->LogSettingsFile.c_str()))
_log(WORLD__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
else
_log(WORLD__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
_log(WORLD__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION);
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
return 0;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
return 0;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
return 0;
}
#endif
// add login server config to list
if (Config->LoginCount == 0) {
if (Config->LoginHost.length()) {
loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
}
} else {
LinkedList<LoginConfig*> loginlist=Config->loginlist;
LinkedListIterator<LoginConfig*> iterator(loginlist);
iterator.Reset();
while(iterator.MoreElements()) {
loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
iterator.Advance();
}
}
_log(WORLD__INIT, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
return(1);
}
dbasync = new DBAsync(&database);
guild_mgr.SetDatabase(&database);
if (argc >= 2) {
char tmp[2];
if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "-help") == 0) {
cout << "Worldserver command line commands:" << endl;
cout << "adduser username password flag - adds a user account" << endl;
cout << "flag username flag - sets GM flag on the account" << endl;
cout << "startzone zoneshortname - sets the starting zone" << endl;
cout << "-holdzones - reboots lost zones" << endl;
return 0;
}
else if (strcasecmp(argv[1], "-holdzones") == 0) {
cout << "Reboot Zones mode ON" << endl;
holdzones = true;
}
else if (database.GetVariable("disablecommandline", tmp, 2)) {
if (strlen(tmp) == 1) {
if (tmp[0] == '1') {
cout << "Command line disabled in database... exiting" << endl;
return 0;
}
}
}
else if (strcasecmp(argv[1], "adduser") == 0) {
if (argc == 5) {
if (Seperator::IsNumber(argv[4])) {
if (atoi(argv[4]) >= 0 && atoi(argv[4]) <= 255) {
if (database.CreateAccount(argv[2], argv[3], atoi(argv[4])) == 0)
cout << "database.CreateAccount failed." << endl;
else
cout << "Account created: Username='" << argv[2] << "', Password='" << argv[3] << "', status=" << argv[4] << endl;
return 0;
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
//ItemInst d((SharedDatabase *)&database,(uint32)29041,0);
//d.PutAugment(&database,0,41006);
//a.PutItem(0,b);
//a.PutItem(1,c);
//a.PutItem(2,d);
//_log(WORLD__INIT,"%s\n",Client62::SerializeItem(&a,30,0));
//register all the patches we have avaliable with the stream identifier.
EQStreamIdentifier stream_identifier;
RegisterAllPatches(stream_identifier);
zoneserver_list.shutdowntimer=new Timer(60000);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder = new Timer(20000);
zoneserver_list.reminder->Disable();
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
InterserverTimer.Trigger();
EQStream* eqs;
EmuTCPConnection* tcpc;
EQStreamInterface *eqsi;
while(RunLoops) {
Timer::SetCurrentTime();
//check the factory for any new incoming streams.
while ((eqs = 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 = eqs->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
stream_identifier.AddStream(eqs); //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();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
_log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
}
client_list.Process();