interface: only allow online if world is online

Dieser Commit ist enthalten in:
Reinder Feenstra 2022-02-10 21:24:16 +01:00
Ursprung 7b08bfcdcd
Commit 1f633674ee

Datei anzeigen

@ -46,6 +46,7 @@ Interface::Interface(const std::weak_ptr<World>& world, std::string_view _id)
m_interfaceItems.add(name);
Attributes::addDisplayName(online, DisplayName::Interface::online);
Attributes::addEnabled(online, w && contains(w->state.value(), WorldState::Online));
m_interfaceItems.add(online);
Attributes::addDisplayName(status, DisplayName::Interface::status);
@ -81,9 +82,11 @@ void Interface::worldEvent(WorldState state, WorldEvent event)
{
case WorldEvent::Offline:
online = false;
Attributes::setEnabled(online, false);
break;
case WorldEvent::Online:
Attributes::setEnabled(online, true);
online = true;
break;