~nico-izo-ya/+junk/aaron2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/****************************************************************************
 * main.cpp
 *  Copyright © 2011, Vsevolod Velichko.
 *  Licence: GPLv3 or later
 *
 ****************************************************************************
 *                                                                          *
 *   This library is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by   *
 *   the Free Software Foundation; either version 3 of the License, or      *
 *   (at your option) any later version.                                    *
 *                                                                          *
 ****************************************************************************/

#include <QCoreApplication>
#include <QTextCodec>
#include <QDateTime>
#include "options.h"
#include "bot.h"
#include "logserver.h"
#include <thread>

#ifndef AARON_SHARE_PATH
#define AARON_SHARE_PATH ""
#endif

int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);
	qsrand(QDateTime::currentDateTime().toTime_t());
	QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));

	Options& options = Options::mutableInstance();
	options.readConfig();
	if (options["shouldExit"].toBool())
		return 0;

	Bot b;

	char *argv_server[] = {argv[0], "-c", AARON_SHARE_PATH "logserver.json"};
	std::thread t(ioremap::thevoid::run_server<LogServer>, 3, argv_server);
	t.detach();

	return a.exec();
}