Renamed Profile to OnlineProfile to better distinguish the various profiles we use.

This commit is contained in:
hiker 2014-03-07 11:02:07 +11:00
parent d19b5a2732
commit 7cb7651c07
32 changed files with 159 additions and 128 deletions

View File

@ -194,7 +194,7 @@ src/network/types.cpp
src/online/current_user.cpp src/online/current_user.cpp
src/online/http_request.cpp src/online/http_request.cpp
src/online/messages.cpp src/online/messages.cpp
src/online/profile.cpp src/online/online_profile.cpp
src/online/profile_manager.cpp src/online/profile_manager.cpp
src/online/request.cpp src/online/request.cpp
src/online/request_manager.cpp src/online/request_manager.cpp
@ -527,7 +527,7 @@ src/network/types.hpp
src/online/current_user.hpp src/online/current_user.hpp
src/online/http_request.hpp src/online/http_request.hpp
src/online/messages.hpp src/online/messages.hpp
src/online/profile.hpp src/online/online_profile.hpp
src/online/profile_manager.hpp src/online/profile_manager.hpp
src/online/request.hpp src/online/request.hpp
src/online/request_manager.hpp src/online/request_manager.hpp

View File

@ -20,6 +20,7 @@
#include "karts/abstract_kart.hpp" #include "karts/abstract_kart.hpp"
#include "modes/world.hpp" #include "modes/world.hpp"
#include "online/online_profile.hpp"
#include "race/race_manager.hpp" #include "race/race_manager.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"

View File

@ -22,12 +22,14 @@
#ifndef GAME_SETUP_HPP #ifndef GAME_SETUP_HPP
#define GAME_SETUP_HPP #define GAME_SETUP_HPP
#include "online/profile.hpp"
#include "network/race_config.hpp" #include "network/race_config.hpp"
#include <vector> #include <vector>
#include <string> #include <string>
namespace Online { class OnlineProfile; }
/*! \class PlayerProfile /*! \class PlayerProfile
* \brief Contains the profile of a player. * \brief Contains the profile of a player.
*/ */
@ -39,7 +41,7 @@ class NetworkPlayerProfile
uint8_t race_id; //!< The id of the player for the race uint8_t race_id; //!< The id of the player for the race
std::string kart_name; //!< The selected kart. std::string kart_name; //!< The selected kart.
Online::Profile* user_profile; //!< Pointer to the lobby profile Online::OnlineProfile* user_profile; //!< Pointer to the lobby profile
uint8_t world_kart_id; //!< the kart id in the World class (pointer to AbstractKart) uint8_t world_kart_id; //!< the kart id in the World class (pointer to AbstractKart)
}; };

View File

@ -18,14 +18,14 @@
#include "network/protocols/client_lobby_room_protocol.hpp" #include "network/protocols/client_lobby_room_protocol.hpp"
#include "network/network_manager.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "network/network_world.hpp"
#include "modes/world_with_rank.hpp" #include "modes/world_with_rank.hpp"
#include "network/network_manager.hpp"
#include "network/network_world.hpp"
#include "network/protocols/start_game_protocol.hpp"
#include "online/current_user.hpp" #include "online/current_user.hpp"
#include "states_screens/state_manager.hpp" #include "online/online_profile.hpp"
#include "states_screens/network_kart_selection.hpp" #include "states_screens/network_kart_selection.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
ClientLobbyRoomProtocol::ClientLobbyRoomProtocol(const TransportAddress& server_address) ClientLobbyRoomProtocol::ClientLobbyRoomProtocol(const TransportAddress& server_address)
@ -305,7 +305,7 @@ void ClientLobbyRoomProtocol::newPlayer(Event* event)
NetworkPlayerProfile* profile = new NetworkPlayerProfile(); NetworkPlayerProfile* profile = new NetworkPlayerProfile();
profile->kart_name = ""; profile->kart_name = "";
profile->race_id = race_id; profile->race_id = race_id;
profile->user_profile = new Online::Profile(global_id, ""); profile->user_profile = new Online::OnlineProfile(global_id, "");
m_setup->addPlayer(profile); m_setup->addPlayer(profile);
} }
else else
@ -396,7 +396,7 @@ void ClientLobbyRoomProtocol::connectionAccepted(Event* event)
uint8_t race_id = data[1]; uint8_t race_id = data[1];
uint32_t global_id = data.gui32(3); uint32_t global_id = data.gui32(3);
Online::Profile* new_user = new Online::Profile(global_id, ""); Online::OnlineProfile* new_user = new Online::OnlineProfile(global_id, "");
NetworkPlayerProfile* profile2 = new NetworkPlayerProfile(); NetworkPlayerProfile* profile2 = new NetworkPlayerProfile();
profile2->race_id = race_id; profile2->race_id = race_id;

View File

