Removed OnlineProfile from ActivePlayer, since it was not used at all.

This commit is contained in:
hiker
2014-05-31 10:26:02 +10:00
parent a0ee4d0bc5
commit e39f2164b5
11 changed files with 22 additions and 41 deletions

View File

@@ -403,7 +403,7 @@ void setupRaceStart()
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(
PlayerManager::get()->getPlayer(0), device, NULL);
PlayerManager::get()->getPlayer(0), device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{

View File

@@ -142,7 +142,7 @@ bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
// Use keyboard 0 by default in --no-start-screen
device = input_manager->getDeviceList()->getKeyboard(0);
StateManager::get()->createActivePlayer(
PlayerManager::get()->getPlayer(0), device , NULL);
PlayerManager::get()->getPlayer(0), device);
// ASSIGN should make sure that only input from assigned devices
// is read.
input_manager->getDeviceList()->setAssignMode(ASSIGN);

View File

@@ -67,7 +67,7 @@ void OverWorld::enterOverWorld()
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
device, NULL);
device);
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
{

View File

@@ -824,7 +824,7 @@ void World::updateWorld(float dt)
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
device, NULL);
device);
if (!kart_properties_manager->getKart(UserConfigParams::m_default_kart))
{

View File

@@ -122,7 +122,7 @@ void StartGameProtocol::update()
if (StateManager::get()->getActivePlayers().size() >= 1) // more than one player, we're the first
new_player_id = 0;
else
new_player_id = StateManager::get()->createActivePlayer( profile_to_use, device , players[i]->user_profile);
new_player_id = StateManager::get()->createActivePlayer( profile_to_use, device);
device->setPlayer(StateManager::get()->getActivePlayer(new_player_id));
input_manager->getDeviceList()->setSinglePlayer(StateManager::get()->getActivePlayer(new_player_id));
@@ -147,7 +147,7 @@ void StartGameProtocol::update()
if (!is_me)
{
StateManager::get()->createActivePlayer( NULL, NULL , players[i]->user_profile);
StateManager::get()->createActivePlayer( NULL, NULL );
race_manager->setPlayerKart(i, rki);
}

View File

@@ -67,7 +67,7 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
device, NULL);
device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{

View File

@@ -1063,11 +1063,11 @@ void KartSelectionScreen::unloaded()
// ----------------------------------------------------------------------------
// Return true if event was handled successfully
bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
bool KartSelectionScreen::playerJoin(InputDevice* device, bool first_player)
{
if (UserConfigParams::logGUI())
Log::info("[KartSelectionScreen]", "playerJoin() invoked");
if (!m_multiplayer && !firstPlayer) return false;
if (!m_multiplayer && !first_player) return false;
assert (g_dispatcher != NULL);
@@ -1106,7 +1106,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
// ---- Create new active player
PlayerProfile* profile_to_use = PlayerManager::getCurrentPlayer();
if (!firstPlayer)
if (!first_player)
{
const int player_profile_count = PlayerManager::get()->getNumPlayers();
for (int i=0; i<player_profile_count; i++)
@@ -1132,7 +1132,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
}
const int new_player_id =
StateManager::get()->createActivePlayer( profile_to_use, device, NULL );
StateManager::get()->createActivePlayer( profile_to_use, device);
StateManager::ActivePlayer* aplayer =
StateManager::get()->getActivePlayer(new_player_id);
@@ -1157,7 +1157,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
Widget* fullarea = getWidget("playerskarts");
// in this special case, leave room for a message on the right
if (m_multiplayer && firstPlayer)
if (m_multiplayer && first_player)
{
const int splitWidth = fullarea->m_w / 2;
@@ -1189,7 +1189,7 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
}
if (!firstPlayer)
if (!first_player)
{
// select something (anything) in the ribbon; by default, only the
// game master has something selected. Thus, when a new player joins,
@@ -1197,13 +1197,13 @@ bool KartSelectionScreen::playerJoin(InputDevice* device, bool firstPlayer)
w->setSelection(new_player_id, new_player_id, true);
newPlayerWidget->m_player_ident_spinner
->setFocusForPlayer(new_player_id);
->setFocusForPlayer(new_player_id);
}
if (!m_multiplayer)
{
input_manager->getDeviceList()->setSinglePlayer( StateManager::get()
->getActivePlayer(0));
->getActivePlayer(0));
}
return true;

View File

@@ -132,7 +132,7 @@ public:
/** \brief Called when a player hits 'fire'/'select' on his device to
* join the game */
bool playerJoin(InputDevice* device, bool firstPlayer);
bool playerJoin(InputDevice* device, bool first_player);
/**
* \brief Called when a player hits 'rescue'/'cancel' on his device

View File

@@ -358,7 +358,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
device, NULL);
device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{

View File

@@ -102,12 +102,11 @@ void StateManager::updateActivePlayerIDs()
// ----------------------------------------------------------------------------
int StateManager::createActivePlayer(PlayerProfile *profile,
InputDevice *device,
Online::OnlineProfile* user)
InputDevice *device)
{
ActivePlayer *p;
int i;
p = new ActivePlayer(profile, device, user);
p = new ActivePlayer(profile, device);
i = m_active_players.size();
m_active_players.push_back(p);
@@ -254,8 +253,7 @@ void StateManager::onStackEmptied()
#endif
StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player,
InputDevice *device,
Online::OnlineProfile* user)
InputDevice *device)
{
#ifdef DEBUG
m_magic_number = 0xAC1EF1AE;
@@ -264,7 +262,6 @@ StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player,
m_player = player;
m_device = NULL;
m_kart = NULL;
m_online_user = user;
setDevice(device);
} // ActivePlayer

View File

@@ -76,7 +76,6 @@ public:
{
friend class StateManager;
Online::OnlineProfile *m_online_user;
PlayerProfile *m_player;
InputDevice *m_device;
@@ -86,8 +85,7 @@ public:
/** ID of this player within the list of active players */
int m_id;
ActivePlayer(PlayerProfile* player, InputDevice* device,
Online::OnlineProfile* user);
ActivePlayer(PlayerProfile* player, InputDevice* device);
#ifdef DEBUG
unsigned int m_magic_number;
@@ -128,19 +126,6 @@ public:
* selecting his identity) */
void setPlayerProfile(PlayerProfile* player);
// --------------------------------------------------------------------
Online::OnlineProfile* getOnlineUser()
{
return m_online_user;
} // getOnlineUser
// --------------------------------------------------------------------
/** Call to change the identity of this player (useful when player is
* selecting his identity) */
void setOnlineUser(Online::OnlineProfile* user)
{
m_online_user = user;
}
// --------------------------------------------------------------------
/** ID of this player within the list of active players */
int getID() const
@@ -197,8 +182,7 @@ public:
*/
const PlayerProfile* getActivePlayerProfile(const int id);
int createActivePlayer(PlayerProfile *profile, InputDevice *device,
Online::OnlineProfile* use);
int createActivePlayer(PlayerProfile *profile, InputDevice *device);
void removeActivePlayer(int id);
unsigned int activePlayerCount();