167 return *this; |
167 return *this; |
168 } |
168 } |
169 |
169 |
170 bool HWTeam::loadFromFile() |
170 bool HWTeam::loadFromFile() |
171 { |
171 { |
172 QSettings teamfile(QString("physfs://config/Teams/%1.hwt").arg(m_name), QSettings::IniFormat, 0); |
172 QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(m_name), QSettings::IniFormat, 0); |
173 teamfile.setIniCodec("UTF-8"); |
173 teamfile.setIniCodec("UTF-8"); |
174 m_name = teamfile.value("Team/Name", m_name).toString(); |
174 m_name = teamfile.value("Team/Name", m_name).toString(); |
175 m_grave = teamfile.value("Team/Grave", "Statue").toString(); |
175 m_grave = teamfile.value("Team/Grave", "Statue").toString(); |
176 m_fort = teamfile.value("Team/Fort", "Plane").toString(); |
176 m_fort = teamfile.value("Team/Fort", "Plane").toString(); |
177 m_voicepack = teamfile.value("Team/Voicepack", "Default").toString(); |
177 m_voicepack = teamfile.value("Team/Voicepack", "Default").toString(); |
200 return true; |
200 return true; |
201 } |
201 } |
202 |
202 |
203 bool HWTeam::fileExists() |
203 bool HWTeam::fileExists() |
204 { |
204 { |
205 QFile f(QString("physfs://config/Teams/%1.hwt").arg(m_name)); |
205 QFile f(QString("physfs://Teams/%1.hwt").arg(m_name)); |
206 return f.exists(); |
206 return f.exists(); |
207 } |
207 } |
208 |
208 |
209 bool HWTeam::deleteFile() |
209 bool HWTeam::deleteFile() |
210 { |
210 { |
211 if(m_isNetTeam) |
211 if(m_isNetTeam) |
212 return false; |
212 return false; |
213 QFile cfgfile(QString("physfs://config/Teams/%1.hwt").arg(m_name)); |
213 QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(m_name)); |
214 cfgfile.remove(); |
214 cfgfile.remove(); |
215 return true; |
215 return true; |
216 } |
216 } |
217 |
217 |
218 bool HWTeam::saveToFile() |
218 bool HWTeam::saveToFile() |
219 { |
219 { |
220 if (OldTeamName != m_name) |
220 if (OldTeamName != m_name) |
221 { |
221 { |
222 QFile cfgfile(QString("physfs://config/Teams/%1.hwt").arg(OldTeamName)); |
222 QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(OldTeamName)); |
223 cfgfile.remove(); |
223 cfgfile.remove(); |
224 OldTeamName = m_name; |
224 OldTeamName = m_name; |
225 } |
225 } |
226 QSettings teamfile(QString("physfs://config/Teams/%1.hwt").arg(m_name), QSettings::IniFormat, 0); |
226 |
|
227 QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(m_name), QSettings::IniFormat, 0); |
227 teamfile.setIniCodec("UTF-8"); |
228 teamfile.setIniCodec("UTF-8"); |
228 teamfile.setValue("Team/Name", m_name); |
229 teamfile.setValue("Team/Name", m_name); |
229 teamfile.setValue("Team/Grave", m_grave); |
230 teamfile.setValue("Team/Grave", m_grave); |
230 teamfile.setValue("Team/Fort", m_fort); |
231 teamfile.setValue("Team/Fort", m_fort); |
231 teamfile.setValue("Team/Voicepack", m_voicepack); |
232 teamfile.setValue("Team/Voicepack", m_voicepack); |
232 teamfile.setValue("Team/Flag", m_flag); |
233 teamfile.setValue("Team/Flag", m_flag); |
233 teamfile.setValue("Team/Difficulty", m_difficulty); |
234 teamfile.setValue("Team/Difficulty", m_difficulty); |
234 teamfile.setValue("Team/Rounds", m_rounds); |
235 teamfile.setValue("Team/Rounds", m_rounds); |
235 teamfile.setValue("Team/Wins", m_wins); |
236 teamfile.setValue("Team/Wins", m_wins); |
236 teamfile.setValue("Team/CampaignProgress", m_campaignProgress); |
237 teamfile.setValue("Team/CampaignProgress", m_campaignProgress); |
|
238 |
237 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
239 for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
238 { |
240 { |
239 QString hh = QString("Hedgehog%1/").arg(i); |
241 QString hh = QString("Hedgehog%1/").arg(i); |
240 teamfile.setValue(hh + "Name", m_hedgehogs[i].Name); |
242 teamfile.setValue(hh + "Name", m_hedgehogs[i].Name); |
241 teamfile.setValue(hh + "Hat", m_hedgehogs[i].Hat); |
243 teamfile.setValue(hh + "Hat", m_hedgehogs[i].Hat); |