本文整理汇总了C++中PluginManager::loadRuleset方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginManager::loadRuleset方法的具体用法?C++ PluginManager::loadRuleset怎么用?C++ PluginManager::loadRuleset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::loadRuleset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
Settings *mySettings = Settings::getSettings();
mySettings->readArgs(argc, argv);
if(mySettings->get("NEVER_START") != "!"){
if(!mySettings->readConfFile()){
std::string savedloglevel = mySettings->get("log_level");
mySettings->set("log_level", "3");
Logger::getLogger()->error("Could not read config file");
mySettings->set("log_level", savedloglevel);
}
if(mySettings->get("DEBUG") != "!"){
daemonize();
}else{
signal(SIGINT, sigIntHandler);
signal(SIGTERM, sigIntHandler);
signal(SIGPIPE, SIG_IGN);
mySettings->set("log_console", "yes");
}
Logger *myLogger = Logger::getLogger();
myLogger->info("Tpserver-cpp " VERSION " starting");
myLogger->info("This is GPL software, please see the COPYING file");
try{
Game *myGame = Game::getGame();
PluginManager* myPlugins = PluginManager::getPluginManager();
myPlugins->start();
try{
std::string tpschemename = mySettings->get("tpscheme");
if(tpschemename == "auto" || tpschemename == ""){
//Temp. should be able to do better than this.
if(myPlugins->loadTpScheme("tpguile")){
myLogger->info("Loaded TpScheme tpguile");
}else{
myLogger->warning("Did not load TpScheme \"tpguile\", trying tpmzscheme");
if(myPlugins->loadTpScheme("tpmzscheme")){
myLogger->info("Loaded TpScheme tpmzscheme");
}else{
myLogger->warning("Did not load TpScheme \"tpmzscheme\"");
}
}
}else{
myLogger->info("Loading TpScheme %s", tpschemename.c_str());
if(myPlugins->loadTpScheme(tpschemename)){
myLogger->info("Loaded TpScheme %s", tpschemename.c_str());
}else{
myLogger->warning("Did not load TpScheme \"%s\"", tpschemename.c_str());
}
}
std::string persistencename = mySettings->get("persistence");
if(persistencename != ""){
myLogger->info("Loading persistence method %s", persistencename.c_str());
if(myPlugins->loadPersistence(persistencename)){
myLogger->info("Loaded persistence method %s", persistencename.c_str());
}else{
myLogger->warning("Did not load persistence method \"%s\"", persistencename.c_str());
}
}
std::string rulesetname = mySettings->get("ruleset");
if(rulesetname != ""){
myLogger->info("Loading ruleset %s", rulesetname.c_str());
if(myPlugins->loadRuleset(rulesetname)){
myLogger->info("Loaded ruleset %s", rulesetname.c_str());
}else{
myLogger->warning("Did not load ruleset \"%s\"", rulesetname.c_str());
}
}
if(mySettings->get("game_load") == "yes"){
myGame->load();
}
if(mySettings->get("game_start") == "yes"){
myGame->start();
}
Network *myNetwork = Network::getNetwork();
if(mySettings->get("network_start") == "yes"){
myNetwork->start();
}
myNetwork->masterLoop();
if(myNetwork->isStarted()){
myNetwork->stop();
}
//.........这里部分代码省略.........