fix crash in logger, add (nonfunctional) protected area flag
This commit is contained in:
parent
0b024abe5c
commit
f607be2d6c
@ -51,8 +51,8 @@ class AreaData {
|
||||
};
|
||||
LockStatus locked;
|
||||
QString background;
|
||||
bool is_protected;
|
||||
bool showname_allowed;
|
||||
bool locking_allowed;
|
||||
bool iniswap_allowed;
|
||||
bool bg_locked;
|
||||
QString document;
|
||||
|
@ -27,6 +27,7 @@ AreaData::AreaData(QStringList characters, QString p_name, int p_index)
|
||||
QSettings areas_ini("areas.ini", QSettings::IniFormat);
|
||||
areas_ini.beginGroup(p_name);
|
||||
background = areas_ini.value("background", "gs4").toString();
|
||||
is_protected = areas_ini.value("protected_area").toString().startsWith("true");
|
||||
areas_ini.endGroup();
|
||||
player_count = 0;
|
||||
locked = FREE;
|
||||
|
@ -415,16 +415,20 @@ void AOClient::cmdCM(int argc, QStringList argv)
|
||||
{
|
||||
QString sender_name = ooc_name;
|
||||
AreaData* area = server->areas[current_area];
|
||||
if (area->owners.isEmpty()) {
|
||||
if (area->is_protected) {
|
||||
sendServerMessage("This area is protected, you may not become CM.");
|
||||
return;
|
||||
}
|
||||
else if (area->owners.isEmpty()) { // no one owns this area, and it's not protected
|
||||
area->owners.append(id);
|
||||
area->invited.append(id);
|
||||
sendServerMessageArea(sender_name + " is now CM in this area.");
|
||||
arup(ARUPType::CM, true);
|
||||
}
|
||||
else if (!area->owners.contains(id)) {
|
||||
else if (!area->owners.contains(id)) { // there is already a CM, and it isn't us
|
||||
sendServerMessage("You cannot become a CM in this area.");
|
||||
}
|
||||
else if (argc == 1) {
|
||||
else if (argc == 1) { // we are CM, and we want to make ID argv[0] also CM
|
||||
bool ok;
|
||||
AOClient* owner_candidate = server->getClientByID(argv[0].toInt(&ok));
|
||||
if (!ok) {
|
||||
|
@ -51,7 +51,7 @@ void Logger::logCmd(AOClient *client, AOPacket *packet, QString cmd, QStringList
|
||||
else if (cmd == "rootpass") {
|
||||
addEntry(buildEntry(client, "USERS", "Root password created"));
|
||||
}
|
||||
else if (cmd == "adduser") {
|
||||
else if (cmd == "adduser" && !args.isEmpty()) {
|
||||
addEntry(buildEntry(client, "USERS", "Added user " + args[0]));
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user