diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 6e2a36c..559f750 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -391,7 +391,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data, video::SColor c = MapBlock_LightColor(255, l);*/ video::SColor c(0xFFFFFFFF); - float d = (float)BS/16; + float d = BS/8; // Wall at X+ of node /*video::S3DVertex vertices[4] = { diff --git a/src/game.cpp b/src/game.cpp index 4482a49..baad032 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -50,6 +50,8 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "content_mapnode.h" #include "content_nodemeta.h" +#include "teleports.h" + /* Setting this to 1 enables a special camera mode that forces @@ -457,8 +459,8 @@ void getPointedNode(Client *client, v3f player_position, };*/ v3f vertices[4] = { - v3f(BS*0.42,-BS*0.8,-BS*0.8), - v3f(BS*0.49, BS*0.8, BS*0.8), + v3f(BS*0.37,-BS*0.8,-BS*0.8), + v3f(BS*0.42, BS*0.8, BS*0.8), }; for(s32 i=0; i<2; i++) @@ -469,12 +471,12 @@ void getPointedNode(Client *client, v3f player_position, vertices[i].rotateXYBy(90); else{ if(dir == v3s16(1,0,0)) - vertices[i].rotateXZBy(0); - if(dir == v3s16(-1,0,0)) + ;//vertices[i].rotateXZBy(0); + else if(dir == v3s16(-1,0,0)) vertices[i].rotateXZBy(180); - if(dir == v3s16(0,0,1)) + else if(dir == v3s16(0,0,1)) vertices[i].rotateXZBy(90); - if(dir == v3s16(0,0,-1)) + else if(dir == v3s16(0,0,-1)) vertices[i].rotateXZBy(-90); vertices[i].Y += BS/2; } @@ -1807,6 +1809,33 @@ void the_game( content_t content = map->getNodeNoEx(nodepos).getContent(); if(content == CONTENT_TELEPORT) { + try{ + SignNodeMetadata& smeta = dynamic_cast(*meta); + std::string txt = smeta.getText(); + TeleportInfo ti; + if(getTeleportInfo(ti,txt,true,true,false)){ + if(!ti.description.empty()) + txt = ti.description; + else if(ti.targetLocation.X!=TELEPORT_IGNORE){ + std::ostringstream oss; + oss << "Destination: " + << ti.targetLocation.X << ", " + << ti.targetLocation.Y << ", " + << ti.targetLocation.Z; + txt = oss.str(); + } else { + txt.clear(); + if(!ti.thisName.empty()) + txt = "Portal name: " + ti.thisName; + if(!ti.targetName.empty()){ + if(!ti.thisName.empty()) + txt += " | "; + txt += "Target portal: " + ti.targetName; + } + } + infotext = narrow_to_wide(txt); + }else infotext.clear(); + }catch(std::bad_cast&){} //bad meta data for a teleport // meta/infotext contains text inside "" quotes. // find 3rd comma /*int icomma=infotext.find(L','); diff --git a/src/server.cpp b/src/server.cpp index 942075b..2233c63 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1832,9 +1832,8 @@ bool getTeleportTarget(/*const*/ ServerEnvironment& env,/*in+out*/ v3s16 &where, else { // check player "head block" where.Y++; - if(where.Ysecond; - os << it->first << ' '; //name + std::string name = it->first; + str_replace_char(name,' ','\xFF'); + os << name << ' '; //name for(int i=0; i<2; i++) //coords if(t.coords[i].X == TELEPORT_IGNORE) //if coord ignored - don't save Y and Z os << TELEPORT_IGNORE << ' '; @@ -120,8 +122,9 @@ void TeleportsManager::load(Settings& args) while(is.good() && !is.eof()){ std::string name; is >> name; - if(name.length() == 0) continue; if(is.bad() || is.eof()) break; + if(name.length() == 0) continue; + str_replace_char(name,'\xFF',' '); for(int i=0; i<2; i++){ v3s16 v; is >> v.X; @@ -196,7 +199,7 @@ bool getTeleportInfo(TeleportInfo& ti, const std::string& text, bool allowCoords //find if parts[0] has target name int pos = parts[0].find("->"); - if(!allowUnnamed && pos==0) JLOGAND("no 'thisname'", return false;) //no 'thisname' specified + if(!allowUnnamed && pos==0) JLOGAND("missing 'thisname'", return false;) //no 'thisname' specified if(pos != std::string::npos){ //yes, split it to 'thisname' and 'targetname' if(pos>0) ti.thisName = trim(parts[0].substr(0,pos)); diff --git a/src/teleports.h b/src/teleports.h index 4538215..de1937a 100644 --- a/src/teleports.h +++ b/src/teleports.h @@ -77,7 +77,7 @@ private: -#if 1 +#ifndef NDEBUG #define JLOG(x) std::cout << x << std::endl #define JV3(x) '[' << x.X << ',' << x.Y << ',' << x.Z << ']' #define JLOGAND(x,y) { JLOG(x); y } diff --git a/src/utility.h b/src/utility.h index 143a7a0..c08ce1c 100644 --- a/src/utility.h +++ b/src/utility.h @@ -907,7 +907,7 @@ inline float stof(std::string s) //throws if error template -inline T stonum_ex(const typename Str& s) +inline T stonum_ex(const Str& s) { typedef typename Str::value_type char_t; T f;