QTfrontend/util/namegen.cpp
branchphysfslayer
changeset 8049 133e22b5c410
parent 6952 7f70f37bbf08
child 8103 c247346d296f
child 8110 9f5fe3fc9d16
equal deleted inserted replaced
8046:4d3415927d2c 8049:133e22b5c410
   123 QStringList HWNamegen::dictContents(const QString filename)
   123 QStringList HWNamegen::dictContents(const QString filename)
   124 {
   124 {
   125     QStringList list;
   125     QStringList list;
   126 
   126 
   127     // find .txt to load the names from
   127     // find .txt to load the names from
   128     QFile * file = new QFile(DataManager::instance().findFileForRead(QString(
   128     QFile * file = new QFile(QString("physfs://Names/%1.txt").arg(filename));
   129                                  "Names/%1.txt").arg(filename)));
       
   130 
   129 
   131     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   130     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   132     {
   131     {
   133         QTextStream in(file);
   132         QTextStream in(file);
   134         while (!in.atEnd())
   133         while (!in.atEnd())
   152 QStringList HWNamegen::dictsForHat(const QString hatname)
   151 QStringList HWNamegen::dictsForHat(const QString hatname)
   153 {
   152 {
   154     QStringList list;
   153     QStringList list;
   155 
   154 
   156     // find .cfg to load the dicts from
   155     // find .cfg to load the dicts from
   157     QFile * file = new QFile(DataManager::instance().findFileForRead(QString(
   156     QFile * file = new QFile(QString("physfs://Names/%1.cfg").arg(hatname));
   158                                  "Names/%1.cfg").arg(hatname)));
       
   159 
   157 
   160     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   158     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   161     {
   159     {
   162         QTextStream in(file);
   160         QTextStream in(file);
   163         while (!in.atEnd())
   161         while (!in.atEnd())
   181 bool HWNamegen::loadTypes()
   179 bool HWNamegen::loadTypes()
   182 {
   180 {
   183     typesAvailable = false;
   181     typesAvailable = false;
   184 
   182 
   185     // find .ini to load the names from
   183     // find .ini to load the names from
   186     QFile * file = new QFile(
   184     QFile * file = new QFile(QString("physfs://Names/types.ini"));
   187         DataManager::instance().findFileForRead(QString("Names/types.ini")));
       
   188 
   185 
   189 
   186 
   190     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   187     if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
   191     {
   188     {
   192 
   189