Merge pull request #179 from Salanto/Fix-#178

Set background in area data when /bg is used.
This commit is contained in:
Rose Witchaven 2021-08-09 11:18:54 -05:00 committed by GitHub
commit e84d9dc9ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -466,6 +466,13 @@ class AreaData : public QObject {
*/
QString background() const;
/**
* @brief Sets the background of the area.
*
* @see #AOClient::cmdSetBackground and #m_background
*/
void setBackground(const QString f_background);
/**
* @brief Returns if custom shownames are allowed in the area.
*

View File

@ -528,6 +528,11 @@ QString AreaData::background() const
return m_background;
}
void AreaData::setBackground(const QString f_background)
{
m_background = f_background;
}
bool AreaData::ignoreBgList()
{
return m_ignoreBgList;

View File

@ -251,7 +251,7 @@ void AOClient::cmdSetBackground(int argc, QStringList argv)
AreaData* area = server->areas[current_area];
if (authenticated || !area->bgLocked()) {
if (server->backgrounds.contains(argv[0], Qt::CaseInsensitive) || area->ignoreBgList() == true) {
area->background() = argv[0];
area->setBackground(argv[0]);
server->broadcast(AOPacket("BN", {argv[0]}), current_area);
sendServerMessageArea(current_char + " changed the background to " + argv[0]);
}