Bugfix: removed ghost characters that appeared when using challenges.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2635 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2008-12-12 03:55:27 +00:00
parent ffdfc83dcd
commit b27e113048
4 changed files with 12 additions and 8 deletions

View File

@@ -17,11 +17,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gui/challenges_menu.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "unlock_manager.hpp"
#include "translation.hpp"
#include "gui/challenges_menu.hpp"
#include "network/network_manager.hpp"
enum WidgetTokens
{
@@ -84,6 +85,7 @@ void ChallengesMenu::select()
int n=widget_manager->getSelectedWgt()-WTOK_CHALLENGES;
if(n>=0 && n<(int)m_all_challenges.size())
{
network_manager->initCharacterDataStructures();
m_all_challenges[n]->setRace();
menu_manager->pushMenu(MENUID_START_RACE_FEEDBACK);
}

View File

@@ -57,14 +57,13 @@ CharSel::CharSel(int whichPlayer)
{
// First time this is called --> switch client and server
// to character barrier mode
// FIXME: switchTo ... must be called to clean the kart_info
// in the server (even when NW_NONE). This if condition
// needs to be checked (otherwise ghost karts and
// a ghost camera will appear)
// initCharacter ... must be called to clean the kart_info
// in the server (even when NW_NONE), otherwise ghost karts
// etc. can appear.
m_first_frame = true;
if(network_manager->getState()==NetworkManager::NS_MAIN_MENU ||
network_manager->getMode()==NetworkManager::NW_NONE)
network_manager->switchToCharacterSelection();
network_manager->initCharacterDataStructures();
// For some strange reasons plib calls makeCurrent() in ssgContext
// constructor, so we have to save the old one here and restore it

View File

@@ -437,7 +437,10 @@ void NetworkManager::sendToServer(Message &m)
} // sendToServer
// ----------------------------------------------------------------------------
void NetworkManager::switchToCharacterSelection()
/** Cleans up character related data structures. Must be called before any
* character related data is set.
*/
void NetworkManager::initCharacterDataStructures()
{
// This is called the first time the character selection menu is displayed

View File

@@ -103,7 +103,7 @@ public:
void disableNetworking();
void sendConnectMessage(); // client send initial info to server
void switchToCharacterSelection();
void initCharacterDataStructures();
void sendCharacterSelected(int player_id, const std::string &kartid);
void waitForRaceInformation();
void worldLoaded();