diff --git a/src/aoclient.cpp b/src/aoclient.cpp index c0d8e99..af34da1 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -103,10 +103,11 @@ void AOClient::changeArea(int new_area) sendServerMessage("You are already in area " + server->area_names[current_area]); 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."); return; } + if (current_char != "") { server->areas[current_area]->characters_taken[current_char] = false; @@ -129,7 +130,9 @@ void AOClient::changeArea(int new_area) server->areas[current_area]->characters_taken[current_char] = true; 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) @@ -175,13 +178,13 @@ void AOClient::arup(ARUPType type, bool broadcast) else if (type == ARUPType::LOCKED) { QString lock_status; switch (area->locked) { - case FREE: + case AreaData::LockStatus::FREE: lock_status = "FREE"; break; - case LOCKED: + case AreaData::LockStatus::LOCKED: lock_status = "LOCKED"; break; - case SPECTATABLE: + case AreaData::LockStatus::SPECTATABLE: lock_status = "SPECTATABLE"; break; default: diff --git a/src/commands.cpp b/src/commands.cpp index 43b3cda..2d31aba 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -508,12 +508,12 @@ void AOClient::cmdLock(int argc, QStringList argv) sendServerMessage("You are not a CM in this area."); return; } - else if (area->locked == LOCKED) { + else if (area->locked == AreaData::LockStatus::LOCKED) { sendServerMessage("This area is already locked."); return; } sendServerMessage("This area is now locked."); - area->locked = LOCKED; + area->locked = AreaData::LockStatus::LOCKED; for (AOClient* client : server->clients) { if (client->current_area == current_area && client->joined) { 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."); return; } - else if (area->locked == SPECTATABLE) { + else if (area->locked == AreaData::LockStatus::SPECTATABLE) { sendServerMessage("This area is already in spectate mode."); return; } sendServerMessage("This area is now spectatable."); - area->locked = SPECTATABLE; + area->locked = AreaData::LockStatus::SPECTATABLE; for (AOClient* client : server->clients) { if (client->current_area == current_area && client->joined) { 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."); return; } - else if (area->locked == FREE) { + else if (area->locked == AreaData::LockStatus::FREE) { sendServerMessage("This area is not locked."); return; } sendServerMessage("This area is now unlocked."); - area->locked = FREE; + area->locked = AreaData::LockStatus::FREE; arup(ARUPType::LOCKED, true); } diff --git a/src/packets.cpp b/src/packets.cpp index 464d9c4..33e9ca9 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -318,8 +318,8 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) if (current_char == "" || !joined) // Spectators cannot use IC return invalid; - - if (current_area->locked == SPECTATABLE && !current_area->invited.contains(id)) + AreaData* area = server->areas[current_area]; + if (area->locked == AreaData::LockStatus::SPECTATABLE && !area->invited.contains(id)) // Non-invited players cannot speak in spectatable areas return invalid; @@ -410,7 +410,6 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) // evidence int evi_idx = incoming_args[11].toInt(); - AreaData* area = server->areas[current_area]; if (evi_idx > area->evidence.length()) return invalid; args.append(QString::number(evi_idx));