don't allow for locked areas with no cm

This commit is contained in:
in1tiate 2021-03-11 04:52:54 -06:00
parent bd471eda00
commit 07a19fe8cd
2 changed files with 13 additions and 1 deletions

View File

@ -68,10 +68,17 @@ void AOClient::clientDisconnected()
false; false;
server->updateCharsTaken(server->areas[current_area]); server->updateCharsTaken(server->areas[current_area]);
} }
bool update_locks;
for (AreaData* area : server->areas) { for (AreaData* area : server->areas) {
area->owners.removeAll(id); area->owners.removeAll(id);
area->invited.removeAll(id); area->invited.removeAll(id);
if (area->owners.isEmpty() && area->locked != AreaData::FREE) {
area->locked = AreaData::FREE;
update_locks = true;
}
} }
if (update_locks)
arup(ARUPType::LOCKED, true);
arup(ARUPType::CM, true); arup(ARUPType::CM, true);
} }

View File

@ -504,8 +504,13 @@ void AOClient::cmdUnCM(int argc, QStringList argv)
area->invited.removeAll(id); area->invited.removeAll(id);
sendServerMessage("You are no longer CM in this area."); sendServerMessage("You are no longer CM in this area.");
arup(ARUPType::CM, true); arup(ARUPType::CM, true);
if (area->owners.isEmpty()) if (area->owners.isEmpty()) {
area->invited.clear(); area->invited.clear();
if (area->locked != AreaData::FREE) {
area->locked = AreaData::FREE;
arup(ARUPType::LOCKED, true);
}
}
} }
void AOClient::cmdInvite(int argc, QStringList argv) void AOClient::cmdInvite(int argc, QStringList argv)