--- a/QTfrontend/team.cpp Sun Mar 22 14:32:22 2009 +0000
+++ b/QTfrontend/team.cpp Sun Mar 22 14:35:45 2009 +0000
@@ -23,7 +23,6 @@
#include <QLineEdit>
#include "team.h"
#include "hwform.h"
-#include "predefteams.h"
#include "pages.h"
#include "hwconsts.h"
#include "hats.h"
@@ -33,8 +32,6 @@
numHedgehogs(4),
m_isNetTeam(false)
{
- TypesLoad();
-
TeamName = teamname;
OldTeamName = TeamName;
for (int i = 0; i < 8; i++)
@@ -56,8 +53,6 @@
numHedgehogs(4),
m_isNetTeam(true)
{
- TypesLoad();
-
// net teams are configured from QStringList
if(strLst.size() != 22) throw HWTeamConstructException();
TeamName = strLst[0];
@@ -73,35 +68,11 @@
}
}
-HWTeam::HWTeam(quint8 num) :
+HWTeam::HWTeam() :
difficulty(0),
numHedgehogs(4),
m_isNetTeam(false)
{
- TypesLoad();
-
- num %= PREDEFTEAMS_COUNT;
-/*
- //This is now generated by TeamRandomNames(TRUE);
- TeamName = QApplication::translate("teams", pteams[num].TeamName);
- HHName[0] = QApplication::translate("teams", pteams[num].hh0name);
- HHName[1] = QApplication::translate("teams", pteams[num].hh1name);
- HHName[2] = QApplication::translate("teams", pteams[num].hh2name);
- HHName[3] = QApplication::translate("teams", pteams[num].hh3name);
- HHName[4] = QApplication::translate("teams", pteams[num].hh4name);
- HHName[5] = QApplication::translate("teams", pteams[num].hh5name);
- HHName[6] = QApplication::translate("teams", pteams[num].hh6name);
- HHName[7] = QApplication::translate("teams", pteams[num].hh7name);
- HHHat[0] = pteams[num].hh0hat;
- HHHat[1] = pteams[num].hh1hat;
- HHHat[2] = pteams[num].hh2hat;
- HHHat[3] = pteams[num].hh3hat;
- HHHat[4] = pteams[num].hh4hat;
- HHHat[5] = pteams[num].hh5hat;
- HHHat[6] = pteams[num].hh6hat;
- HHHat[7] = pteams[num].hh7hat;
-*/
-
TeamName = QString("Team");
for (int i = 0; i < 8; i++)
{
@@ -109,15 +80,14 @@
HHHat[i] = "NoHat";
}
- Grave = pteams[num].Grave;
- Fort = pteams[num].Fort;
+ Grave = QString("Simple"); // default
+ Fort = QString("Island"); // default
+
for(int i = 0; i < BINDS_NUMBER; i++)
{
binds[i].action = cbinds[i].action;
binds[i].strbind = cbinds[i].strbind;
}
-
- TeamRandomNames(TRUE);
}
@@ -294,62 +264,6 @@
return sl;
}
-void HWTeam::RandomNameByHat(const int &i)
-{
-
-
-
- QStringList Dictionaries;
- HatCfgLoad(HHHat[i],Dictionaries);
-
-
-/*
-
-"Dismissed",
-"Dragon",
-"Mindblower",
-*/
-
- QStringList Dictionary;
- DictLoad(Dictionaries[rand()%(Dictionaries.size())],Dictionary);
-
-
- HHName[i] = Dictionary[rand()%(Dictionary.size())];
-
-}
-
-void HWTeam::TeamRandomName(const int &i)
-{
-
- RandomNameByHat(i);
-
-
-}
-
-void HWTeam::TeamRandomNames(bool changeteamname)
-{
-
- if ((TypesHatnames.size() > 0) && TypesAvliable){
-
- int kind = (rand()%(TypesHatnames.size()));
-
- if (changeteamname){
- if (TypesTeamnames[kind].size() > 0){
- TeamName = TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())];
- }
- }
-
- for(int i = 0; i < 8; i++)
- {
- if ((TypesHatnames[kind].size()) > 0){
- HHHat[i] = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())];
- }
- RandomNameByHat(i);
- }
-
- }
-}
-
bool HWTeam::isNetTeam() const
{
return m_isNetTeam;
@@ -364,83 +278,4 @@
return TeamName<t1.TeamName; // if names are equal - test if it is net team
}
-void HWTeam::TypesLoad()
-{
- QFile file(QString("%1/Names/types.ini").arg(datadir->absolutePath()));
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- TypesAvliable = FALSE;
-
- int counter = 0; //counter starts with 0 (teamnames mode)
- TypesTeamnames.append(QStringList());
- TypesHatnames.append(QStringList());
-
- QTextStream in(&file);
- while (!in.atEnd()) {
- QString line = in.readLine();
- if (line == QString("#####")){
- counter++; //toggle mode (teamnames || hats)
- if ((counter%2) == 0){
- TypesTeamnames.append(QStringList());
- TypesHatnames.append(QStringList());
- }
- } else if ((line == QString("*****")) || (line == QString("*END*"))){
- TypesAvliable = TRUE; return; // bye bye
- } else {
- if ((counter%2) == 0){ // even => teamnames mode
- TypesTeamnames[(counter/2)].append(line);
- } else { // odd => hats mode
- TypesHatnames[((counter-1)/2)].append(line);
- }
- }
-// Types.append(line);
- }
- TypesAvliable = TRUE;
- return;
-}
-
-
-void HWTeam::DictLoad(const QString filename, QStringList &list)
-{
- list.clear();
-
- QFile file(QString("%1/Names/%2.txt").arg(datadir->absolutePath()).arg(filename));
- if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
-
- QTextStream in(&file);
- while (!in.atEnd()) {
- QString line = in.readLine();
- if(line != QString(""))
- {list.append(line);}
- }
- }
-
- if (list.size()==0)
- list.append(filename);
-
-}
-
-
-void HWTeam::HatCfgLoad(const QString hatname, QStringList &list)
-{
- list.clear();
-
- QFile file(QString("%1/Names/%2.cfg").arg(datadir->absolutePath()).arg(hatname));
- if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
-
- QTextStream in(&file);
- while (!in.atEnd()) {
- QString line = in.readLine();
- if(line != QString(""))
- {list.append(line);}
- }
- }
-
- if (list.size()==0)
- list.append(QString("generic"));
-
-}
-
-