Renamged NetworkWorld to RaceEventManager (since this class is

not a 'world' in the sense our game modes are).
This commit is contained in:
hiker
2016-02-11 09:03:51 +11:00
parent 99bc5477a2
commit 7e6711e163
19 changed files with 119 additions and 101 deletions

View File

@@ -1,5 +1,5 @@
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")

View File

@@ -30,7 +30,7 @@
#include "karts/abstract_kart.hpp"
#include "modes/linear_world.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "tracks/quad_graph.hpp"
#include "tracks/track.hpp"
#include "utils/string_utils.hpp"
@@ -320,7 +320,7 @@ void ItemManager::checkItemHit(AbstractKart* kart)
if((*i)->hitKart(kart->getXYZ(), kart))
{
// if we're not playing online, pick the item.
if (!NetworkWorld::getInstance()->isRunning())
if (!RaceEventManager::getInstance()->isRunning())
collectedItem(*i, kart);
else if (NetworkConfig::get()->isServer())
{
@@ -328,7 +328,7 @@ void ItemManager::checkItemHit(AbstractKart* kart)
// A client does the collection upon receiving the
// event from the server!
collectedItem(*i, kart);
NetworkWorld::getInstance()->collectedItem(*i, kart);
RaceEventManager::getInstance()->collectedItem(*i, kart);
}
} // if hit
} // for m_all_items

View File

@@ -37,7 +37,7 @@
#include "karts/rescue_animation.hpp"
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "race/history.hpp"
#include "states_screens/race_gui_base.hpp"
#include "utils/constants.hpp"
@@ -121,9 +121,9 @@ void LocalPlayerController::action(PlayerAction action, int value)
// If this is a client, send the action to the server
if (World::getWorld()->isNetworkWorld() &&
NetworkConfig::get()->isClient() &&
NetworkWorld::getInstance()->isRunning() )
RaceEventManager::getInstance()->isRunning() )
{
NetworkWorld::getInstance()->controllerAction(this, action, value);
RaceEventManager::getInstance()->controllerAction(this, action, value);
}
} // action

View File

