Merge pull request #192 from Salanto/fix-#191

Allow spaces to be contained in background names
This commit is contained in:
Rosemary Witchaven 2021-08-21 05:00:36 -05:00 committed by GitHub
commit 958752ef0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,12 +254,13 @@ void AOClient::cmdAreaKick(int argc, QStringList argv)
void AOClient::cmdSetBackground(int argc, QStringList argv)
{
QString f_background = argv.join(" ");
AreaData* area = server->areas[current_area];
if (authenticated || !area->bgLocked()) {
if (server->backgrounds.contains(argv[0], Qt::CaseInsensitive) || area->ignoreBgList() == true) {
area->setBackground(argv[0]);
server->broadcast(AOPacket("BN", {argv[0]}), current_area);
sendServerMessageArea(current_char + " changed the background to " + argv[0]);
if (server->backgrounds.contains(f_background, Qt::CaseInsensitive) || area->ignoreBgList() == true) {
area->setBackground(f_background);
server->broadcast(AOPacket("BN", {f_background}), current_area);
sendServerMessageArea(current_char + " changed the background to " + f_background);
}
else {
sendServerMessage("Invalid background name.");