summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 17ab68e7c..8a2ca00a2 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -185,6 +185,7 @@ struct LocalFormspecHandler : public TextDest
/* Form update callback */
+static const std::string empty_string = "";
class NodeMetadataFormSource: public IFormSource
{
public:
@@ -193,12 +194,12 @@ public:
m_p(p)
{
}
- std::string getForm()
+ const std::string &getForm() const
{
NodeMetadata *meta = m_map->getNodeMetadata(m_p);
if (!meta)
- return "";
+ return empty_string;
return meta->getString("formspec");
}
@@ -224,7 +225,8 @@ public:
m_client(client)
{
}
- std::string getForm()
+
+ const std::string &getForm() const
{
LocalPlayer *player = m_client->getEnv().getLocalPlayer();
return player->inventory_formspec;