fix area config reading based on sanitized name
This commit is contained in:
parent
8b4929223c
commit
a62b12fb7a
@ -19,7 +19,9 @@
|
||||
|
||||
AreaData::AreaData(QString p_name, int p_index)
|
||||
{
|
||||
name = p_name;
|
||||
QStringList name_split = p_name.split(":");
|
||||
name_split.removeFirst();
|
||||
name = name_split.join(":");
|
||||
index = p_index;
|
||||
QSettings areas_ini("config/areas.ini", QSettings::IniFormat);
|
||||
areas_ini.beginGroup(p_name);
|
||||
|
@ -109,9 +109,9 @@ void AOClient::pktLoadingDone(AreaData* area, int argc, QStringList argv, AOPack
|
||||
sendPacket("HP", {"1", QString::number(area->def_hp)});
|
||||
sendPacket("HP", {"2", QString::number(area->pro_hp)});
|
||||
sendPacket("FA", server->area_names);
|
||||
sendPacket("BN", {area->background});
|
||||
sendPacket("OPPASS", {"DEADBEEF"});
|
||||
sendPacket("DONE");
|
||||
sendPacket("BN", {area->background});
|
||||
|
||||
sendServerMessage("=== MOTD ===\r\n" + server->MOTD + "\r\n=============");
|
||||
|
||||
|
@ -84,6 +84,7 @@ void Server::start()
|
||||
area_names = areas_ini.childGroups(); // invisibly does a lexicographical sort, because Qt is great like that
|
||||
std::sort(area_names.begin(), area_names.end(), [] (const QString &a, const QString &b) {return a.split(":")[0].toInt() < b.split(":")[0].toInt();});
|
||||
QStringList sanitized_area_names;
|
||||
QStringList raw_area_names = area_names;
|
||||
for (QString area_name : area_names) {
|
||||
QStringList name_split = area_name.split(":");
|
||||
name_split.removeFirst();
|
||||
@ -91,8 +92,8 @@ void Server::start()
|
||||
sanitized_area_names.append(area_name_sanitized);
|
||||
}
|
||||
area_names = sanitized_area_names;
|
||||
for (int i = 0; i < area_names.length(); i++) {
|
||||
QString area_name = area_names[i];
|
||||
for (int i = 0; i < raw_area_names.length(); i++) {
|
||||
QString area_name = raw_area_names[i];
|
||||
areas.insert(i, new AreaData(area_name, i));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user