Fixed displaying two different texts while waiting for

network connections and while loading the actual track.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2224 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2008-09-07 13:27:38 +00:00
parent e8f6f0f708
commit e438565c62
2 changed files with 24 additions and 14 deletions

View File

@@ -54,19 +54,28 @@ void StartRaceFeedback::update(float DELTA)
{
widget_manager->update(0.0f);
// Now the text is being displayed,
if(m_state==SRF_NETWORK)
// We need one call to update to display the current text. So we use a
// simple finite state machine to take care of one additional call:
switch(m_state)
{
if(network_manager->getMode()==NetworkManager::NW_SERVER)
network_manager->sendRaceInformationToClients();
else
network_manager->waitForRaceInformation();
m_state = SRF_LOADING;
widget_manager->setWgtText(WTOK_MSG, _("Loading race...") );
}
case SRF_LOADING_DISPLAY:
m_state=SRF_LOADING;
break;
case SRF_NETWORK_DISPLAY:
m_state = SRF_NETWORK;
break;
case SRF_NETWORK:
if(network_manager->getMode()==NetworkManager::NW_SERVER)
network_manager->sendRaceInformationToClients();
else
network_manager->waitForRaceInformation();
m_state = SRF_LOADING_DISPLAY;
widget_manager->setWgtText(WTOK_MSG, _("Loading race...") );
break;
case SRF_LOADING:
race_manager->startNew();
break;
} // switch m_state
static bool updated=false;
if( updated == true ) race_manager->startNew();
else updated = true;
}
} // update

View File

@@ -22,7 +22,8 @@
class StartRaceFeedback: public BaseGUI
{
enum {SRF_NETWORK, SRF_LOADING} m_state;
enum {SRF_NETWORK_DISPLAY, SRF_NETWORK,
SRF_LOADING_DISPLAY, SRF_LOADING} m_state;
public:
StartRaceFeedback();
~StartRaceFeedback();