Code simplification.

This commit is contained in:
hiker 2016-01-14 08:05:40 +11:00
parent b0571e419a
commit e70017a1a6
3 changed files with 15 additions and 9 deletions

View File

@ -18,6 +18,7 @@
#include "network/network_player_profile.hpp"
#include "network/stk_host.hpp"
#include "online/online_player_profile.hpp"
/** Constructor.
@ -39,3 +40,12 @@ NetworkPlayerProfile::NetworkPlayerProfile(int global_player_id,
NetworkPlayerProfile::~NetworkPlayerProfile()
{
} // ~NetworkPlayerProfile
// ----------------------------------------------------------------------------
/** Returns true if this player is local, i.e. running on this computer. This
* is done by comparing the host id of this player with the host id of this
* computer.
*/
bool NetworkPlayerProfile::isLocalPlayer() const
{
return m_host_id == STKHost::get()->getMyHostId();
} // isLocalPlayer

View File

@ -60,6 +60,7 @@ public:
NetworkPlayerProfile(int global_player_id,
const irr::core::stringw &name);
~NetworkPlayerProfile();
bool isLocalPlayer() const;
// ------------------------------------------------------------------------
/** Sets the global player id of this player. */

View File

@ -1205,15 +1205,10 @@ void KartSelectionScreen::allPlayersDone()
// ---- Switch to assign mode
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
if (!m_multiplayer)
{
input_manager->getDeviceManager()
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
}
else
{
input_manager->getDeviceManager()->setSinglePlayer( NULL );
}
StateManager::ActivePlayer *ap = m_multiplayer
? NULL
: StateManager::get()->getActivePlayer(0);
input_manager->getDeviceManager()->setSinglePlayer(ap);
// ---- Go to next screen or return to overworld
if (m_from_overworld || m_go_to_overworld_next)