Skip to content

Commit

Permalink
Fixed|UI|Ring Zero: Keep MP sessions menu up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 13, 2014
1 parent 8868d0e commit f11e80c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doomsday/client/src/ui/widgets/mpsessionmenuwidget.cpp
Expand Up @@ -33,6 +33,7 @@
using namespace de;

DENG_GUI_PIMPL(MPSessionMenuWidget)
, DENG2_OBSERVES(App, GameChange)
, DENG2_OBSERVES(ServerLink, DiscoveryUpdate)
{
static ServerLink &link() { return ClientApp::serverLink(); }
Expand Down Expand Up @@ -154,18 +155,21 @@ DENG_GUI_PIMPL(MPSessionMenuWidget)
}
};

DiscoveryMode mode;
ServerLink::FoundMask mask;

Instance(Public *i)
: Base(i)
, mask(ServerLink::Any)
{
link().audienceForDiscoveryUpdate += this;
App::app().audienceForGameChange() += this;
}

~Instance()
{
link().audienceForDiscoveryUpdate -= this;
App::app().audienceForGameChange() -= this;
}

void linkDiscoveryUpdate(ServerLink const &link)
Expand Down Expand Up @@ -210,11 +214,23 @@ DENG_GUI_PIMPL(MPSessionMenuWidget)
emit self.availabilityChanged();
}
}

void currentGameChanged(game::Game const &newGame)
{
if(newGame.isNull() && mode == DiscoverUsingMaster)
{
// If the session menu exists across game changes, it's good to
// keep it up to date.
link().discoverUsingMaster();
}
}
};

MPSessionMenuWidget::MPSessionMenuWidget(DiscoveryMode discovery)
: SessionMenuWidget("mp-session-menu"), d(new Instance(this))
{
d->mode = discovery;

switch(discovery)
{
case DiscoverUsingMaster:
Expand Down

0 comments on commit f11e80c

Please sign in to comment.