From 8bcd10b872bc88c6f474913d6efb8d53c50c5ae1 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sat, 8 Oct 2016 10:38:04 +0200 Subject: 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 --- src/script/lua_api/l_object.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/script/lua_api/l_object.h') diff --git a/src/script/lua_api/l_object.h b/src/script/lua_api/l_object.h index a37d29535..a7ac9dff9 100644 --- a/src/script/lua_api/l_object.h +++ b/src/script/lua_api/l_object.h @@ -27,6 +27,7 @@ class ServerActiveObject; class LuaEntitySAO; class PlayerSAO; class Player; +class RemotePlayer; /* ObjectRef @@ -47,7 +48,7 @@ private: static PlayerSAO* getplayersao(ObjectRef *ref); - static Player* getplayer(ObjectRef *ref); + static RemotePlayer* getplayer(ObjectRef *ref); // Exported functions -- cgit v1.2.3