Disabled karts on clients that are not available (i.e. do not exist
on all clients). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2259 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -309,9 +309,12 @@ void CharSel::update(float dt)
|
||||
static bool first=true;
|
||||
if(first)
|
||||
{
|
||||
// Switch group will update the list of selected karts, i.e. use the
|
||||
// information about kart availability just received from the server
|
||||
switchGroup();
|
||||
// Now hide the message window and display the widgets:
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
widget_manager->showWgt(WTOK_TITLE, WTOK_EMPTY_DOWN);
|
||||
widget_manager->showWgt(WTOK_TITLE, WTOK_DOWN);
|
||||
// Hide all widgets except the message widget
|
||||
for (unsigned int i = 0; i < m_max_entries; i++)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef HEADER_CHARACTER_INFO_MESSAGE_H
|
||||
#define HEADER_CHARACTER_INFO_MESSAGE_H
|
||||
|
||||
#include "kart_properties_manager.hpp"
|
||||
#include "network/message.hpp"
|
||||
|
||||
/** This message is sent from the server to the clients and contains the list
|
||||
@@ -31,14 +31,20 @@ class CharacterInfoMessage : public Message
|
||||
public:
|
||||
CharacterInfoMessage(int hostid) : Message(Message::MT_CHARACTER_INFO)
|
||||
{
|
||||
allocate(getCharLength());
|
||||
std::vector<std::string> all_karts =
|
||||
kart_properties_manager->getAllAvailableKarts();
|
||||
allocate(getCharLength()+getStringVectorLength(all_karts));
|
||||
addChar(hostid);
|
||||
addStringVector(all_karts);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
CharacterInfoMessage(ENetPacket* pkt):Message(pkt, MT_CHARACTER_INFO)
|
||||
{
|
||||
int hostid=getChar();
|
||||
network_manager->setHostId(hostid);
|
||||
std::vector<std::string> all_karts;
|
||||
all_karts = getStringVector();
|
||||
kart_properties_manager->setUnavailableKarts(all_karts);
|
||||
}
|
||||
}; // CharacterInfoMessage
|
||||
#endif
|
||||
|
||||
@@ -47,15 +47,17 @@ public:
|
||||
// Piggy backing this information saves sending it as a separate
|
||||
// message. It is actually only required in the first message
|
||||
addChar(race_manager->getNumLocalPlayers());
|
||||
}
|
||||
} // CharacterSelectedMessage
|
||||
// ------------------------------------------------------------------------
|
||||
CharacterSelectedMessage(ENetPacket* pkt):Message(pkt, MT_CHARACTER_INFO)
|
||||
{
|
||||
m_kart_info.setLocalPlayerId(getChar());
|
||||
m_kart_info.setKartName(getString());
|
||||
m_kart_info.setPlayerName(getString());
|
||||
m_num_local_players = getChar();
|
||||
}
|
||||
} // CharacterSelectedMessage(EnetPacket)
|
||||
// ------------------------------------------------------------------------
|
||||
const RemoteKartInfo& getKartInfo () const { return m_kart_info; }
|
||||
int getNumPlayers() const { return m_num_local_players; }
|
||||
}; // CharacterInfoMessage
|
||||
}; // CharacterSelectedMessage
|
||||
#endif
|
||||
|
||||
@@ -414,7 +414,6 @@ void NetworkManager::worldLoaded()
|
||||
}
|
||||
} // worldLoaded
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Receive and store the information from sendKartsInformation()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user