author | Wuzzy <almikes@aol.com> |
Tue, 25 Apr 2017 17:51:03 +0200 | |
changeset 12323 | 7c04b4c4ffc2 |
parent 12295 | ac57d564efce |
child 12499 | d97050a7c074 |
permissions | -rw-r--r-- |
1907 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2009 Martin Minarik <ttsmj@pokec.sk> |
|
11046 | 4 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
1907 | 5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation; version 2 of the License |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1907 | 18 |
*/ |
19 |
||
20 |
#include <QFile> |
|
21 |
#include <QTextStream> |
|
22 |
#include <QStringList> |
|
23 |
#include <QLineEdit> |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
24 |
|
1907 | 25 |
#include "hwform.h" |
6930 | 26 |
#include "DataManager.h" |
1907 | 27 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
28 |
#include "namegen.h" |
1907 | 29 |
|
6024 | 30 |
HWNamegen::HWNamegen() {} |
1907 | 31 |
|
6024 | 32 |
QList<QStringList> HWNamegen::TypesTeamnames; |
33 |
QList<QStringList> HWNamegen::TypesHatnames; |
|
34 |
bool HWNamegen::typesAvailable = false; |
|
1907 | 35 |
|
12245
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
36 |
void HWNamegen::teamRandomTeamName(HWTeam & team) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
37 |
{ |
12247
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
38 |
QString newName = getRandomTeamName(-1); |
12245
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
39 |
if(!newName.isNull()) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
40 |
team.setName(newName); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
41 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
42 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
43 |
void HWNamegen::teamRandomFlag(HWTeam & team, bool withDLC) |
12244 | 44 |
{ |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
45 |
team.setFlag(getRandomFlag(withDLC)); |
12244 | 46 |
} |
1907 | 47 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
48 |
void HWNamegen::teamRandomVoice(HWTeam & team, bool withDLC) |
12244 | 49 |
{ |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
50 |
team.setVoicepack(getRandomVoice(withDLC)); |
12244 | 51 |
} |
52 |
||
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
53 |
void HWNamegen::teamRandomGrave(HWTeam & team, bool withDLC) |
12244 | 54 |
{ |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
55 |
team.setGrave(getRandomGrave(withDLC)); |
12244 | 56 |
} |
57 |
||
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
58 |
void HWNamegen::teamRandomFort(HWTeam & team, bool withDLC) |
12244 | 59 |
{ |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
60 |
team.setFort(getRandomFort(withDLC)); |
12244 | 61 |
} |
62 |
||
12248
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12247
diff
changeset
|
63 |
void HWNamegen::teamRandomEverything(HWTeam & team, const RandomTeamMode mode) |
1907 | 64 |
{ |
6024 | 65 |
// load types if not already loaded |
66 |
if (!typesAvailable) |
|
67 |
if (!loadTypes()) |
|
68 |
return; // abort if loading failed |
|
69 |
||
70 |
// abort if there are no hat types |
|
71 |
if (TypesHatnames.size() <= 0) |
|
72 |
return; |
|
1907 | 73 |
|
6024 | 74 |
// the hat will influence which names the hogs get |
75 |
int kind = (rand()%(TypesHatnames.size())); |
|
76 |
||
77 |
// pick team name based on hat |
|
12248
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12247
diff
changeset
|
78 |
if (mode == HWNamegen::rtmEverything) |
6024 | 79 |
{ |
12247
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
80 |
team.setName(getRandomTeamName(kind)); |
6024 | 81 |
team.setGrave(getRandomGrave()); |
82 |
team.setFort(getRandomFort()); |
|
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
83 |
team.setFlag(getRandomFlag()); |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
84 |
team.setVoicepack(getRandomVoice()); |
6024 | 85 |
} |
86 |
||
87 |
QStringList dicts; |
|
88 |
QStringList dict; |
|
89 |
||
90 |
if ((TypesHatnames[kind].size()) <= 0) |
|
91 |
{ |
|
92 |
dicts = dictsForHat(team.hedgehog(0).Hat); |
|
93 |
dict = dictContents(dicts[rand()%(dicts.size())]); |
|
94 |
} |
|
95 |
||
96 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
97 |
{ |
|
12248
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12247
diff
changeset
|
98 |
if (((TypesHatnames[kind].size()) > 0) && (mode == HWNamegen::rtmEverything || mode == HWNamegen::rtmHats)) |
6024 | 99 |
{ |
100 |
HWHog hh = team.hedgehog(i); |
|
101 |
hh.Hat = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())]; |
|
102 |
team.setHedgehog(i,hh); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2192
diff
changeset
|
103 |
} |
6024 | 104 |
// there is a chance that this hog has the same hat as the previous one |
105 |
// let's reuse the hat-specific dict in this case |
|
6824
617a861b7750
i didn't even know it was possible (spotted by adam4813)
koda
parents:
6700
diff
changeset
|
106 |
if ((i == 0) || (team.hedgehog(i).Hat != team.hedgehog(i-1).Hat)) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2192
diff
changeset
|
107 |
{ |
6024 | 108 |
dicts = dictsForHat(team.hedgehog(i).Hat); |
109 |
dict = dictContents(dicts[rand()%(dicts.size())]); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2192
diff
changeset
|
110 |
} |
1907 | 111 |
|
6024 | 112 |
// give each hedgehog a random name |
12248
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12247
diff
changeset
|
113 |
if (mode == HWNamegen::rtmHogNames || mode == HWNamegen::rtmEverything) |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12247
diff
changeset
|
114 |
HWNamegen::teamRandomHogName(team,i,dict); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2192
diff
changeset
|
115 |
} |
1907 | 116 |
|
117 |
} |
|
118 |
||
12244 | 119 |
void HWNamegen::teamRandomHogName(HWTeam & team, const int HedgehogNumber) |
6024 | 120 |
{ |
121 |
QStringList dicts = dictsForHat(team.hedgehog(HedgehogNumber).Hat); |
|
1907 | 122 |
|
6024 | 123 |
QStringList dict = dictContents(dicts[rand()%(dicts.size())]); |
124 |
||
12244 | 125 |
teamRandomHogName(team, HedgehogNumber, dict); |
6024 | 126 |
} |
127 |
||
12244 | 128 |
void HWNamegen::teamRandomHogName(HWTeam & team, const int HedgehogNumber, const QStringList & dict) |
1907 | 129 |
{ |
6024 | 130 |
QStringList namesDict = dict; |
1907 | 131 |
|
6024 | 132 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
133 |
{ |
|
134 |
namesDict.removeOne(team.hedgehog(i).Name); |
|
135 |
} |
|
136 |
||
137 |
// if our dict doesn't have any new names we'll have to use duplicates |
|
138 |
if (namesDict.size() < 1) |
|
139 |
namesDict = dict; |
|
1907 | 140 |
|
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5252
diff
changeset
|
141 |
HWHog hh = team.hedgehog(HedgehogNumber); |
6024 | 142 |
|
143 |
hh.Name = namesDict[rand()%(namesDict.size())]; |
|
144 |
||
6015
daffc14a518a
cleaning up a little bit more, especially team class. we were leaking teams into heap memory on quick game starts btw
sheepluva
parents:
5252
diff
changeset
|
145 |
team.setHedgehog(HedgehogNumber, hh); |
1907 | 146 |
} |
147 |
||
6024 | 148 |
QStringList HWNamegen::dictContents(const QString filename) |
1907 | 149 |
{ |
6024 | 150 |
QStringList list; |
1907 | 151 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
152 |
// find .txt to load the names from |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
153 |
QFile file(QString("physfs://Names/%1.txt").arg(filename)); |
6024 | 154 |
|
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
155 |
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
156 |
{ |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
157 |
QTextStream in(&file); |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
158 |
QString line; |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
159 |
do |
6024 | 160 |
{ |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
161 |
line = in.readLine(); |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
162 |
|
6024 | 163 |
if(!line.isEmpty()) |
164 |
list.append(line); |
|
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
165 |
} while (!line.isNull()); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
166 |
} |
1907 | 167 |
|
6024 | 168 |
if (list.size() == 0) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
169 |
list.append(filename); |
1907 | 170 |
|
6024 | 171 |
return list; |
1907 | 172 |
} |
173 |
||
174 |
||
6024 | 175 |
QStringList HWNamegen::dictsForHat(const QString hatname) |
1907 | 176 |
{ |
6024 | 177 |
QStringList list; |
1907 | 178 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
179 |
// find .cfg to load the dicts from |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
180 |
QFile file(QString("physfs://Names/%1.cfg").arg(hatname)); |
6024 | 181 |
|
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
182 |
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
183 |
{ |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
184 |
QTextStream in(&file); |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
185 |
QString line; |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
186 |
do |
6024 | 187 |
{ |
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
188 |
line = in.readLine(); |
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
189 |
|
6024 | 190 |
if(!line.isEmpty()) |
191 |
list.append(line); |
|
8110
9f5fe3fc9d16
Use alternative way of checking for file end. Also refactor this code a bit.
unc0rr
parents:
8049
diff
changeset
|
192 |
} while (!line.isNull()); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
193 |
} |
1907 | 194 |
|
6024 | 195 |
if (list.size() == 0) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
196 |
list.append(QString("generic")); |
1907 | 197 |
|
6024 | 198 |
return list; |
1907 | 199 |
} |
200 |
||
6024 | 201 |
// loades types from ini files. returns true on success. |
202 |
bool HWNamegen::loadTypes() |
|
203 |
{ |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
204 |
typesAvailable = false; |
6024 | 205 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
206 |
// find .ini to load the names from |
8049 | 207 |
QFile * file = new QFile(QString("physfs://Names/types.ini")); |
6024 | 208 |
|
1907 | 209 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
210 |
if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text)) |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
211 |
{ |
1907 | 212 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
213 |
int counter = 0; //counter starts with 0 (teamnames mode) |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
214 |
TypesTeamnames.append(QStringList()); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
215 |
TypesHatnames.append(QStringList()); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
216 |
|
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
217 |
QTextStream in(file); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
218 |
while (!in.atEnd()) |
6024 | 219 |
{ |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
220 |
QString line = in.readLine(); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
221 |
if (line == QString("#####")) |
6024 | 222 |
{ |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
223 |
counter++; //toggle mode (teamnames || hats) |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
224 |
if ((counter%2) == 0) |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
225 |
{ |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
226 |
TypesTeamnames.append(QStringList()); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
227 |
TypesHatnames.append(QStringList()); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
228 |
} |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
229 |
} |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
230 |
else if ((line == QString("*****")) || (line == QString("*END*"))) |
6024 | 231 |
{ |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
232 |
typesAvailable = true; |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
233 |
return true; // bye bye |
6024 | 234 |
} |
235 |
else |
|
236 |
{ |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
237 |
if ((counter%2) == 0) |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
238 |
{ |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
239 |
// even => teamnames mode |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
240 |
TypesTeamnames[(counter/2)].append(line); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
241 |
} |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
242 |
else |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
243 |
{ |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
244 |
// odd => hats mode |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
245 |
TypesHatnames[((counter-1)/2)].append(line); |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
246 |
} |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
247 |
} |
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
248 |
} |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
249 |
|
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
250 |
typesAvailable = true; |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5115
diff
changeset
|
251 |
} |
6024 | 252 |
|
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
253 |
// this QFile isn't needed any further |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
254 |
delete file; |
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
255 |
|
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
256 |
return typesAvailable; |
1907 | 257 |
} |
258 |
||
12247
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
259 |
/* Generates a random team name. |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
260 |
kind: Use to select a team name out of a group (types.ini). |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
261 |
Use a negative value if you don't care. |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
262 |
This function may return a null QString on error(this should never happen). */ |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
263 |
QString HWNamegen::getRandomTeamName(int kind) |
12245
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
264 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
265 |
// load types if not already loaded |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
266 |
if (!typesAvailable) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
267 |
if (!loadTypes()) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
268 |
return QString(); // abort if loading failed |
1907 | 269 |
|
12245
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
270 |
// abort if there are no hat types |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
271 |
if (TypesHatnames.size() <= 0) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
272 |
return QString(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
273 |
|
12247
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
274 |
if(kind < 0) |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
275 |
kind = (rand()%(TypesHatnames.size())); |
a6e0977be914
Fix non-matching team name when generating random teams
Wuzzy <almikes@aol.com>
parents:
12245
diff
changeset
|
276 |
|
12245
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
277 |
if (TypesTeamnames[kind].size() > 0) |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
278 |
return TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())]; |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
279 |
else |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
280 |
return QString(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12244
diff
changeset
|
281 |
} |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
282 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
283 |
QString HWNamegen::getRandomGrave(bool withDLC) |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
284 |
{ |
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
285 |
QStringList Graves; |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
286 |
|
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
287 |
//list all available Graves |
6930 | 288 |
Graves.append(DataManager::instance().entryList( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
289 |
"Graphics/Graves", |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
290 |
QDir::Files, |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
291 |
QStringList("*.png"), |
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
292 |
withDLC |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
293 |
).replaceInStrings(QRegExp("\\.png$"), "") |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
294 |
); |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
295 |
|
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
296 |
if(Graves.size()==0) |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
297 |
{ |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
298 |
// TODO do some serious error handling |
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
299 |
return "Error"; |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
300 |
} |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
301 |
|
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
302 |
//pick a random grave |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
303 |
return Graves[rand()%(Graves.size())]; |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
304 |
} |
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
305 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
306 |
QString HWNamegen::getRandomFlag(bool withDLC) |
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
307 |
{ |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
308 |
QStringList Flags; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
309 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
310 |
//list all available flags |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
311 |
Flags.append(DataManager::instance().entryList( |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
312 |
"Graphics/Flags", |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
313 |
QDir::Files, |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
314 |
QStringList("*.png"), |
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
315 |
withDLC |
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
316 |
).replaceInStrings(QRegExp("\\.png$"), "") |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
317 |
); |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
318 |
//remove internal flags |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
319 |
Flags.removeAll("cpu"); |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
320 |
Flags.removeAll("cpu_plain"); |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
321 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
322 |
if(Flags.size()==0) |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
323 |
{ |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
324 |
// TODO do some serious error handling |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
325 |
return "Error"; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
326 |
} |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
327 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
328 |
//pick a random flag |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
329 |
return Flags[rand()%(Flags.size())]; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
330 |
} |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
331 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
332 |
QString HWNamegen::getRandomFort(bool withDLC) |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
333 |
{ |
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
334 |
QStringList Forts; |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
335 |
|
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
336 |
//list all available Forts |
6930 | 337 |
Forts.append(DataManager::instance().entryList( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
338 |
"Forts", |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
339 |
QDir::Files, |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
340 |
QStringList("*L.png"), |
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
341 |
withDLC |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6212
diff
changeset
|
342 |
).replaceInStrings(QRegExp("L\\.png$"), "") |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
343 |
); |
5114
a05081bc2769
Improved random name generation (now a random fort and random grave is choosen
Jonathan@Jonathan-PC.fritz.box
parents:
4976
diff
changeset
|
344 |
|
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
345 |
if(Forts.size()==0) |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
346 |
{ |
6160
863d3edf5690
cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents:
6060
diff
changeset
|
347 |
// TODO do some serious error handling |
5115
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
348 |
return "Error"; |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
349 |
} |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
350 |
|
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
351 |
//pick a random fort |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
352 |
return Forts[rand()%(Forts.size())]; |
276410cc1178
fix indentation and missing newline at end of file
sheepluva
parents:
5114
diff
changeset
|
353 |
} |
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
354 |
|
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
355 |
QString HWNamegen::getRandomVoice(bool withDLC) |
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
356 |
{ |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
357 |
QStringList Voices; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
358 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
359 |
//list all available voices |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
360 |
Voices.append(DataManager::instance().entryList( |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
361 |
"Sounds/voices", |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
362 |
QDir::Dirs | QDir::NoDotAndDotDot, |
12295
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
363 |
QStringList("*"), |
ac57d564efce
Add DLC filtering in DataManager.cpp and namegen.cpp
Wuzzy <almikes@aol.com>
parents:
12248
diff
changeset
|
364 |
withDLC)); |
11888
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
365 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
366 |
if(Voices.size()==0) |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
367 |
{ |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
368 |
// TODO do some serious error handling |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
369 |
return "Error"; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
370 |
} |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
371 |
|
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
372 |
//pick a random voice |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
373 |
return Voices[rand()%(Voices.size())]; |
618d99523933
Set random flags and voice in random teams
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
374 |
} |