@@ -58,7 +58,7 @@
#include "karts/skidding.hpp"
#include "modes/linear_world.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "physics/btKart.hpp"
#include "physics/btKartRaycast.hpp"
#include "physics/physics.hpp"
@@ -1393,7 +1393,7 @@ void Kart::update(float dt)
// Check if any item was hit.
// check it if we're not in a network world, or if we're on the server
// (when network mode is on)
if (!NetworkWorld::getInstance()->isRunning() ||
if (!RaceEventManager::getInstance()->isRunning() ||
NetworkConfig::get()->isServer())
ItemManager::get()->checkItemHit(this);

View File

@@ -32,7 +32,7 @@
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/protocol_manager.hpp"
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "network/stk_host.hpp"
#include "online/request_manager.hpp"
#include "race/race_manager.hpp"
@@ -121,8 +121,9 @@ void MainLoop::updateRace(float dt)
{
if(ProfileWorld::isProfileMode()) dt=1.0f/60.0f;
if (NetworkWorld::getInstance<NetworkWorld>()->isRunning())
NetworkWorld::getInstance<NetworkWorld>()->update(dt);
// The race event manager will update world in case of an online race
if (RaceEventManager::getInstance<RaceEventManager>()->isRunning())
RaceEventManager::getInstance<RaceEventManager>()->update(dt);
else
World::getWorld()->updateWorld(dt);
} // updateRace

View File

@@ -90,12 +90,8 @@ public:
/** Sets the password for a server. */
void setPassword(const std::string &password) { m_password = password; }
// ------------------------------------------------------------------------
/** Returns if the specified password is the correct password for this
* server. */
bool checkPassword(const std::string &password)
{
return m_password == password;
}
/** Returns the password. */
const std::string& getPassword() const { return m_password; }
// ------------------------------------------------------------------------
/** Return if a network setting is happening. A network setting is active
* if a host (server or client) exists. */

View File

@@ -21,10 +21,11 @@
#include "config/player_manager.hpp"
#include "modes/world_with_rank.hpp"
#include "network/event.hpp"
#include "network/network_config.hpp"
#include "network/network_player_profile.hpp"
#include "network/network_world.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "network/protocol_manager.hpp"
#include "network/race_event_manager.hpp"
#include "network/stk_host.hpp"
#include "network/stk_peer.hpp"
#include "online/online_profile.hpp"
@@ -242,9 +243,11 @@ void ClientLobbyRoomProtocol::update()
name = PlayerManager::getCurrentPlayer()->getName();
std::string name_u8 = StringUtils::wideToUtf8(name);
NetworkString ns(6+1+name_u8.size());
const std::string &password = NetworkConfig::get()->getPassword();
NetworkString ns(6+1+name_u8.size()+1+password.size());
// 4 (size of id), global id
ns.ai8(LE_CONNECTION_REQUESTED).encodeString(name);
ns.ai8(LE_CONNECTION_REQUESTED).encodeString(name)
.encodeString(NetworkConfig::get()->getPassword());
sendMessage(ns);
m_state = REQUESTING_CONNECTION;
}
@@ -266,7 +269,7 @@ void ClientLobbyRoomProtocol::update()
case PLAYING:
{
// race is now over, kill race protocols and return to connected state
if (NetworkWorld::getInstance<NetworkWorld>()->isRaceOver())
if (RaceEventManager::getInstance<RaceEventManager>()->isRaceOver())
{
Log::info("ClientLobbyRoomProtocol", "Game finished.");
m_state = RACE_FINISHED;
@@ -372,17 +375,17 @@ void ClientLobbyRoomProtocol::disconnectedPlayer(Event* event)
* \param event : Event providing the information.
*
* Format of the data :
* Byte 0 1 2 3 7 8
* ------------------------------------------------------------------
* Size | 1 | 1 | 1 | 4 | 1 | |
* Data | 1 | 0 <= race id < 16 | 4 | priv token | hostid | playernames* |
* ------------------------------------------------------------------
* Byte 0 1 2 3 7 8 9
* -----------------------------------------------------------------------------
* Size | 1 | 1 | 1 | 4 | 1 | 1 | |
* Data | 1 | 0 <= race id < 16 | 4 | priv token | hostid | authorised |playernames* |
* ------------------------------------------------------------------------------
*/
void ClientLobbyRoomProtocol::connectionAccepted(Event* event)
{
NetworkString &data = event->data();
// At least 12 bytes should remain now
if (data.size() < 8|| data[0] != 1 || data[2] != 4)
if (data.size() < 9|| data[0] != 1 || data[2] != 4)
{
Log::error("ClientLobbyRoomProtocol",
"A message notifying an accepted connection wasn't "
@@ -404,6 +407,10 @@ void ClientLobbyRoomProtocol::connectionAccepted(Event* event)
name = PlayerManager::getCurrentPlayer()->getName();
uint8_t my_player_id = data.getUInt8(1);
uint8_t my_host_id = data.getUInt8(7);
uint8_t authorised = data.getUInt8(8);
// Store this client's authorisation status in the peer information
// for the server.
event->getPeer()->setAuthorised(authorised!=0);
STKHost::get()->setMyHostId(my_host_id);
NetworkPlayerProfile* profile = new NetworkPlayerProfile(my_player_id, name);
@@ -416,7 +423,7 @@ void ClientLobbyRoomProtocol::connectionAccepted(Event* event)
// Add all players
// ===============
int n = 8;
int n = 9;
while (n < data.size())
{
if (data[n] != 1 )

View File

@@ -25,7 +25,6 @@
#include "network/network_player_profile.hpp"
#include "network/game_setup.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/protocol_manager.hpp"
#include "network/stk_host.hpp"
#include "network/stk_peer.hpp"

View File

@@ -5,7 +5,6 @@
#include "modes/world.hpp"
#include "network/event.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/protocol_manager.hpp"
#include "utils/time.hpp"

View File

@@ -23,12 +23,12 @@
#include "modes/world.hpp"
#include "network/event.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/network_player_profile.hpp"
#include "network/protocols/get_public_address.hpp"
#include "network/protocols/connect_to_peer.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "network/protocol_manager.hpp"
#include "network/race_event_manager.hpp"
#include "network/stk_host.hpp"
#include "network/stk_peer.hpp"
#include "online/online_profile.hpp"
@@ -146,7 +146,7 @@ void ServerLobbyRoomProtocol::update()
if(NetworkConfig::get()->isWAN())
checkIncomingConnectionRequests();
if (m_in_race && World::getWorld() &&
NetworkWorld::getInstance<NetworkWorld>()->isRunning())
RaceEventManager::getInstance<RaceEventManager>()->isRunning())
{
checkRaceFinished();
}
@@ -241,7 +241,7 @@ void ServerLobbyRoomProtocol::startGame()
*/
void ServerLobbyRoomProtocol::startSelection(const Event *event)
{
if(event && !STKHost::get()->isAuthorisedToControl(event->getPeer()))
if(event && !event->getPeer()->isAuthorised())
{
Log::warn("ServerLobby",
"Client %lx is not authorised to start selection.",
@@ -313,10 +313,10 @@ void ServerLobbyRoomProtocol::checkIncomingConnectionRequests()
void ServerLobbyRoomProtocol::checkRaceFinished()
{
assert(NetworkWorld::getInstance()->isRunning());
assert(RaceEventManager::getInstance()->isRunning());
assert(World::getWorld());
// if race is over, give the final score to everybody
if (NetworkWorld::getInstance()->isRaceOver())
if (RaceEventManager::getInstance()->isRaceOver())
{
// calculate karts ranks :
int num_players = race_manager->getNumberOfKarts();
@@ -381,7 +381,7 @@ void ServerLobbyRoomProtocol::checkRaceFinished()
"No game events protocol registered.");
// notify the network world that it is stopped
NetworkWorld::getInstance()->stop();
RaceEventManager::getInstance()->stop();
// exit the race now
race_manager->exitRace();
race_manager->setAIKartOverride("");
@@ -445,8 +445,11 @@ void ServerLobbyRoomProtocol::connectionRequested(Event* event)
// Connection accepted.
// ====================
std::string name_u8;
data.decodeString(0, &name_u8);
int len = data.decodeString(0, &name_u8);
core::stringw name = StringUtils::utf8ToWide(name_u8);
std::string password;
data.decodeString(len, &password);
bool is_authorised = (password==NetworkConfig::get()->getPassword());
// Get the unique global ID for this player.
m_next_player_id.lock();
@@ -480,10 +483,10 @@ void ServerLobbyRoomProtocol::connectionRequested(Event* event)
const std::vector<NetworkPlayerProfile*> &players = m_setup->getPlayers();
// send a message to the one that asked to connect
// Size is overestimated, probably one player's data will not be sent
NetworkString message_ack(13 + players.size() * 7);
NetworkString message_ack(14 + players.size() * 7);
// connection success -- size of token -- token
message_ack.ai8(LE_CONNECTION_ACCEPTED).ai8(1).ai8(new_player_id).ai8(4)
.ai32(token).addUInt8(new_host_id);
.ai32(token).addUInt8(new_host_id).addUInt8(is_authorised);
// Add all players so that this user knows (this new player is only added
// to the list of players later, so the new player's info is not included)
for (unsigned int i = 0; i < players.size(); i++)
@@ -499,6 +502,7 @@ void ServerLobbyRoomProtocol::connectionRequested(Event* event)
m_setup->addPlayer(profile);
peer->setPlayerProfile(profile);
peer->setClientServerToken(token);
peer->setAuthorised(is_authorised);
peer->setHostId(new_host_id);
Log::verbose("ServerLobbyRoomProtocol", "New player.");

View File

@@ -10,7 +10,7 @@
#include "network/game_setup.hpp"
#include "network/network_config.hpp"
#include "network/network_player_profile.hpp"
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "network/protocol_manager.hpp"
#include "network/protocols/synchronization_protocol.hpp"
#include "network/stk_host.hpp"
@@ -58,7 +58,7 @@ void StartGameProtocol::setup()
// Race startup sequence
// ---------------------
// This creates the network world.
NetworkWorld::getInstance<NetworkWorld>()->start();
RaceEventManager::getInstance<RaceEventManager>()->start();
// The number of karts includes the AI karts, which are not supported atn
race_manager->setNumKarts(m_game_setup->getPlayerCount());

View File

@@ -1,4 +1,5 @@
#include "network/network_world.hpp"
#include "network/race_event_manager.hpp"
#include "network/network_config.hpp"
#include "network/protocol_manager.hpp"
@@ -8,19 +9,19 @@
#include "modes/world.hpp"
NetworkWorld::NetworkWorld()
RaceEventManager::RaceEventManager()
{
m_running = false;
} // NetworkWorld
} // RaceEventManager
// ----------------------------------------------------------------------------
#include "karts/controller/controller.hpp"
NetworkWorld::~NetworkWorld()
RaceEventManager::~RaceEventManager()
{
} // ~NetworkWorld
} // ~RaceEventManager
// ----------------------------------------------------------------------------
void NetworkWorld::update(float dt)
void RaceEventManager::update(float dt)
{
// This can happen in case of disconnects - protocol manager is
// shut down, but still events to process.
@@ -31,7 +32,7 @@ void NetworkWorld::update(float dt)
ProtocolManager::getInstance()->getProtocol(PROTOCOL_SYNCHRONIZATION));
if (protocol) // if this protocol exists, that's that we play online
{
Log::debug("NetworkWorld", "Coutdown value is %f",
Log::debug("RaceEventManager", "Coutdown value is %f",
protocol->getCountdown());
if (protocol->getCountdown() > 0.0)
{
@@ -46,24 +47,24 @@ void NetworkWorld::update(float dt)
{
// consider the world finished.
stop();
Log::info("NetworkWorld", "The game is considered finish.");
Log::info("RaceEventManager", "The game is considered finish.");
}
} // update
// ----------------------------------------------------------------------------
void NetworkWorld::start()
void RaceEventManager::start()
{
m_running = true;
} // start
// ----------------------------------------------------------------------------
void NetworkWorld::stop()
void RaceEventManager::stop()
{
m_running = false;
} // stop
// ----------------------------------------------------------------------------
bool NetworkWorld::isRaceOver()
bool RaceEventManager::isRaceOver()
{
if(!World::getWorld())
return false;
@@ -76,7 +77,7 @@ bool NetworkWorld::isRaceOver()
* \param item The item that was collected.
* \param kart The kart that collected the item.
*/
void NetworkWorld::collectedItem(Item *item, AbstractKart *kart)
void RaceEventManager::collectedItem(Item *item, AbstractKart *kart)
{
// this is only called in the server
assert(NetworkConfig::get()->isServer());
@@ -87,7 +88,7 @@ void NetworkWorld::collectedItem(Item *item, AbstractKart *kart)
} // collectedItem
// ----------------------------------------------------------------------------
void NetworkWorld::controllerAction(Controller* controller,
void RaceEventManager::controllerAction(Controller* controller,
PlayerAction action, int value)
{
ControllerEventsProtocol* protocol = static_cast<ControllerEventsProtocol*>(

View File

@@ -34,16 +34,16 @@ class Item;
/*! \brief Manages the world updates during an online game
* This function's update is to be called instead of the normal World update
*/
class NetworkWorld : public AbstractSingleton<NetworkWorld>
class RaceEventManager : public AbstractSingleton<RaceEventManager>
{
private:
bool m_running;
float m_race_time;
friend class AbstractSingleton<NetworkWorld>;
friend class AbstractSingleton<RaceEventManager>;
NetworkWorld();
virtual ~NetworkWorld();
RaceEventManager();
virtual ~RaceEventManager();
public:
void update(float dt);

View File

@@ -492,33 +492,21 @@ int STKHost::mustStopListening()
return 1;
} // mustStopListening
// --------------------------------------------------------------------
/** Returns true if this instance is allowed to control the server.
* Only the first connected client (i.e. the one with host id 1) is
* allowed to control the server. Only called from a client.
// ----------------------------------------------------------------------------
/** Returns true if this client instance is allowed to control the server.
* A client can authorise itself by providing the server's password. It is
* then allowed to control the server (e.g. start kart selection).
* The information if this client was authorised by the server is actually
* stored in the peer (which is the server peer on a client).
*/
bool STKHost::isAuthorisedToControl() const
{
assert(NetworkConfig::get()->isClient());
// If we are not properly connected (i.e. only enet connection, but not
// stk logic), no peer is authorised.
if(m_peers.size()==0)
return false;
return m_host_id == 1;
} // isAuthorisedToControl
// ----------------------------------------------------------------------------
/** Server-side check if the client sending a command is really authorised
* to do so. Only the first connected client (i.e. host id = 1) is allowed
* to control the server.
* \param peer Peer sending the command.
*/
bool STKHost::isAuthorisedToControl(const STKPeer *peer) const
{
// If we are not properly connected (i.e. only enet connection, but not
// stk logic), no peer is authorised.
if(m_peers.size()==0)
return false;
return peer->getHostId()==1;
return m_peers[0]->isAuthorised();
} // isAuthorisedToControl
// ----------------------------------------------------------------------------

View File

@@ -162,7 +162,6 @@ public:
uint16_t getPort() const;
void setErrorMessage(const irr::core::stringw &message);
bool isAuthorisedToControl() const;
bool isAuthorisedToControl(const STKPeer *peer) const;
const irr::core::stringw&
getErrorMessage() const;

View File

@@ -30,6 +30,7 @@
STKPeer::STKPeer(ENetPeer *enet_peer)
{
m_enet_peer = enet_peer;
m_is_authorised = false;
m_player_profile = NULL;
m_client_server_token = 0;
m_host_id = 0;

View File

@@ -52,6 +52,9 @@ protected:
/** Host id of this peer. */
int m_host_id;
/** True if this peer is authorised to control a server. */
bool m_is_authorised;
public:
STKPeer(ENetPeer *enet_peer);
virtual ~STKPeer();
@@ -97,6 +100,16 @@ public:
// ------------------------------------------------------------------------
/** Returns the host id of this peer. */
int getHostId() const { return m_host_id; }
// ------------------------------------------------------------------------
/** Sets if this peer is authorised to control the server. */
void setAuthorised(bool authorised) { m_is_authorised = authorised; }
// ------------------------------------------------------------------------
/** Returns if this peer is authorised to control the server. The server
* uses this to check if a peer is allowed certain commands; and a client
* uses this function (in which case this peer is actually the server
* peer) to see if this client is allowed certain command (i.e. to
* display additional GUI elements). */
bool isAuthorised() const { return m_is_authorised; }
}; // STKPeer
#endif // STK_PEER_HPP

View File

@@ -45,8 +45,8 @@
#include "modes/soccer_world.hpp"
#include "network/protocol_manager.hpp"
#include "network/network_config.hpp"
#include "network/network_world.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "network/race_event_manager.hpp"
#include "scriptengine/property_animator.hpp"
#include "states_screens/grand_prix_cutscene.hpp"
#include "states_screens/grand_prix_lose.hpp"
@@ -318,7 +318,7 @@ void RaceManager::startNew(bool from_overworld)
m_num_laps = m_grand_prix.getLaps();
m_reverse_track = m_grand_prix.getReverse();
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning())
if (!RaceEventManager::getInstance<RaceEventManager>()->isRunning())
{
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
@@ -362,7 +362,8 @@ void RaceManager::startNew(bool from_overworld)
Log::verbose("RaceManager", "Nb of karts=%u, ai:%lu players:%lu\n",
(unsigned int) m_num_karts, m_ai_kart_list.size(), m_player_karts.size());
assert((unsigned int)m_num_karts == m_ai_kart_list.size()+m_player_karts.size());
assert((unsigned int)m_num_karts == m_ai_kart_list.size()
+ m_player_karts.size() );
// First add the AI karts (randomly chosen)
// ----------------------------------------
@@ -441,8 +442,8 @@ void RaceManager::startNextRace()
IrrlichtDevice* device = irr_driver->getDevice();
GUIEngine::renderLoading();
device->getVideoDriver()->endScene();
device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140));
device->getVideoDriver()->beginScene(true, true,
video::SColor(255,100,101,140));
m_num_finished_karts = 0;
m_num_finished_players = 0;
@@ -556,7 +557,8 @@ void RaceManager::next()
m_track_number++;
if(m_track_number<(int)m_tracks.size())
{
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && !NetworkWorld::getInstance()->isRunning())
if( m_major_mode==MAJOR_MODE_GRAND_PRIX &&
!RaceEventManager::getInstance()->isRunning() )
{
// Saving GP state
saveGP();
@@ -601,7 +603,8 @@ void RaceManager::saveGP()
{
// Delete other save files (and random GP, which should never
// have been saved in the first place)
const SavedGrandPrix &sgp = UserConfigParams::m_saved_grand_prix_list[i];
const SavedGrandPrix &sgp =
UserConfigParams::m_saved_grand_prix_list[i];
if (sgp.getGPID() == "random" ||
(sgp.getGPID() == m_saved_gp->getGPID() &&
sgp.getDifficulty() == m_saved_gp->getDifficulty()) )
@@ -679,9 +682,10 @@ void RaceManager::computeGPRanks()
sort_data.push_back(sd);
if(UserConfigParams::m_ftl_debug)
{
Log::debug("Race Manager","[ftl] kart '%s' has position %d score %d.",
World::getWorld()->getKart(kart_id)->getIdent().c_str(),
sd->m_position, sd->m_score);
Log::debug("Race Manager",
"[ftl] kart '%s' has position %d score %d.",
World::getWorld()->getKart(kart_id)->getIdent().c_str(),
sd->m_position, sd->m_score);
}
}
@@ -710,10 +714,12 @@ void RaceManager::exitRace(bool delete_world)
{
// Only display the grand prix result screen if all tracks
// were finished, and not when a race is aborted.
if (m_major_mode==MAJOR_MODE_GRAND_PRIX && m_track_number==(int)m_tracks.size())
if ( m_major_mode==MAJOR_MODE_GRAND_PRIX &&
m_track_number==(int)m_tracks.size() )
{
PlayerManager::getCurrentPlayer()->grandPrixFinished();
if(m_major_mode==MAJOR_MODE_GRAND_PRIX&& !NetworkWorld::getInstance()->isRunning())
if( m_major_mode==MAJOR_MODE_GRAND_PRIX &&
!RaceEventManager::getInstance()->isRunning() )
{
if(m_saved_gp != NULL)
m_saved_gp->remove();
@@ -726,7 +732,8 @@ void RaceManager::exitRace(bool delete_world)
const int loserThreshold = 3;
std::string winners[3];
std::vector<std::string> humanLosers; // because we don't care about AIs that lost
// because we don't care about AIs that lost
std::vector<std::string> humanLosers;
for (unsigned int i=0; i < kart_status_count; ++i)
{
if(UserConfigParams::logMisc())
@@ -769,14 +776,16 @@ void RaceManager::exitRace(bool delete_world)
if (some_human_player_won)
{
race_manager->startSingleRace("gpwin", 999, race_manager->raceWasStartedFromOverworld());
race_manager->startSingleRace("gpwin", 999,
race_manager->raceWasStartedFromOverworld());
GrandPrixWin* scene = GrandPrixWin::getInstance();
scene->push();
scene->setKarts(winners);
}
else
{
race_manager->startSingleRace("gplose", 999, race_manager->raceWasStartedFromOverworld());
race_manager->startSingleRace("gplose", 999,
race_manager->raceWasStartedFromOverworld());
GrandPrixLose* scene = GrandPrixLose::getInstance();
scene->push();
@@ -830,7 +839,8 @@ void RaceManager::kartFinishedRace(const AbstractKart *kart, float time)
m_kart_status[id].m_score += wwr->getScoreForPosition(pos);
else
{
Log::error("RaceManager", "World with scores that is not a WorldWithRank??");
Log::error("RaceManager",
"World with scores that is not a WorldWithRank??");
}
m_kart_status[id].m_overall_time += time;
@@ -891,7 +901,9 @@ void RaceManager::startSingleRace(const std::string &track_ident,
setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
setCoinTarget( 0 ); // Might still be set from a previous challenge
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning()) // if not in a network world
// if not in a network world, setup player karts
if (!RaceEventManager::getInstance<RaceEventManager>()->isRunning())
race_manager->setupPlayerKartInfo(); // do this setup player kart
startNew(from_overworld);

View File

@@ -490,12 +490,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
"\"Connect to the Internet\"."));
return;
}
if(1)
// if (PlayerManager::getCurrentOnlineId())
if (PlayerManager::getCurrentOnlineId())
{
// For 0.8.2 disable the server menu, instead go to online profile
#define ENABLE_NETWORK_MULTIPLAYER_SCREEN
#ifdef ENABLE_NETWORK_MULTIPLAYER_SCREEN
#ifdef ENABLE_NETWORK_MULTIPLAYER_SCREEN
OnlineScreen::getInstance()->push();
#else
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());