From: Loic Blot Date: Thu, 8 Mar 2018 21:03:45 +0000 (+0100) Subject: Cleanup: drop Server::hudGetHotbarItemcount() X-Git-Tag: 5.0.0~549 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=373f1bfb4ab5e48a9538e5ee561eb41174725c1c;p=oweals%2Fminetest.git Cleanup: drop Server::hudGetHotbarItemcount() Call directly accessible RemotePlayer::getHotbarItemcount() from server api --- diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 3afd21ec3..ce2bce85e 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -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; } diff --git a/src/server.cpp b/src/server.cpp index 24fbb38c8..aa0961f9a 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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) diff --git a/src/server.h b/src/server.h index 13c21067c..c189860a5 100644 --- a/src/server.h +++ b/src/server.h @@ -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);