#include "tnlAsymmetricKey.h"
#include <stdio.h>
#include <iostream>

#include "Position.h"
#include "Player.h"
#include "GameObject.h"
#include "GameConnection.h"
#include "GameWorldServer.h"
#include "Logger.h"

using namespace std;
using namespace DinastyOnline::Network;
using namespace TNL;

int main(int argc, const char **argv) {

	if(argc != 2) {
		printf("usage: GameServer <connectAddress>");
		return 1;
	}

	// convert the command-line address into TNL address form
	Address cmdAddress(argv[1]);

	GameWorldServer *world = new GameWorldServer(cmdAddress);

	TNL::logprintf("Listening...");

	int count = 0;
	while(true) {
		if (count == 1000) {
			//TNL::logprintf(".");
			count = 0;
		}
		count++;
		world->idle();
		Platform::sleep(1);
	}

	return 0;
}
