From 409eefb2cd4863c4defe8e4b30677db5363d58e3 Mon Sep 17 00:00:00 2001 From: placki Date: Wed, 2 Nov 2011 13:36:58 +0100 Subject: [PATCH] client display of teleport names and destination --- src/game.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/game.cpp b/src/game.cpp index 46c7a09..91714e1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1798,7 +1798,32 @@ void the_game( NodeMetadata *meta = client.getNodeMetadata(nodepos); if(meta) { + //HACK: server should not be sending teleport info to clients at all... infotext = narrow_to_wide(meta->infoText()); + MapNode n = client.getNode(nodepos); + if(n.getContent() == CONTENT_TELEPORT) + { + // meta/infotext contains text inside "" quotes. + // find 3rd comma + int icomma=infotext.find(L','); + if(icomma>0) + icomma=infotext.find(L',',icomma+1); + if(icomma>0) + icomma=infotext.find(L',',icomma+1); + + if(!canModify) + { + if(icomma<0) + infotext = L"Unnamed teleport"; + else + infotext=L"Teleport: "+infotext.substr(icomma+1,infotext.length()-icomma-2); + } + else + { + if(icomma<0) + infotext = infotext.substr(0,infotext.length()-1)+L",Unnamed\""; + } + } } //MapNode node = client.getNode(nodepos);