@ -20,7 +20,8 @@
#define GET_PEER_ADDRESS_HPP #define GET_PEER_ADDRESS_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
namespace Online { class XMLRequest; }
class GetPeerAddress : public Protocol class GetPeerAddress : public Protocol
{ {

View File

@ -20,9 +20,11 @@
#define HIDE_PUBLIC_ADDRESS_HPP #define HIDE_PUBLIC_ADDRESS_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
#include <string> #include <string>
namespace Online { class XMLRequest; }
class HidePublicAddress : public Protocol class HidePublicAddress : public Protocol
{ {
public: public:

View File

@ -4,6 +4,7 @@
#include "modes/world.hpp" #include "modes/world.hpp"
#include "network/protocol_manager.hpp" #include "network/protocol_manager.hpp"
#include "network/network_world.hpp" #include "network/network_world.hpp"
#include "utils/time.hpp"
KartUpdateProtocol::KartUpdateProtocol() KartUpdateProtocol::KartUpdateProtocol()
: Protocol(NULL, PROTOCOL_KART_UPDATE) : Protocol(NULL, PROTOCOL_KART_UPDATE)

View File

@ -2,7 +2,8 @@
#define QUICK_JOIN_PROTOCOL_HPP #define QUICK_JOIN_PROTOCOL_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
namespace Online { class XMLRequest; }
class QuickJoinProtocol : public Protocol class QuickJoinProtocol : public Protocol
{ {

View File

@ -18,21 +18,21 @@
#include "network/protocols/server_lobby_room_protocol.hpp" #include "network/protocols/server_lobby_room_protocol.hpp"
#include "network/server_network_manager.hpp" #include "config/user_config.hpp"
#include "modes/world.hpp"
#include "network/network_world.hpp" #include "network/network_world.hpp"
#include "network/protocols/get_public_address.hpp" #include "network/protocols/get_public_address.hpp"
#include "network/protocols/show_public_address.hpp" #include "network/protocols/show_public_address.hpp"
#include "network/protocols/connect_to_peer.hpp" #include "network/protocols/connect_to_peer.hpp"
#include "network/protocols/start_server.hpp" #include "network/protocols/start_server.hpp"
#include "network/protocols/start_game_protocol.hpp" #include "network/protocols/start_game_protocol.hpp"
#include "network/server_network_manager.hpp"
#include "online/current_user.hpp" #include "online/current_user.hpp"
#include "online/online_profile.hpp"
#include "online/request_manager.hpp" #include "online/request_manager.hpp"
#include "config/user_config.hpp"
#include "modes/world.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/time.hpp"
#include "utils/random_generator.hpp" #include "utils/random_generator.hpp"
#include "utils/time.hpp"
ServerLobbyRoomProtocol::ServerLobbyRoomProtocol() : LobbyRoomProtocol(NULL) ServerLobbyRoomProtocol::ServerLobbyRoomProtocol() : LobbyRoomProtocol(NULL)
@ -386,7 +386,7 @@ void ServerLobbyRoomProtocol::connectionRequested(Event* event)
NetworkPlayerProfile* profile = new NetworkPlayerProfile(); NetworkPlayerProfile* profile = new NetworkPlayerProfile();
profile->race_id = m_next_id; profile->race_id = m_next_id;
profile->kart_name = ""; profile->kart_name = "";
profile->user_profile = new Online::Profile(player_id, ""); profile->user_profile = new Online::OnlineProfile(player_id, "");
m_setup->addPlayer(profile); m_setup->addPlayer(profile);
peer->setPlayerProfile(profile); peer->setPlayerProfile(profile);
Log::verbose("ServerLobbyRoomProtocol", "New player."); Log::verbose("ServerLobbyRoomProtocol", "New player.");

View File

@ -20,9 +20,11 @@
#define SHOW_PUBLIC_ADDRESS_HPP #define SHOW_PUBLIC_ADDRESS_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
#include <string> #include <string>
namespace Online { class XMLRequest; }
class ShowPublicAddress : public Protocol class ShowPublicAddress : public Protocol
{ {
public: public:

View File

@ -11,6 +11,7 @@
#include "network/network_world.hpp" #include "network/network_world.hpp"
#include "network/protocols/synchronization_protocol.hpp" #include "network/protocols/synchronization_protocol.hpp"
#include "online/current_user.hpp" #include "online/current_user.hpp"
#include "online/online_profile.hpp"
#include "race/race_manager.hpp" #include "race/race_manager.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "states_screens/kart_selection.hpp" #include "states_screens/kart_selection.hpp"

View File

@ -2,7 +2,8 @@
#define START_SERVER_HPP #define START_SERVER_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
namespace Online { class XMLRequest; }
/*! /*!
* This protocol tells to the database that the server is up and running, * This protocol tells to the database that the server is up and running,

View File

@ -2,7 +2,8 @@
#define STOP_SERVER_HPP #define STOP_SERVER_HPP
#include "network/protocol.hpp" #include "network/protocol.hpp"
#include "online/request.hpp"
namespace Online { class XMLRequest; }
/*! \brief Removes the server info from the database /*! \brief Removes the server info from the database
*/ */

View File

@ -18,16 +18,16 @@
#include "network/server_network_manager.hpp" #include "network/server_network_manager.hpp"
#include "main_loop.hpp"
#include "network/protocols/connect_to_server.hpp"
#include "network/protocols/get_peer_address.hpp"
#include "network/protocols/get_public_address.hpp" #include "network/protocols/get_public_address.hpp"
#include "network/protocols/hide_public_address.hpp" #include "network/protocols/hide_public_address.hpp"
#include "network/protocols/show_public_address.hpp"
#include "network/protocols/get_peer_address.hpp"
#include "network/protocols/connect_to_server.hpp"
#include "network/protocols/stop_server.hpp"
#include "network/protocols/server_lobby_room_protocol.hpp" #include "network/protocols/server_lobby_room_protocol.hpp"
#include "network/protocols/show_public_address.hpp"
#include "main_loop.hpp" #include "network/protocols/stop_server.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/time.hpp"
#include <enet/enet.h> #include <enet/enet.h>
#include <pthread.h> #include <pthread.h>

View File

@ -26,8 +26,9 @@
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "guiengine/dialog_queue.hpp" #include "guiengine/dialog_queue.hpp"
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "online/servers_manager.hpp" #include "online/online_profile.hpp"
#include "online/profile_manager.hpp" #include "online/profile_manager.hpp"
#include "online/servers_manager.hpp"
#include "states_screens/login_screen.hpp" #include "states_screens/login_screen.hpp"
#include "states_screens/dialogs/change_password_dialog.hpp" #include "states_screens/dialogs/change_password_dialog.hpp"
#include "states_screens/dialogs/user_info_dialog.hpp" #include "states_screens/dialogs/user_info_dialog.hpp"
@ -188,7 +189,7 @@ namespace Online
int username_fetched = input->get("username", &username); int username_fetched = input->get("username", &username);
uint32_t userid(0); uint32_t userid(0);
int userid_fetched = input->get("userid", &userid); int userid_fetched = input->get("userid", &userid);
m_profile = new Profile(userid, username, true); m_profile = new OnlineProfile(userid, username, true);
assert(token_fetched && username_fetched && userid_fetched); assert(token_fetched && username_fetched && userid_fetched);
m_state = US_SIGNED_IN; m_state = US_SIGNED_IN;
if(saveSession()) if(saveSession())
@ -409,8 +410,8 @@ namespace Online
if(isSuccess()) if(isSuccess())
{ {
CurrentUser::get()->getProfile()->addFriend(id); CurrentUser::get()->getProfile()->addFriend(id);
Profile::RelationInfo *info = OnlineProfile::RelationInfo *info =
new Profile::RelationInfo(_("Today"), false, true, false); new OnlineProfile::RelationInfo(_("Today"), false, true, false);
ProfileManager::get()->getProfileByID(id)->setRelationInfo(info); ProfileManager::get()->getProfileByID(id)->setRelationInfo(info);
OnlineProfileFriends::getInstance()->refreshFriendsList(); OnlineProfileFriends::getInstance()->refreshFriendsList();
info_text = _("Friend request send!"); info_text = _("Friend request send!");
@ -452,10 +453,10 @@ namespace Online
core::stringw info_text(""); core::stringw info_text("");
if(isSuccess()) if(isSuccess())
{ {
Profile * profile = ProfileManager::get()->getProfileByID(id); OnlineProfile * profile = ProfileManager::get()->getProfileByID(id);
profile->setFriend(); profile->setFriend();
Profile::RelationInfo *info = OnlineProfile::RelationInfo *info =
new Profile::RelationInfo(_("Today"), false, false, true); new OnlineProfile::RelationInfo(_("Today"), false, false, true);
profile->setRelationInfo(info); profile->setRelationInfo(info);
OnlineProfileFriends::getInstance()->refreshFriendsList(); OnlineProfileFriends::getInstance()->refreshFriendsList();
info_text = _("Friend request accepted!"); info_text = _("Friend request accepted!");
@ -683,9 +684,9 @@ namespace Online
now_online = true; now_online = true;
online_friends.erase(iter); online_friends.erase(iter);
} }
Profile * profile = OnlineProfile * profile =
ProfileManager::get()->getProfileByID(friends[i]); ProfileManager::get()->getProfileByID(friends[i]);
Profile::RelationInfo * relation_info = OnlineProfile::RelationInfo * relation_info =
profile->getRelationInfo(); profile->getRelationInfo();
if( relation_info->isOnline() ) if( relation_info->isOnline() )
{ {
@ -755,9 +756,9 @@ namespace Online
const XMLNode * node = getXMLData()->getNode(i); const XMLNode * node = getXMLData()->getNode(i);
if(node->getName() == "new_friend_request") if(node->getName() == "new_friend_request")
{ {
Profile::RelationInfo * ri = OnlineProfile::RelationInfo * ri =
new Profile::RelationInfo("New", false, true, true); new OnlineProfile::RelationInfo("New", false, true, true);
Profile * p = new Profile(node); OnlineProfile * p = new OnlineProfile(node);
p->setRelationInfo(ri); p->setRelationInfo(ri);
ProfileManager::get()->addPersistent(p); ProfileManager::get()->addPersistent(p);
friend_request_count++; friend_request_count++;

View File

@ -21,7 +21,6 @@
#include "online/request_manager.hpp" #include "online/request_manager.hpp"
#include "online/server.hpp" #include "online/server.hpp"
#include "online/profile.hpp"
#include "online/xml_request.hpp" #include "online/xml_request.hpp"
#include "utils/types.hpp" #include "utils/types.hpp"
#include "utils/synchronised.hpp" #include "utils/synchronised.hpp"
@ -34,6 +33,8 @@
namespace Online namespace Online
{ {
class OnlineProfile;
// ============================================================================ // ============================================================================
/** /**
@ -152,7 +153,7 @@ namespace Online
std::string m_token; std::string m_token;
bool m_save_session; bool m_save_session;
UserState m_state; UserState m_state;
Profile * m_profile; OnlineProfile *m_profile;
bool saveSession() const { return m_save_session; } bool saveSession() const { return m_save_session; }
@ -211,7 +212,7 @@ namespace Online
/** Returns the session token of the signed in user. */ /** Returns the session token of the signed in user. */
const std::string & getToken() const { return m_token; } const std::string & getToken() const { return m_token; }
/** Returns a pointer to the profile associated with the current user. */ /** Returns a pointer to the profile associated with the current user. */
Profile * getProfile() const { return m_profile; } OnlineProfile * getProfile() const { return m_profile; }
}; // class CurrentUser }; // class CurrentUser

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "online/profile.hpp" #include "online/online_profile.hpp"
#include "online/profile_manager.hpp" #include "online/profile_manager.hpp"
#include "online/request_manager.hpp" #include "online/request_manager.hpp"
@ -35,7 +35,7 @@ using namespace Online;
namespace Online namespace Online
{ {
Profile::RelationInfo::RelationInfo(const irr::core::stringw & date, OnlineProfile::RelationInfo::RelationInfo(const irr::core::stringw & date,
bool is_online, bool is_pending, bool is_online, bool is_pending,
bool is_asker) bool is_asker)
{ {
@ -46,7 +46,7 @@ Profile::RelationInfo::RelationInfo(const irr::core::stringw & date,
} // RelationInfo::RelationInfo } // RelationInfo::RelationInfo
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Profile::RelationInfo::setOnline(bool online) void OnlineProfile::RelationInfo::setOnline(bool online)
{ {
m_is_online = online; m_is_online = online;
if (m_is_online) if (m_is_online)
@ -57,7 +57,7 @@ void Profile::RelationInfo::setOnline(bool online)
/** Constructor for a new profile. It does only store the ID, a name, and /** Constructor for a new profile. It does only store the ID, a name, and
* if it is the current user. * if it is the current user.
*/ */
Profile::Profile(const uint32_t & userid, OnlineProfile::OnlineProfile(const uint32_t & userid,
const irr::core::stringw & username, const irr::core::stringw & username,
bool is_current_user) bool is_current_user)
{ {
@ -81,7 +81,7 @@ Profile::Profile(const uint32_t & userid,
* \param type Either C_DEFAULT (no relation), or C_RELATION_INFO * \param type Either C_DEFAULT (no relation), or C_RELATION_INFO
* if the XML node contains relation information. * if the XML node contains relation information.
*/ */
Profile::Profile(const XMLNode * xml, ConstructorType type) OnlineProfile::OnlineProfile(const XMLNode * xml, ConstructorType type)
{ {
m_relation_info = NULL; m_relation_info = NULL;
m_is_friend = false; m_is_friend = false;
@ -115,20 +115,20 @@ Profile::Profile(const XMLNode * xml, ConstructorType type)
xml->get("user_name", &m_username); xml->get("user_name", &m_username);
m_is_current_user = (m_id == CurrentUser::get()->getID()); m_is_current_user = (m_id == CurrentUser::get()->getID());
m_state = S_READY; m_state = S_READY;
} // Profile(XMLNode) } // OnlineProfile(XMLNode)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
Profile::~Profile() OnlineProfile::~OnlineProfile()
{ {
delete m_relation_info; delete m_relation_info;
} // ~Profile } // ~OnlineProfile
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Triggers an asynchronous request to get the achievements for this user /** Triggers an asynchronous request to get the achievements for this user
* from the server. The state of this profile is changed to be fetching, * from the server. The state of this profile is changed to be fetching,
* and will be reset to ready when the server request returns. * and will be reset to ready when the server request returns.
*/ */
void Profile::fetchAchievements() void OnlineProfile::fetchAchievements()
{ {
assert(CurrentUser::get()->isRegisteredUser()); assert(CurrentUser::get()->isRegisteredUser());
if (m_has_fetched_achievements || m_is_current_user) if (m_has_fetched_achievements || m_is_current_user)
@ -146,7 +146,7 @@ void Profile::fetchAchievements()
{ {
uint32_t user_id = 0; uint32_t user_id = 0;
getXMLData()->get("visitingid", &user_id); getXMLData()->get("visitingid", &user_id);
Profile *profile = ProfileManager::get()->getProfileByID(user_id); OnlineProfile *profile = ProfileManager::get()->getProfileByID(user_id);
if (profile) if (profile)
profile->storeAchievements(getXMLData()); profile->storeAchievements(getXMLData());
} // AchievementsRequest::callback } // AchievementsRequest::callback
@ -168,7 +168,7 @@ void Profile::fetchAchievements()
* READY again. * READY again.
* \param input XML node with the achievements data. * \param input XML node with the achievements data.
*/ */
void Profile::storeAchievements(const XMLNode * input) void OnlineProfile::storeAchievements(const XMLNode * input)
{ {
m_achievements.clear(); m_achievements.clear();
std::string achieved_string(""); std::string achieved_string("");
@ -185,7 +185,7 @@ void Profile::storeAchievements(const XMLNode * input)
* The state of this profile is changed to be fetching, * The state of this profile is changed to be fetching,
* and will be reset to ready when the server request returns. * and will be reset to ready when the server request returns.
*/ */
void Profile::fetchFriends() void OnlineProfile::fetchFriends()
{ {
assert(CurrentUser::get()->isRegisteredUser()); assert(CurrentUser::get()->isRegisteredUser());
if (m_has_fetched_friends) if (m_has_fetched_friends)
@ -201,7 +201,7 @@ void Profile::fetchFriends()
{ {
uint32_t user_id = 0; uint32_t user_id = 0;
getXMLData()->get("visitingid", &user_id); getXMLData()->get("visitingid", &user_id);
Profile *profile = ProfileManager::get()->getProfileByID(user_id); OnlineProfile *profile = ProfileManager::get()->getProfileByID(user_id);
if (profile) if (profile)
profile->storeFriends(getXMLData()); profile->storeFriends(getXMLData());
} // callback } // callback
@ -223,22 +223,23 @@ void Profile::fetchFriends()
* to be READY again. * to be READY again.
* \param input XML node with the friends data. * \param input XML node with the friends data.
*/ */
void Profile::storeFriends(const XMLNode * input) void OnlineProfile::storeFriends(const XMLNode * input)
{ {
const XMLNode * friends_xml = input->getNode("friends"); const XMLNode * friends_xml = input->getNode("friends");
m_friends.clear(); m_friends.clear();
for (unsigned int i = 0; i < friends_xml->getNumNodes(); i++) for (unsigned int i = 0; i < friends_xml->getNumNodes(); i++)
{ {
Profile * profile; OnlineProfile * profile;
if (m_is_current_user) if (m_is_current_user)
{ {
profile = new Profile(friends_xml->getNode(i), C_RELATION_INFO); profile = new OnlineProfile(friends_xml->getNode(i), C_RELATION_INFO);
m_friends.push_back(profile->getID()); m_friends.push_back(profile->getID());
ProfileManager::get()->addPersistent(profile); ProfileManager::get()->addPersistent(profile);
} }
else else
{ {
profile = new Profile(friends_xml->getNode(i)->getNode("user"), C_DEFAULT); profile = new OnlineProfile(friends_xml->getNode(i)->getNode("user"),
C_DEFAULT);
m_friends.push_back(profile->getID()); m_friends.push_back(profile->getID());
ProfileManager::get()->addToCache(profile); ProfileManager::get()->addToCache(profile);
} }
@ -251,7 +252,7 @@ void Profile::storeFriends(const XMLNode * input)
/** Removed a friend with a given id. /** Removed a friend with a given id.
* \param id Friend id to remove. * \param id Friend id to remove.
*/ */
void Profile::removeFriend(const uint32_t id) void OnlineProfile::removeFriend(const uint32_t id)
{ {
assert(m_has_fetched_friends); assert(m_has_fetched_friends);
IDList::iterator iter; IDList::iterator iter;
@ -271,7 +272,7 @@ void Profile::removeFriend(const uint32_t id)
/** Adds a friend to the friend list. /** Adds a friend to the friend list.
* \param id The id of the profile to add. * \param id The id of the profile to add.
*/ */
void Profile::addFriend(const uint32_t id) void OnlineProfile::addFriend(const uint32_t id)
{ {
assert(m_has_fetched_friends); assert(m_has_fetched_friends);
for (unsigned int i = 0; i < m_friends.size(); i++) for (unsigned int i = 0; i < m_friends.size(); i++)
@ -283,7 +284,7 @@ void Profile::addFriend(const uint32_t id)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Deletes the relational info for this profile. /** Deletes the relational info for this profile.
*/ */
void Profile::deleteRelationalInfo() void OnlineProfile::deleteRelationalInfo()
{ {
delete m_relation_info; delete m_relation_info;
m_relation_info = NULL; m_relation_info = NULL;
@ -292,7 +293,7 @@ void Profile::deleteRelationalInfo()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Returns the list of all friend ids. /** Returns the list of all friend ids.
*/ */
const Profile::IDList& Profile::getFriends() const OnlineProfile::IDList& OnlineProfile::getFriends()
{ {
assert(m_has_fetched_friends && m_state == S_READY); assert(m_has_fetched_friends && m_state == S_READY);
return m_friends; return m_friends;
@ -301,7 +302,7 @@ const Profile::IDList& Profile::getFriends()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Returns the list of all achievement ids. /** Returns the list of all achievement ids.
*/ */
const Profile::IDList& Profile::getAchievements() const OnlineProfile::IDList& OnlineProfile::getAchievements()
{ {
assert(m_has_fetched_achievements && m_state == S_READY && !m_is_current_user); assert(m_has_fetched_achievements && m_state == S_READY && !m_is_current_user);
return m_achievements; return m_achievements;
@ -312,7 +313,7 @@ const Profile::IDList& Profile::getAchievements()
* that is in the given profile that's not available in this profile will * that is in the given profile that's not available in this profile will
* be copied over, then the given profile will be deleted. * be copied over, then the given profile will be deleted.
*/ */
void Profile::merge(Profile * profile) void OnlineProfile::merge(OnlineProfile *profile)
{ {
assert(profile != NULL); assert(profile != NULL);
if (!this->m_has_fetched_friends && profile->m_has_fetched_friends) if (!this->m_has_fetched_friends && profile->m_has_fetched_friends)

View File

@ -37,7 +37,7 @@ namespace Online
* are managed by the ProfileManager. * are managed by the ProfileManager.
* \ingroup online * \ingroup online
*/ */
class Profile class OnlineProfile
{ {
public: public:
enum ConstructorType enum ConstructorType
@ -104,12 +104,12 @@ private:
void storeAchievements(const XMLNode * input); void storeAchievements(const XMLNode * input);
public: public:
Profile(const uint32_t & userid, OnlineProfile(const uint32_t & userid,
const irr::core::stringw & username, const irr::core::stringw & username,
bool is_current_user = false ); bool is_current_user = false );
Profile(const XMLNode * xml, OnlineProfile(const XMLNode * xml,
ConstructorType type = C_DEFAULT); ConstructorType type = C_DEFAULT);
~Profile(); ~OnlineProfile();
void fetchFriends(); void fetchFriends();
const IDList& getFriends(); const IDList& getFriends();
void fetchAchievements(); void fetchAchievements();
@ -117,7 +117,7 @@ public:
void addFriend(const uint32_t id); void addFriend(const uint32_t id);
void deleteRelationalInfo(); void deleteRelationalInfo();
const IDList& getAchievements(); const IDList& getAchievements();
void merge(Profile * profile); void merge(OnlineProfile * profile);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns true if the achievements for this profile have been fetched. */ /** Returns true if the achievements for this profile have been fetched. */
bool hasFetchedAchievements() const { return m_has_fetched_achievements; } bool hasFetchedAchievements() const { return m_has_fetched_achievements; }
@ -157,7 +157,7 @@ public:
const irr::core::stringw& getUserName() const { return m_username; } const irr::core::stringw& getUserName() const { return m_username; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
}; // class Profile }; // class OnlineProfile
} // namespace Online } // namespace Online

View File

@ -20,6 +20,7 @@
#include "online/profile_manager.hpp" #include "online/profile_manager.hpp"
#include "online/current_user.hpp" #include "online/current_user.hpp"
#include "online/online_profile.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/translation.hpp" #include "utils/translation.hpp"
@ -82,7 +83,7 @@ int ProfileManager::guaranteeCacheSize(unsigned int min_num)
* FIXME: This should be improved to download the profile is necessary. * FIXME: This should be improved to download the profile is necessary.
* \param id The id of the profile to find. * \param id The id of the profile to find.
*/ */
Profile * ProfileManager::getProfileByID(const uint32_t id) OnlineProfile* ProfileManager::getProfileByID(const uint32_t id)
{ {
if (inPersistent(id)) if (inPersistent(id))
return m_profiles_persistent[id]; return m_profiles_persistent[id];
@ -100,7 +101,7 @@ Profile * ProfileManager::getProfileByID(const uint32_t id)
* with any new information from the given profile. Otherwise, the profile * with any new information from the given profile. Otherwise, the profile
* is just added to the cache. * is just added to the cache.
*/ */
void ProfileManager::addToCache(Profile * profile) void ProfileManager::addToCache(OnlineProfile * profile)
{ {
if (inPersistent(profile->getID())) if (inPersistent(profile->getID()))
m_profiles_persistent[profile->getID()]->merge(profile); m_profiles_persistent[profile->getID()]->merge(profile);
@ -118,7 +119,7 @@ void ProfileManager::addToCache(Profile * profile)
* the RaceResultGUI to leave the race running (for the end animation) while * the RaceResultGUI to leave the race running (for the end animation) while
* the results are being shown. * the results are being shown.
*/ */
void ProfileManager::addDirectToCache(Profile* profile) void ProfileManager::addDirectToCache(OnlineProfile* profile)
{ {
assert(profile != NULL); assert(profile != NULL);
if (m_profiles_cache.size() == m_max_cache_size) if (m_profiles_cache.size() == m_max_cache_size)
@ -168,7 +169,7 @@ bool ProfileManager::isInCache(const uint32_t id)
* probability that most often used entries will remain in the cache, * probability that most often used entries will remain in the cache,
* without adding much overhead. * without adding much overhead.
*/ */
void ProfileManager::updateCacheBits(Profile * profile) void ProfileManager::updateCacheBits(OnlineProfile * profile)
{ {
profile->setCacheBit(true); profile->setCacheBit(true);
if (m_profiles_cache.size() == m_max_cache_size) if (m_profiles_cache.size() == m_max_cache_size)
@ -208,7 +209,7 @@ bool ProfileManager::inPersistent(const uint32_t id)
* the friends, while the other could have fetched the achievements.) * the friends, while the other could have fetched the achievements.)
* \param profile The profile to make persistent. * \param profile The profile to make persistent.
*/ */
void ProfileManager::addPersistent(Profile * profile) void ProfileManager::addPersistent(OnlineProfile * profile)
{ {
if (inPersistent(profile->getID())) if (inPersistent(profile->getID()))
{ {
@ -260,7 +261,7 @@ void ProfileManager::moveToCache(const uint32_t id)
{ {
if (inPersistent(id)) if (inPersistent(id))
{ {
Profile * profile = getProfileByID(id); OnlineProfile * profile = getProfileByID(id);
m_profiles_persistent.erase(id); m_profiles_persistent.erase(id);
addToCache(profile); addToCache(profile);
} }

View File

@ -20,16 +20,18 @@
#define HEADER_ONLINE_PROFILE_MANAGER_HPP #define HEADER_ONLINE_PROFILE_MANAGER_HPP
#include "utils/types.hpp" #include "utils/types.hpp"
#include "online/profile.hpp"
#include <irrString.h> #include <irrString.h>
#include <assert.h>
#include <map>
#include <string> #include <string>
namespace Online namespace Online
{ {
class OnlineProfile;
/** Class that manages all online profiles. Profiles are used for storing /** Class that manages all online profiles. Profiles are used for storing
* online information from local users, but also to store information about * online information from local users, but also to store information about
* remote users (e.g. if you want to see the achievements of another user * remote users (e.g. if you want to see the achievements of another user
@ -48,7 +50,7 @@ private:
~ProfileManager(); ~ProfileManager();
/** The mapping of ids to profile. */ /** The mapping of ids to profile. */
typedef std::map<uint32_t, Profile*> ProfilesMap; typedef std::map<uint32_t, OnlineProfile*> ProfilesMap;
/** A map of profiles that is persistent. (i.e. no automatic /** A map of profiles that is persistent. (i.e. no automatic
* removing happens) Normally used for the current user's profile * removing happens) Normally used for the current user's profile
@ -62,15 +64,15 @@ private:
/** A temporary profile that is currently being 'visited', /** A temporary profile that is currently being 'visited',
* e.g. its data is shown in a gui. */ * e.g. its data is shown in a gui. */
Profile* m_currently_visiting; OnlineProfile* m_currently_visiting;
/** The max size of the m_profiles cache. Its default size can be /** The max size of the m_profiles cache. Its default size can be
* inrceased when necessary (e.g. when too many search results are * inrceased when necessary (e.g. when too many search results are
* loaded, to make sure they can be all stored). */ * loaded, to make sure they can be all stored). */
unsigned int m_max_cache_size; unsigned int m_max_cache_size;
void updateCacheBits(Profile * profile); void updateCacheBits(OnlineProfile * profile);
void addDirectToCache(Profile * profile); void addDirectToCache(OnlineProfile * profile);
public: public:
/** Create the singleton instance. */ /** Create the singleton instance. */
@ -98,15 +100,15 @@ public:
} // destroy } // destroy
// ---------------------------------------------------------------- // ----------------------------------------------------------------
void addToCache(Profile * profile); void addToCache(OnlineProfile *profile);
void addPersistent(Profile * profile); void addPersistent(OnlineProfile *profile);
void deleteFromPersistent(const uint32_t id); void deleteFromPersistent(const uint32_t id);
void clearPersistent(); void clearPersistent();
void moveToCache(const uint32_t id); void moveToCache(const uint32_t id);
int guaranteeCacheSize(unsigned int max_num); int guaranteeCacheSize(unsigned int max_num);
bool isInCache(const uint32_t id); bool isInCache(const uint32_t id);
bool inPersistent(const uint32_t id); bool inPersistent(const uint32_t id);
Profile* getProfileByID(const uint32_t id); OnlineProfile* getProfileByID(const uint32_t id);
// ---------------------------------------------------------------- // ----------------------------------------------------------------
/** Marks a given profile to be the currently visited one. This /** Marks a given profile to be the currently visited one. This
* is used to mark the profiles that ave its data display (e.g. * is used to mark the profiles that ave its data display (e.g.
@ -118,7 +120,7 @@ public:
// ---------------------------------------------------------------- // ----------------------------------------------------------------
/** \return the instance of the profile that's currently being /** \return the instance of the profile that's currently being
* visited */ * visited */
Profile* getVisitingProfile() { return m_currently_visiting; } OnlineProfile* getVisitingProfile() { return m_currently_visiting; }
}; // class CurrentUser }; // class CurrentUser

View File

@ -17,15 +17,15 @@
#include "states_screens/dialogs/user_info_dialog.hpp" #include "states_screens/dialogs/user_info_dialog.hpp"
#include <IGUIEnvironment.h>
#include "audio/sfx_manager.hpp" #include "audio/sfx_manager.hpp"
#include "guiengine/engine.hpp" #include "guiengine/engine.hpp"
#include "states_screens/state_manager.hpp" #include "online/online_profile.hpp"
#include "states_screens/online_profile_overview.hpp"
#include "utils/translation.hpp"
#include "online/messages.hpp" #include "online/messages.hpp"
#include "states_screens/online_profile_overview.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <IGUIEnvironment.h>
using namespace GUIEngine; using namespace GUIEngine;
using namespace irr; using namespace irr;
@ -93,7 +93,7 @@ void UserInfoDialog::beforeAddingWidgets()
m_remove_widget->setVisible(true); m_remove_widget->setVisible(true);
} }
Profile::RelationInfo * relation_info = m_profile->getRelationInfo(); OnlineProfile::RelationInfo * relation_info = m_profile->getRelationInfo();
if(relation_info != NULL) if(relation_info != NULL)
{ {
if(relation_info->isPending()) if(relation_info->isPending())

View File

@ -19,14 +19,13 @@
#ifndef HEADER_USER_INFO_DIALOG_HPP #ifndef HEADER_USER_INFO_DIALOG_HPP
#define HEADER_USER_INFO_DIALOG_HPP #define HEADER_USER_INFO_DIALOG_HPP
#include <irrString.h>
#include "guiengine/modaldialog.hpp" #include "guiengine/modaldialog.hpp"
#include "guiengine/widgets.hpp" #include "guiengine/widgets.hpp"
#include "online/profile_manager.hpp"
#include "online/current_user.hpp" #include "online/current_user.hpp"
#include "online/profile_manager.hpp"
#include "utils/types.hpp" #include "utils/types.hpp"
#include <irrString.h>
/** /**
* \brief Dialog that allows a user to sign in * \brief Dialog that allows a user to sign in
@ -45,7 +44,7 @@ private:
irr::core::stringw m_info; irr::core::stringw m_info;
const uint32_t m_showing_id; const uint32_t m_showing_id;
Online::Profile * m_profile; Online::OnlineProfile * m_profile;
GUIEngine::LabelWidget * m_name_widget; GUIEngine::LabelWidget * m_name_widget;
GUIEngine::LabelWidget * m_info_widget; GUIEngine::LabelWidget * m_info_widget;

View File

@ -40,7 +40,7 @@
#include "karts/kart_properties.hpp" #include "karts/kart_properties.hpp"
#include "karts/kart_properties_manager.hpp" #include "karts/kart_properties_manager.hpp"
#include "modes/overworld.hpp" #include "modes/overworld.hpp"
#include "online/profile.hpp" #include "online/online_profile.hpp"
#include "states_screens/race_setup_screen.hpp" #include "states_screens/race_setup_screen.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
@ -191,7 +191,7 @@ void PlayerNameSpinner::markAsCorrect()
PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent, PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
StateManager::ActivePlayer* associated_player, StateManager::ActivePlayer* associated_player,
Online::Profile* associated_user, Online::OnlineProfile* associated_user,
core::recti area, const int player_id, core::recti area, const int player_id,
std::string kart_group, std::string kart_group,
const int irrlicht_widget_id) : Widget(WTYPE_DIV) const int irrlicht_widget_id) : Widget(WTYPE_DIV)

View File

@ -19,15 +19,17 @@
#ifndef KART_SELECTION_INCLUDED #ifndef KART_SELECTION_INCLUDED
#define KART_SELECTION_INCLUDED #define KART_SELECTION_INCLUDED
#include <string>
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "guiengine/widgets/dynamic_ribbon_widget.hpp" #include "guiengine/widgets/dynamic_ribbon_widget.hpp"
#include "guiengine/widgets/label_widget.hpp" #include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/model_view_widget.hpp" #include "guiengine/widgets/model_view_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp" #include "guiengine/widgets/spinner_widget.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include <IGUIImage.h> #include <IGUIImage.h>
#include <string>
namespace GUIEngine namespace GUIEngine
{ {
class Widget; class Widget;
@ -38,7 +40,9 @@ namespace GUIEngine
namespace Online namespace Online
{ {
class User; class User;
class OnlineProfile;
} }
class InputDevice; class InputDevice;
class PlayerKartWidget; class PlayerKartWidget;
class KartHoverListener; class KartHoverListener;
@ -247,7 +251,7 @@ class PlayerKartWidget : public GUIEngine::Widget,
int m_player_id; int m_player_id;
/** Network info about the user. */ /** Network info about the user. */
Online::Profile* m_associated_user; Online::OnlineProfile* m_associated_user;
/** Internal name of the spinner; useful to interpret spinner events, /** Internal name of the spinner; useful to interpret spinner events,
* which contain the name of the activated object */ * which contain the name of the activated object */
@ -278,7 +282,7 @@ public:
PlayerKartWidget(KartSelectionScreen* parent, PlayerKartWidget(KartSelectionScreen* parent,
StateManager::ActivePlayer* associated_player, StateManager::ActivePlayer* associated_player,
Online::Profile* associated_user, Online::OnlineProfile* associated_user,
core::recti area, const int player_id, core::recti area, const int player_id,
std::string kart_group, std::string kart_group,
const int irrlicht_idget_id=-1); const int irrlicht_idget_id=-1);

View File

@ -24,11 +24,12 @@
#include "guiengine/scalable_font.hpp" #include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "guiengine/widget.hpp" #include "guiengine/widget.hpp"
#include "online/messages.hpp"
#include "online/online_profile.hpp"
#include "states_screens/dialogs/message_dialog.hpp" #include "states_screens/dialogs/message_dialog.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "states_screens/dialogs/user_info_dialog.hpp" #include "states_screens/dialogs/user_info_dialog.hpp"
#include "utils/translation.hpp" #include "utils/translation.hpp"
#include "online/messages.hpp"
#include <IGUIButton.h> #include <IGUIButton.h>

View File

@ -21,6 +21,7 @@
#include "guiengine/scalable_font.hpp" #include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "guiengine/widget.hpp" #include "guiengine/widget.hpp"
#include "online/online_profile.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "utils/translation.hpp" #include "utils/translation.hpp"
#include "states_screens/online_profile_overview.hpp" #include "states_screens/online_profile_overview.hpp"

View File

@ -48,7 +48,7 @@ protected:
GUIEngine::IconButtonWidget * m_settings_tab; GUIEngine::IconButtonWidget * m_settings_tab;
/** The profile that should be shown. */ /** The profile that should be shown. */
Online::Profile *m_visiting_profile; Online::OnlineProfile *m_visiting_profile;
public: public:

View File

@ -115,11 +115,11 @@ void OnlineProfileFriends::eventCallback(Widget* widget,
void OnlineProfileFriends::displayResults() void OnlineProfileFriends::displayResults()
{ {
m_friends_list_widget->clear(); m_friends_list_widget->clear();
const Profile::IDList &friends = m_visiting_profile->getFriends(); const OnlineProfile::IDList &friends = m_visiting_profile->getFriends();
for (unsigned int i = 0; i < friends.size(); i++) for (unsigned int i = 0; i < friends.size(); i++)
{ {
std::vector<ListWidget::ListCell> row; std::vector<ListWidget::ListCell> row;
Profile* friend_profile = OnlineProfile* friend_profile =
ProfileManager::get()->getProfileByID(friends[i]); ProfileManager::get()->getProfileByID(friends[i]);
// When looking at friends of a friend those profiles are not // When looking at friends of a friend those profiles are not
@ -134,7 +134,7 @@ void OnlineProfileFriends::displayResults()
-1, 2) ); -1, 2) );
if (m_visiting_profile->isCurrentUser()) if (m_visiting_profile->isCurrentUser())
{ {
Profile::RelationInfo * relation_info = OnlineProfile::RelationInfo * relation_info =
friend_profile->getRelationInfo(); friend_profile->getRelationInfo();
row.push_back(ListWidget::ListCell(relation_info->getDate(), row.push_back(ListWidget::ListCell(relation_info->getDate(),
-1, 1, true) ); -1, 1, true) );

View File

@ -152,7 +152,7 @@ void OnlineUserSearch::parseResult(const XMLNode * input)
} }
for (unsigned int i = 0; i < n; i++) for (unsigned int i = 0; i < n; i++)
{ {
Profile * profile = new Profile(users_xml->getNode(i)); OnlineProfile * profile = new OnlineProfile(users_xml->getNode(i));
// The id must be pushed before adding it to the cache, since // The id must be pushed before adding it to the cache, since
// the cache might merge the new data with an existing entry // the cache might merge the new data with an existing entry
m_users.push_back(profile->getID()); m_users.push_back(profile->getID());
@ -169,7 +169,7 @@ void OnlineUserSearch::showList()
for (unsigned int i=0; i < m_users.size(); i++) for (unsigned int i=0; i < m_users.size(); i++)
{ {
std::vector<GUIEngine::ListWidget::ListCell> row; std::vector<GUIEngine::ListWidget::ListCell> row;
Profile * profile = ProfileManager::get()->getProfileByID(m_users[i]); OnlineProfile * profile = ProfileManager::get()->getProfileByID(m_users[i]);
// This could still happen if something pushed results out of the cache. // This could still happen if something pushed results out of the cache.
if (!profile) if (!profile)
{ {

View File

@ -20,7 +20,7 @@
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "guiengine/widgets.hpp" #include "guiengine/widgets.hpp"
#include "online/profile.hpp" #include "online/online_profile.hpp"
#include "online/request.hpp" #include "online/request.hpp"
#include "utils/ptr_vector.hpp" #include "utils/ptr_vector.hpp"
@ -57,7 +57,7 @@ private:
irr::core::stringw m_last_search_string; irr::core::stringw m_last_search_string;
/** The list of all IDs found. */ /** The list of all IDs found. */
Online::Profile::IDList m_users; Online::OnlineProfile::IDList m_users;
/** The online request to search for users. */ /** The online request to search for users. */
Online::XMLRequest *m_search_request; Online::XMLRequest *m_search_request;

View File

@ -101,7 +101,9 @@ void StateManager::updateActivePlayerIDs()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int StateManager::createActivePlayer(PlayerProfile *profile, InputDevice *device, Online::Profile* user) int StateManager::createActivePlayer(PlayerProfile *profile,
InputDevice *device,
Online::OnlineProfile* user)
{ {
ActivePlayer *p; ActivePlayer *p;
int i; int i;
@ -253,7 +255,7 @@ void StateManager::onStackEmptied()
StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player, StateManager::ActivePlayer::ActivePlayer(PlayerProfile* player,
InputDevice *device, InputDevice *device,
Online::Profile* user) Online::OnlineProfile* user)
{ {
#ifdef DEBUG #ifdef DEBUG
m_magic_number = 0xAC1EF1AE; m_magic_number = 0xAC1EF1AE;

View File

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