diff options
author | mekolat <mekolat@users.noreply.github.com> | 2016-05-13 18:47:36 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2016-05-13 18:47:36 -0400 |
commit | 4b79c22885a32b50b9aa0846eb89961543b5a59e (patch) | |
tree | 462f3aa3bc54370137fd98e205905edc479d9241 | |
parent | ceb7acf8291867d56b53c3f696a39e91fd79da59 (diff) | |
parent | 6707cc577dcd2ec06d6936036b93d75cda71c6b3 (diff) | |
download | tmwa-4b79c22885a32b50b9aa0846eb89961543b5a59e.tar.gz tmwa-4b79c22885a32b50b9aa0846eb89961543b5a59e.tar.bz2 tmwa-4b79c22885a32b50b9aa0846eb89961543b5a59e.tar.xz tmwa-4b79c22885a32b50b9aa0846eb89961543b5a59e.zip |
Merge pull request #224 from mekolat/npctalk
Npctalk modifications
-rw-r--r-- | src/map/battle.cpp | 7 | ||||
-rw-r--r-- | src/map/clif.cpp | 3 | ||||
-rw-r--r-- | src/map/script-fun.cpp | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 031b79d..df01a5c 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -197,7 +197,12 @@ VString<23> battle_get_name(dumb_ptr<block_list> bl) name = bl->is_player()->status_key.name.to__actual(); break; case BL::NPC: - name = bl->is_npc()->name; + { + name = bl->is_npc()->name; + // [fate] elim hashed out/invisible names for the client + auto it = std::find(name.begin(), name.end(), '#'); + name = name.xislice_h(it); + } break; case BL::MOB: name = bl->is_mob()->name; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index d4b16a7..94a6dd1 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3809,7 +3809,8 @@ static void clif_message_sub(Buffer& buf, dumb_ptr<block_list> bl, AString msg) { VString<23> name = battle_get_name(bl); - msg = STRPRINTF("%s : %s"_fmt, name, msg); + if (name.size() >= 4) // client limitation + msg = STRPRINTF("%s : %s"_fmt, name, msg); size_t msg_len = msg.size() + 1; if (msg_len + 16 > 512) return; diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 98c07ed..8ec0d4a 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -4252,9 +4252,9 @@ void builtin_npctalk(ScriptState *st) dumb_ptr<npc_data> nd; RString str = conv_str(st, &AARG(1)); - dumb_ptr<npc_data> nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0))))); - assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT); - nd = nd_->is_script(); + nd = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0))))); + if (nd == nullptr) + return; if(HARG(2)){ |