Make all unused boxes in the voting GUI invisible.
This commit is contained in:
parent
4b74c673fe
commit
386dc279fd
@ -678,6 +678,7 @@ void ClientLobby::updatePlayerList(Event* event)
|
||||
m_total_players = total_players;
|
||||
|
||||
NetworkingLobby::getInstance()->updatePlayers(players);
|
||||
VoteOverview::getInstance()->updateNumPlayers(players.size());
|
||||
} // updatePlayerList
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -41,8 +41,9 @@ using namespace irr::video;
|
||||
// -----------------------------------------------------------------------------
|
||||
VoteOverview::VoteOverview() : Screen("online/vote_overview.stkgui")
|
||||
{
|
||||
m_quit_server = false;
|
||||
m_timer = NULL;
|
||||
m_quit_server = false;
|
||||
m_timer = NULL;
|
||||
m_max_num_votes = 0;
|
||||
} // VoteOverview
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -98,11 +99,10 @@ void VoteOverview::init()
|
||||
std::string s = StringUtils::insertValues("rect-box%d", i);
|
||||
Widget *box = getWidget(s.c_str());
|
||||
box->setSelected(PLAYER_ID_GAME_MASTER, false);
|
||||
box->setVisible(true);
|
||||
// TODO: Doesn't work, player count appears to be 0
|
||||
// box->setVisible(i < lp->getGameSetup()->getPlayerCount());
|
||||
box->setVisible(i < m_max_num_votes);
|
||||
|
||||
// Make sure all track images are invisible
|
||||
// Make sure all track images are invisible initially (till we
|
||||
// receive a vote), otherwise a "?" is shown
|
||||
s = StringUtils::insertValues("track-%d", i);
|
||||
IconButtonWidget *track_widget = getWidget<IconButtonWidget>(s.c_str());
|
||||
track_widget->setVisible(false);
|
||||
@ -117,6 +117,13 @@ void VoteOverview::tearDown()
|
||||
m_quit_server = false;
|
||||
} // tearDown
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void VoteOverview::updateNumPlayers(int n)
|
||||
{
|
||||
m_max_num_votes = n;
|
||||
|
||||
} //updateNumPlayers
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Selects in which part of the grid the new host is being shown and stores
|
||||
* this information in the m_index_to_hostid mapping. If the host_id is
|
||||
|
@ -52,6 +52,9 @@ private:
|
||||
/** Index of the winning vote. */
|
||||
int m_winning_index;
|
||||
|
||||
/** Maximum number of votes, as sent by the server. */
|
||||
unsigned int m_max_num_votes;
|
||||
|
||||
bool m_quit_server;
|
||||
|
||||
/* A timer used to randomly select tracks. */
|
||||
@ -88,6 +91,7 @@ public:
|
||||
void showVote(int host_id);
|
||||
void showVoteResult();
|
||||
void setResult(const PeerVote &winner_vote);
|
||||
void updateNumPlayers(int n);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
void setQuitServer() { m_quit_server = true; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user