aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2018-03-08 22:05:47 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-03-08 23:00:17 +0100
commit4be46aeeb17c42718ecea14934e24d77772b4126 (patch)
treec38820ab515ea3edd167b2c475189b448548a36c /src
parent373f1bfb4ab5e48a9538e5ee561eb41174725c1c (diff)
downloadminetest-4be46aeeb17c42718ecea14934e24d77772b4126.tar.gz
minetest-4be46aeeb17c42718ecea14934e24d77772b4126.tar.bz2
minetest-4be46aeeb17c42718ecea14934e24d77772b4126.zip
Cleanup: drop Server::hudGetHotbarImage()
Call directly accessible RemotePlayer::getHotbarImage() from server api & make it const ref
Diffstat (limited to 'src')
-rw-r--r--src/remoteplayer.h2
-rw-r--r--src/script/lua_api/l_object.cpp2
-rw-r--r--src/server.cpp7
-rw-r--r--src/server.h1
4 files changed, 2 insertions, 10 deletions
diff --git a/src/remoteplayer.h b/src/remoteplayer.h
index 6ecdb2798..ed0f21b42 100644
--- a/src/remoteplayer.h
+++ b/src/remoteplayer.h
@@ -71,7 +71,7 @@ public:
void setHotbarImage(const std::string &name) { hud_hotbar_image = name; }
- std::string getHotbarImage() const { return hud_hotbar_image; }
+ const std::string &getHotbarImage() const { return hud_hotbar_image; }
void setHotbarSelectedImage(const std::string &name)
{
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index ce2bce85e..13b538f0c 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1490,7 +1490,7 @@ int ObjectRef::l_hud_get_hotbar_image(lua_State *L)
if (player == NULL)
return 0;
- std::string name = getServer(L)->hudGetHotbarImage(player);
+ const std::string &name = player->getHotbarImage();
lua_pushlstring(L, name.c_str(), name.size());
return 1;
}
diff --git a/src/server.cpp b/src/server.cpp
index aa0961f9a..fbd656f37 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3099,13 +3099,6 @@ void Server::hudSetHotbarImage(RemotePlayer *player, std::string name)
SendHUDSetParam(player->getPeerId(), HUD_PARAM_HOTBAR_IMAGE, name);
}
-std::string Server::hudGetHotbarImage(RemotePlayer *player)
-{
- if (!player)
- return "";
- return player->getHotbarImage();
-}
-
void Server::hudSetHotbarSelectedImage(RemotePlayer *player, std::string name)
{
if (!player)
diff --git a/src/server.h b/src/server.h
index c189860a5..7b3fe61e2 100644
--- a/src/server.h
+++ b/src/server.h
@@ -291,7 +291,6 @@ public:
bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
void hudSetHotbarImage(RemotePlayer *player, std::string name);
- std::string hudGetHotbarImage(RemotePlayer *player);
void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;