Cleanup: drop Server::hudGetHotbarItemcount()
authorLoic Blot <loic.blot@unix-experience.fr>
Thu, 8 Mar 2018 21:03:45 +0000 (22:03 +0100)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Thu, 8 Mar 2018 22:00:17 +0000 (23:00 +0100)
Call directly accessible RemotePlayer::getHotbarItemcount() from server api

src/script/lua_api/l_object.cpp
src/server.cpp
src/server.h

index 3afd21ec3b22a910cc3175e8877322c19f8a2fa3..ce2bce85e35c6ed5e3a07c1d932ed4d25a2e2afe 100644 (file)
@@ -1462,9 +1462,7 @@ int ObjectRef::l_hud_get_hotbar_itemcount(lua_State *L)
        if (player == NULL)
                return 0;
 
-       s32 hotbar_itemcount = getServer(L)->hudGetHotbarItemcount(player);
-
-       lua_pushnumber(L, hotbar_itemcount);
+       lua_pushnumber(L, player->getHotbarItemcount());
        return 1;
 }
 
index 24fbb38c86d402887bbd3cebfbc2921d7c2435c5..aa0961f9a930bb2c223b95bfc8e21e5defed003f 100644 (file)
@@ -317,7 +317,7 @@ Server::~Server()
 
        {
                MutexAutoLock envlock(m_env_mutex);
-               
+
                infostream << "Server: Saving players" << std::endl;
                m_env->saveLoadedPlayers();
 
@@ -3090,11 +3090,6 @@ bool Server::hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount)
        return true;
 }
 
-s32 Server::hudGetHotbarItemcount(RemotePlayer *player) const
-{
-       return player->getHotbarItemcount();
-}
-
 void Server::hudSetHotbarImage(RemotePlayer *player, std::string name)
 {
        if (!player)
index 13c21067c5dd42af0ea79933331d5cc5a16ffc5d..c189860a580d7043c6e578452f30940d7af2e561 100644 (file)
@@ -290,7 +290,6 @@ public:
        bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value);
        bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
        bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
-       s32 hudGetHotbarItemcount(RemotePlayer *player) const;
        void hudSetHotbarImage(RemotePlayer *player, std::string name);
        std::string hudGetHotbarImage(RemotePlayer *player);
        void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);