summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_env.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-08 10:38:04 +0200
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-08 11:36:28 +0200
commit8bcd10b872bc88c6f474913d6efb8d53c50c5ae1 (patch)
tree39a8af0048ed642eddc43c74ab9f736558663e9d /src/script/lua_api/l_env.cpp
parent0264e38bff12a3c6b81231ac1f6cd281179df744 (diff)
downloadminetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.tar.gz
minetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.tar.bz2
minetest-8bcd10b872bc88c6f474913d6efb8d53c50c5ae1.zip
Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)
* LocalPlayer take ownership of maxHudId as it's the only caller * RemotePlayer take ownership of day night ratio as it's the only user * Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call) * getPlayerSAO is now only RemotePlayer call * get/setHotbarItemCount is now RemotePlayer owned * Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type * PlayerSAO now uses RemotePlayer instead of Player because it's only server side * ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
Diffstat (limited to 'src/script/lua_api/l_env.cpp')
-rw-r--r--src/script/lua_api/l_env.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index ebdea09e4..f6ea23e95 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -494,8 +494,8 @@ int ModApiEnvMod::l_get_player_by_name(lua_State *L)
// Do it
const char *name = luaL_checkstring(L, 1);
- Player *player = env->getPlayer(name);
- if(player == NULL){
+ RemotePlayer *player = dynamic_cast<RemotePlayer *>(env->getPlayer(name));
+ if (player == NULL){
lua_pushnil(L);
return 1;
}