summaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-08 23:13:38 +0200
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-09 15:17:10 +0200
commit70f104be076321330a0827010704761a040d8ec7 (patch)
treee6d297b317cb37f85f51f65164bf0537ee8586d1 /src/content_cao.cpp
parentb3fc133442724cc2785d0c7e2beea2d782d8a087 (diff)
downloadminetest-70f104be076321330a0827010704761a040d8ec7.tar.gz
minetest-70f104be076321330a0827010704761a040d8ec7.tar.bz2
minetest-70f104be076321330a0827010704761a040d8ec7.zip
Environment cleanup
* Move client list to ServerEnvironment and use RemotePlayer members instead of Player * ClientEnvironment only use setLocalPlayer to specify the current player * Remove ClientEnvironment dead code on player list (in fact other players are CAO not Player objects) * Drop LocalPlayer::getPlayer(xxx) functions which aren't used. * Improve a little bit performance by using const ref list for ClientEnvironment::getPlayerNames() & Client::getConnectedPlayerNames() * Drop isLocal() function from (Local)Player which is not needed anymore because of previous changes This change permits to cleanup shared client list which is very old code. ClientEnvironment doesn't use player list anymore, it only contains the local player, as addPlayer is only called from Client constructor client side. Clients are only CAO on client side, this cleanup permit to remove confusion about player list.
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index a53768149..00e17f328 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -653,10 +653,10 @@ void GenericCAO::initialize(const std::string &data)
pos_translator.init(m_position);
updateNodePos();
- if(m_is_player)
- {
- LocalPlayer *player = m_env->getPlayer(m_name.c_str());
- if (player && player->isLocal()) {
+ if (m_is_player) {
+ // Check if it's the current player
+ LocalPlayer *player = m_env->getLocalPlayer();
+ if (player && strcmp(player->getName(), m_name.c_str()) == 0) {
m_is_local_player = true;
m_is_visible = false;
LocalPlayer* localplayer = player;