summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ints/wrap.hpp17
-rw-r--r--src/map/clif.cpp14
-rw-r--r--src/map/clif.hpp1
-rw-r--r--src/map/map.cpp5
-rw-r--r--src/map/script-fun.cpp26
-rw-r--r--src/wire/packets.cpp1
6 files changed, 39 insertions, 25 deletions
diff --git a/src/ints/wrap.hpp b/src/ints/wrap.hpp
index 707c787..25b03c1 100644
--- a/src/ints/wrap.hpp
+++ b/src/ints/wrap.hpp
@@ -64,6 +64,14 @@ namespace ints
}
template<class T>
+ struct Sub : T
+ {
+ constexpr
+ Sub(typename T::wrapped_type v2)
+ : T(v2)
+ {}
+ };
+ template<class T>
constexpr
typename T::wrapped_type unwrap(typename std::enable_if<true, T>::type w)
{
@@ -73,14 +81,7 @@ namespace ints
constexpr
T wrap(typename T::wrapped_type v)
{
- struct Sub : T
- {
- constexpr
- Sub(typename T::wrapped_type v2)
- : T(v2)
- {}
- };
- return Sub(v);
+ return Sub<T>(v);
}
template<class W>
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index c120428..75c6752 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -3806,6 +3806,20 @@ void clif_message(dumb_ptr<block_list> bl, XString msg)
clif_send(buf, bl, SendWho::AREA, MIN_CLIENT_VERSION);
}
+void clif_npc_send_title(Session *s, BlockId npcid, XString msg)
+{
+ size_t msg_len = msg.size() + 1;
+ if (msg_len > 50)
+ return;
+
+ Packet_Head<0x0228> head_228;
+ head_228.npc_id = npcid;
+ head_228.string_length = msg_len;
+ Buffer buf = create_vpacket<0x0228, 10, 1>(head_228, msg);
+
+ send_buffer(s, buf);
+}
+
/*==========================================
*
*------------------------------------------
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index ecfdb15..ccfab08 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -104,6 +104,7 @@ void clif_sitnpc(dumb_ptr<npc_data> nd, DamageType dmg);
void clif_sitnpc_towards(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd, DamageType dmg);
void clif_setnpcdirection(dumb_ptr<npc_data> nd, DIR direction);
void clif_setnpcdirection_towards(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd, DIR direction);
+void clif_npc_send_title(Session *s, BlockId npcid, XString msg);
// trade
void clif_traderequest(dumb_ptr<map_session_data> sd, CharName name);
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 7d219a9..0c73b59 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -183,7 +183,7 @@ int map_addblock(dumb_ptr<block_list> bl)
if (bl->bl_next)
bl->bl_next->bl_prev = bl;
m->blocks.ref(x / BLOCK_SIZE, y / BLOCK_SIZE).normal = bl;
- if (bl->bl_type == BL::PC)
+ if (bl->bl_type == BL::PC && !bool(bl->is_player()->status.option & Opt0::HIDE))
m->users++;
}
@@ -1237,7 +1237,8 @@ int map_setipport(MapName name, IP4Address ip, int port)
mdos->gat = nullptr;
mdos->ip = ip;
mdos->port = port;
- maps_db.put(mdos->name_, std::move(mdos));
+ MapName mName = mdos->name_;
+ maps_db.put(mName, std::move(mdos));
}
}
OMATCH_END ();
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 3949627..fd8498c 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -66,21 +66,6 @@ namespace tmwa
{
namespace map
{
-static
-Array<LString, 11> pos_str //=
-{{
- "Head"_s,
- "Body"_s,
- "Left hand"_s,
- "Right hand"_s,
- "Robe"_s,
- "Shoes"_s,
- "Accessory 1"_s,
- "Accessory 2"_s,
- "Head 2"_s,
- "Head 3"_s,
- "Not Equipped"_s,
-}};
#define AARG(n) (st->stack->stack_datav[st->start + 2 + (n)])
#define HARG(n) (st->end > st->start + 2 + (n))
@@ -2675,6 +2660,16 @@ void builtin_message(ScriptState *st)
}
+static
+void builtin_title(ScriptState *st)
+{
+ dumb_ptr<map_session_data> sd = script_rid2sd(st);
+ ZString msg = ZString(conv_str(st, &AARG(0)));
+ if (sd == nullptr)
+ return;
+ clif_npc_send_title(sd->sess, st->oid, msg);
+}
+
/*==========================================
* npctalk (sends message to surrounding
* area) [Valaris]
@@ -3145,6 +3140,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(npcareawarp, "xyxyis"_s, '\0'),
BUILTIN(message, "Ps"_s, '\0'),
BUILTIN(npctalk, "s"_s, '\0'),
+ BUILTIN(title, "s"_s, '\0'),
BUILTIN(getlook, "i"_s, 'i'),
BUILTIN(getsavepoint, "i"_s, '.'),
BUILTIN(areatimer, "MxyxytE"_s, '\0'),
diff --git a/src/wire/packets.cpp b/src/wire/packets.cpp
index be06283..22a996a 100644
--- a/src/wire/packets.cpp
+++ b/src/wire/packets.cpp
@@ -76,6 +76,7 @@ void packet_dump(Session *s)
if ((i & 15) == 0)
FPRINTF(stderr, "%04X "_fmt, i);
Byte rfifob_ib;
+ rfifob_ib.value = 0;
packet_fetch(s, i, &rfifob_ib, 1);
uint8_t rfifob_i = rfifob_ib.value;
FPRINTF(stderr, "%02x "_fmt, rfifob_i);