Add copyFrom for RemoteKartInfo
This commit is contained in:
parent
564ed41ed3
commit
0431344886
@ -1,5 +1,5 @@
|
|||||||
# Modify this file to change the last-modified date when you add/remove a file.
|
# 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_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||||
|
40
src/network/remote_kart_info.cpp
Normal file
40
src/network/remote_kart_info.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2019 SuperTuxKart-Team
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#include "network/remote_kart_info.hpp"
|
||||||
|
#include "network/network_player_profile.hpp"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void RemoteKartInfo::makeReserved()
|
||||||
|
{
|
||||||
|
m_user_name = L"";
|
||||||
|
m_profile.reset();
|
||||||
|
} // makeReserved
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void RemoteKartInfo::copyFrom(std::shared_ptr<NetworkPlayerProfile> p,
|
||||||
|
unsigned local_id)
|
||||||
|
{
|
||||||
|
m_kart_name = p->getKartName();
|
||||||
|
m_user_name = p->getName();
|
||||||
|
m_local_player_id = local_id;
|
||||||
|
m_host_id = p->getHostId();
|
||||||
|
m_difficulty = p->getPerPlayerDifficulty();
|
||||||
|
m_default_kart_color = p->getPerPlayerDifficulty();
|
||||||
|
m_online_id = p->getOnlineId();
|
||||||
|
m_profile = p;
|
||||||
|
} // copyFrom
|
@ -109,7 +109,9 @@ public:
|
|||||||
{ return m_profile; }
|
{ return m_profile; }
|
||||||
bool disconnected() const { return m_profile.expired(); }
|
bool disconnected() const { return m_profile.expired(); }
|
||||||
bool isReserved() const { return m_user_name.empty(); }
|
bool isReserved() const { return m_user_name.empty(); }
|
||||||
void makeReserved() { m_user_name = L""; }
|
void makeReserved();
|
||||||
|
void copyFrom(std::shared_ptr<NetworkPlayerProfile> p,
|
||||||
|
unsigned local_id);
|
||||||
bool operator<(const RemoteKartInfo& other) const
|
bool operator<(const RemoteKartInfo& other) const
|
||||||
{
|
{
|
||||||
return ((m_host_id<other.m_host_id) ||
|
return ((m_host_id<other.m_host_id) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user