compiles again, convenience messages

This commit is contained in:
in1tiate 2021-02-28 10:08:23 -06:00
parent fd8654de97
commit 30eb010bb6
3 changed files with 16 additions and 14 deletions

View File

@ -103,10 +103,11 @@ void AOClient::changeArea(int new_area)
sendServerMessage("You are already in area " + server->area_names[current_area]); sendServerMessage("You are already in area " + server->area_names[current_area]);
return; return;
} }
if (server->areas[new_area]->locked) { if (server->areas[new_area]->locked == AreaData::LockStatus::LOCKED) {
sendServerMessage("Area " + server->area_names[new_area] + " is locked."); sendServerMessage("Area " + server->area_names[new_area] + " is locked.");
return; return;
} }
if (current_char != "") { if (current_char != "") {
server->areas[current_area]->characters_taken[current_char] = server->areas[current_area]->characters_taken[current_char] =
false; false;
@ -129,7 +130,9 @@ void AOClient::changeArea(int new_area)
server->areas[current_area]->characters_taken[current_char] = true; server->areas[current_area]->characters_taken[current_char] = true;
server->updateCharsTaken(server->areas[current_area]); server->updateCharsTaken(server->areas[current_area]);
} }
sendServerMessage("You have been moved to area " + server->area_names[current_area]); sendServerMessage("You moved to area " + server->area_names[current_area]);
if (server->areas[current_area]->locked == AreaData::LockStatus::SPECTATABLE)
sendServerMessage("Area " + server->area_names[current_area] + " is spectate-only; to chat IC you will need to be invited by the CM.");
} }
void AOClient::handleCommand(QString command, int argc, QStringList argv) void AOClient::handleCommand(QString command, int argc, QStringList argv)
@ -175,13 +178,13 @@ void AOClient::arup(ARUPType type, bool broadcast)
else if (type == ARUPType::LOCKED) { else if (type == ARUPType::LOCKED) {
QString lock_status; QString lock_status;
switch (area->locked) { switch (area->locked) {
case FREE: case AreaData::LockStatus::FREE:
lock_status = "FREE"; lock_status = "FREE";
break; break;
case LOCKED: case AreaData::LockStatus::LOCKED:
lock_status = "LOCKED"; lock_status = "LOCKED";
break; break;
case SPECTATABLE: case AreaData::LockStatus::SPECTATABLE:
lock_status = "SPECTATABLE"; lock_status = "SPECTATABLE";
break; break;
default: default:

View File

@ -508,12 +508,12 @@ void AOClient::cmdLock(int argc, QStringList argv)
sendServerMessage("You are not a CM in this area."); sendServerMessage("You are not a CM in this area.");
return; return;
} }
else if (area->locked == LOCKED) { else if (area->locked == AreaData::LockStatus::LOCKED) {
sendServerMessage("This area is already locked."); sendServerMessage("This area is already locked.");
return; return;
} }
sendServerMessage("This area is now locked."); sendServerMessage("This area is now locked.");
area->locked = LOCKED; area->locked = AreaData::LockStatus::LOCKED;
for (AOClient* client : server->clients) { for (AOClient* client : server->clients) {
if (client->current_area == current_area && client->joined) { if (client->current_area == current_area && client->joined) {
area->invited.append(client->id); area->invited.append(client->id);
@ -528,12 +528,12 @@ void AOClient::cmdSpectatable(int argc, QStringList argv)
sendServerMessage("You are not a CM in this area."); sendServerMessage("You are not a CM in this area.");
return; return;
} }
else if (area->locked == SPECTATABLE) { else if (area->locked == AreaData::LockStatus::SPECTATABLE) {
sendServerMessage("This area is already in spectate mode."); sendServerMessage("This area is already in spectate mode.");
return; return;
} }
sendServerMessage("This area is now spectatable."); sendServerMessage("This area is now spectatable.");
area->locked = SPECTATABLE; area->locked = AreaData::LockStatus::SPECTATABLE;
for (AOClient* client : server->clients) { for (AOClient* client : server->clients) {
if (client->current_area == current_area && client->joined) { if (client->current_area == current_area && client->joined) {
area->invited.append(client->id); area->invited.append(client->id);
@ -548,12 +548,12 @@ void AOClient::cmdUnLock(int argc, QStringList argv)
sendServerMessage("You are not a CM in this area."); sendServerMessage("You are not a CM in this area.");
return; return;
} }
else if (area->locked == FREE) { else if (area->locked == AreaData::LockStatus::FREE) {
sendServerMessage("This area is not locked."); sendServerMessage("This area is not locked.");
return; return;
} }
sendServerMessage("This area is now unlocked."); sendServerMessage("This area is now unlocked.");
area->locked = FREE; area->locked = AreaData::LockStatus::FREE;
arup(ARUPType::LOCKED, true); arup(ARUPType::LOCKED, true);
} }

View File

@ -318,8 +318,8 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
if (current_char == "" || !joined) if (current_char == "" || !joined)
// Spectators cannot use IC // Spectators cannot use IC
return invalid; return invalid;
AreaData* area = server->areas[current_area];
if (current_area->locked == SPECTATABLE && !current_area->invited.contains(id)) if (area->locked == AreaData::LockStatus::SPECTATABLE && !area->invited.contains(id))
// Non-invited players cannot speak in spectatable areas // Non-invited players cannot speak in spectatable areas
return invalid; return invalid;
@ -410,7 +410,6 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
// evidence // evidence
int evi_idx = incoming_args[11].toInt(); int evi_idx = incoming_args[11].toInt();
AreaData* area = server->areas[current_area];
if (evi_idx > area->evidence.length()) if (evi_idx > area->evidence.length())
return invalid; return invalid;
args.append(QString::number(evi_idx)); args.append(QString::number(evi_idx));