summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-04 05:12:33 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-04 05:12:33 +0300
commitfa736e138c2eb04f50bcc0431fc5a0435bf34bc6 (patch)
treeec56483bbb6196b5959d9c43a16e04f3b26e227b /src/main.cpp
parentfa08294d09a46b603e9ff5e034010c0a7986c61a (diff)
downloadminetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.tar.gz
minetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.tar.bz2
minetest-fa736e138c2eb04f50bcc0431fc5a0435bf34bc6.zip
fully implemented the sign with the new framework
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4b968865f..c9099f69b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -578,6 +578,25 @@ struct TextDestChat : public TextDest
Client *m_client;
};
+struct TextDestSignNode : public TextDest
+{
+ TextDestSignNode(v3s16 p, Client *client)
+ {
+ m_p = p;
+ m_client = client;
+ }
+ void gotText(std::wstring text)
+ {
+ std::string ntext = wide_to_narrow(text);
+ dstream<<"Changing text of a sign node: "
+ <<ntext<<std::endl;
+ m_client->sendSignNodeText(m_p, ntext);
+ }
+
+ v3s16 m_p;
+ Client *m_client;
+};
+
class MyEventReceiver : public IEventReceiver
{
public:
@@ -2829,6 +2848,8 @@ int main(int argc, char *argv[])
{
infotext = narrow_to_wide(meta->infoText());
}
+
+ //MapNode node = client.getNode(nodepos);
/*
Handle digging
@@ -2956,7 +2977,31 @@ int main(int argc, char *argv[])
if(g_input->getRightClicked())
{
std::cout<<DTIME<<"Ground right-clicked"<<std::endl;
- client.groundAction(1, nodepos, neighbourpos, g_selected_item);
+
+ if(meta && meta->typeId() == CONTENT_SIGN_WALL)
+ {
+ dstream<<"Sign node right-clicked"<<std::endl;
+
+ if(random_input == false)
+ {
+ // Get a new text for it
+
+ TextDest *dest = new TextDestSignNode(nodepos, &client);
+
+ SignNodeMetadata *signmeta = (SignNodeMetadata*)meta;
+
+ std::wstring wtext =
+ narrow_to_wide(signmeta->getText());
+
+ (new GUITextInputMenu(guienv, guiroot, -1,
+ &g_menumgr, dest,
+ wtext))->drop();
+ }
+ }
+ else
+ {
+ client.groundAction(1, nodepos, neighbourpos, g_selected_item);
+ }
}
nodepos_old = nodepos;