示例#1
0
int main(){

    /*
#######################
Init Game
#######################
*/
    char menu = '0'; 
 
    do{

        menu = displayMenu();

        if(menu == LAN){

            configServer();
            initPlayer();
        }    
        else if(menu == LOCAL){

            initPlayer();    
        }


        printf("\n");
        printf("Players were created");
        printf("\n\n");
    }while(menu!=EXIT);

    return 0;
}
示例#2
0
int main(int argc, char *argv[])
{
	string configFilename = "Config.json";
	string logFilename = "-";

#ifndef _WIN32
	cmdline::parser arg;
	arg.add<string>("config", 'c', "configuration file", false, "Config.json");
	arg.add<string>("log", 'l', "log file", false, "-");
	arg.parse_check(argc, argv);
	configFilename = arg.get<string>("config");
	logFilename = arg.get<string>("log");
#endif 

	log_normal("Using configuration file: %s", configFilename.c_str());
	log_normal("Log file: %s", logFilename.c_str());

	setLogFile(logFilename);

	Document configDoc = loadConfigObj(configFilename);
	Value &roomsVal = configDoc["Rooms"];
	assert(roomsVal.IsArray());
	vector<RoomInfo> rooms(loadRooms(roomsVal));

	initLibraries();

	CubeServer server;
	configRooms(server, rooms);

	server.EnableTimer(CHECK_INTERVAL_uS);

	configServer(server, configDoc["Server"]);

	server.IsRunning = true;
	thread th(eventEntry, &server);

	initHandlers();
	handleCommand(server);

	server.Stop();
	th.join();

	log_normal("%s", "Stopped.");

#ifdef MEM_DEBUG
#ifdef _WIN32
	_CrtDumpMemoryLeaks();
#endif 
#endif 

	return 0;
}