Commit e92840c8 authored by Max-Wilhelm Bruker's avatar Max-Wilhelm Bruker
Browse files

moved call to rng constructor to main()

parent a5d73a9a
......@@ -35,12 +35,14 @@
#include "carddatabase.h"
#include "settingscache.h"
#include "pixmapgenerator.h"
#include "rng_sfmt.h"
//Q_IMPORT_PLUGIN(qjpeg)
CardDatabase *db;
QTranslator *translator, *qtTranslator;
SettingsCache *settingsCache;
RNG_Abstract *rng;
void myMessageOutput(QtMsgType /*type*/, const char *msg)
{
......@@ -84,6 +86,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain("cockatrice.de");
QCoreApplication::setApplicationName("Cockatrice");
rng = new RNG_SFMT;
settingsCache = new SettingsCache;
db = new CardDatabase;
......@@ -125,6 +128,7 @@ int main(int argc, char *argv[])
delete db;
delete settingsCache;
delete rng;
PingPixmapGenerator::clear();
CountryPixmapGenerator::clear();
UserLevelPixmapGenerator::clear();
......
#include "rng_abstract.h"
#include "rng_qt.h"
#include "rng_sfmt.h"
#include <QDebug>
RNG_Abstract *rng = new RNG_SFMT;
QVector<int> RNG_Abstract::makeNumbersVector(int n, int min, int max)
{
......
......@@ -22,7 +22,9 @@
#include <QTextCodec>
#include <iostream>
#include "servatrice.h"
#include "rng_abstract.h"
#include "rng_sfmt.h"
RNG_Abstract *rng;
void myMessageOutput(QtMsgType /*type*/, const char *msg)
{
......@@ -76,6 +78,8 @@ int main(int argc, char *argv[])
app.setApplicationName("Servatrice");
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
rng = new RNG_SFMT;
std::cerr << "Servatrice " << Servatrice::versionString.toStdString() << " starting." << std::endl;
std::cerr << "-------------------------" << std::endl;
......@@ -87,5 +91,9 @@ int main(int argc, char *argv[])
std::cerr << "-------------------------" << std::endl;
std::cerr << "Server initialized." << std::endl;
return app.exec();
int retval = app.exec();
delete rng;
return retval;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment