moved call to rng constructor to main()

This commit is contained in:
Max-Wilhelm Bruker 2010-09-23 15:43:39 +02:00
parent a5d73a9a60
commit e92840c849
3 changed files with 14 additions and 5 deletions

View file

@ -35,12 +35,14 @@
#include "carddatabase.h" #include "carddatabase.h"
#include "settingscache.h" #include "settingscache.h"
#include "pixmapgenerator.h" #include "pixmapgenerator.h"
#include "rng_sfmt.h"
//Q_IMPORT_PLUGIN(qjpeg) //Q_IMPORT_PLUGIN(qjpeg)
CardDatabase *db; CardDatabase *db;
QTranslator *translator, *qtTranslator; QTranslator *translator, *qtTranslator;
SettingsCache *settingsCache; SettingsCache *settingsCache;
RNG_Abstract *rng;
void myMessageOutput(QtMsgType /*type*/, const char *msg) void myMessageOutput(QtMsgType /*type*/, const char *msg)
{ {
@ -84,6 +86,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain("cockatrice.de"); QCoreApplication::setOrganizationDomain("cockatrice.de");
QCoreApplication::setApplicationName("Cockatrice"); QCoreApplication::setApplicationName("Cockatrice");
rng = new RNG_SFMT;
settingsCache = new SettingsCache; settingsCache = new SettingsCache;
db = new CardDatabase; db = new CardDatabase;
@ -125,6 +128,7 @@ int main(int argc, char *argv[])
delete db; delete db;
delete settingsCache; delete settingsCache;
delete rng;
PingPixmapGenerator::clear(); PingPixmapGenerator::clear();
CountryPixmapGenerator::clear(); CountryPixmapGenerator::clear();
UserLevelPixmapGenerator::clear(); UserLevelPixmapGenerator::clear();

View file

@ -1,9 +1,6 @@
#include "rng_abstract.h" #include "rng_abstract.h"
#include "rng_qt.h"
#include "rng_sfmt.h"
#include <QDebug> #include <QDebug>
RNG_Abstract *rng = new RNG_SFMT;
QVector<int> RNG_Abstract::makeNumbersVector(int n, int min, int max) QVector<int> RNG_Abstract::makeNumbersVector(int n, int min, int max)
{ {

View file

@ -22,7 +22,9 @@
#include <QTextCodec> #include <QTextCodec>
#include <iostream> #include <iostream>
#include "servatrice.h" #include "servatrice.h"
#include "rng_abstract.h" #include "rng_sfmt.h"
RNG_Abstract *rng;
void myMessageOutput(QtMsgType /*type*/, const char *msg) void myMessageOutput(QtMsgType /*type*/, const char *msg)
{ {
@ -76,6 +78,8 @@ int main(int argc, char *argv[])
app.setApplicationName("Servatrice"); app.setApplicationName("Servatrice");
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
rng = new RNG_SFMT;
std::cerr << "Servatrice " << Servatrice::versionString.toStdString() << " starting." << std::endl; std::cerr << "Servatrice " << Servatrice::versionString.toStdString() << " starting." << std::endl;
std::cerr << "-------------------------" << std::endl; std::cerr << "-------------------------" << std::endl;
@ -87,5 +91,9 @@ int main(int argc, char *argv[])
std::cerr << "-------------------------" << std::endl; std::cerr << "-------------------------" << std::endl;
std::cerr << "Server initialized." << std::endl; std::cerr << "Server initialized." << std::endl;
return app.exec(); int retval = app.exec();
delete rng;
return retval;
} }