From 6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 24 Mar 2016 14:32:09 -0400 Subject: remove MESSAGE npc subtype --- src/map/map.hpp | 10 ---------- src/map/npc-parse.cpp | 30 ------------------------------ src/map/npc-parse.hpp | 8 -------- src/map/npc.cpp | 22 +--------------------- 4 files changed, 1 insertion(+), 69 deletions(-) (limited to 'src') diff --git a/src/map/map.hpp b/src/map/map.hpp index 1fd86d1..2919d04 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -342,12 +342,10 @@ private: dumb_ptr as_script(); dumb_ptr as_shop(); dumb_ptr as_warp(); - dumb_ptr as_message(); public: dumb_ptr is_script(); dumb_ptr is_shop(); dumb_ptr is_warp(); - dumb_ptr is_message(); }; class npc_data_script : public npc_data @@ -402,12 +400,6 @@ public: } warp; }; -class npc_data_message : public npc_data -{ -public: - RString message; -}; - constexpr int MOB_XP_BONUS_BASE = 1024; constexpr int MOB_XP_BONUS_SHIFT = 10; @@ -684,12 +676,10 @@ inline dumb_ptr block_list::is_item() { return bl_type == BL::IT inline dumb_ptr npc_data::as_script() { return dumb_ptr(static_cast(this)) ; } inline dumb_ptr npc_data::as_shop() { return dumb_ptr(static_cast(this)) ; } inline dumb_ptr npc_data::as_warp() { return dumb_ptr(static_cast(this)) ; } -inline dumb_ptr npc_data::as_message() { return dumb_ptr(static_cast(this)) ; } inline dumb_ptr npc_data::is_script() { return npc_subtype == NpcSubtype::SCRIPT ? as_script() : nullptr ; } inline dumb_ptr npc_data::is_shop() { return npc_subtype == NpcSubtype::SHOP ? as_shop() : nullptr ; } inline dumb_ptr npc_data::is_warp() { return npc_subtype == NpcSubtype::WARP ? as_warp() : nullptr ; } -inline dumb_ptr npc_data::is_message() { return npc_subtype == NpcSubtype::MESSAGE ? as_message() : nullptr ; } void map_addmap(MapName mapname); void map_delmap(MapName mapname); diff --git a/src/map/npc-parse.cpp b/src/map/npc-parse.cpp index e30225a..164d793 100644 --- a/src/map/npc-parse.cpp +++ b/src/map/npc-parse.cpp @@ -99,12 +99,9 @@ void register_npc_name(dumb_ptr nd) "WARP"_s, "SHOP"_s, "SCRIPT"_s, - "MESSAGE"_s, }}; if (!nd->name) { - if (nd->npc_subtype == NpcSubtype::MESSAGE) - return; PRINTF("WARNING: npc with no name:\n%s @ %s,%d,%d\n"_fmt, types[nd->npc_subtype], nd->bl_m->name_, nd->bl_x, nd->bl_y); @@ -655,33 +652,6 @@ bool npc_load_script_any(ast::npc::Script *script) abort(); } -dumb_ptr npc_spawn_text(Borrowed m, int x, int y, - Species npc_class, NpcName name, AString message) -{ - dumb_ptr retval; - retval.new_(); - retval->bl_id = npc_get_new_npc_id(); - retval->bl_x = x; - retval->bl_y = y; - retval->bl_m = m; - retval->bl_type = BL::NPC; - retval->npc_subtype = NpcSubtype::MESSAGE; - - retval->name = name; - if (message) - retval->message = message; - - retval->npc_class = npc_class; - retval->speed = 200_ms; - - clif_spawnnpc(retval); - map_addblock(retval); - map_addiddb(retval); - register_npc_name(retval); - - return retval; -} - static bool load_one_npc(io::LineCharReader& fp, bool& done) { diff --git a/src/map/npc-parse.hpp b/src/map/npc-parse.hpp index d6719ee..f436fb9 100644 --- a/src/map/npc-parse.hpp +++ b/src/map/npc-parse.hpp @@ -29,14 +29,6 @@ namespace map { bool npc_load_warp(ast::npc::Warp& warp); -/** - * Spawns and installs a talk-only NPC - * - * \param message The message to speak. If message is nullptr, the NPC will not do anything at all. - */ -dumb_ptr npc_spawn_text(Borrowed m, int x, int y, - Species class_, NpcName name, AString message); - void npc_addsrcfile(AString name); void npc_delsrcfile(XString name); void register_npc_name(dumb_ptr nd); diff --git a/src/map/npc.cpp b/src/map/npc.cpp index b7fb9ca..a8c90d8 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -669,11 +669,6 @@ int npc_touch_areanpc(dumb_ptr sd, Borrowed m, int xs = m->npc[i]->is_warp()->warp.xs; ys = m->npc[i]->is_warp()->warp.ys; break; - case NpcSubtype::MESSAGE: - assert (0 && "I'm pretty sure these are never put on a map"_s); - xs = 0; - ys = 0; - break; case NpcSubtype::SCRIPT: xs = m->npc[i]->is_script()->scr.xs; ys = m->npc[i]->is_script()->scr.ys; @@ -703,9 +698,6 @@ int npc_touch_areanpc(dumb_ptr sd, Borrowed m, int pc_setpos(sd, m->npc[i]->is_warp()->warp.name, m->npc[i]->is_warp()->warp.x, m->npc[i]->is_warp()->warp.y, BeingRemoveWhy::GONE); break; - case NpcSubtype::MESSAGE: - assert (0 && "I'm pretty sure these NPCs are never put on a map."_s); - break; case NpcSubtype::SCRIPT: { NpcEvent aname; @@ -793,13 +785,6 @@ int npc_click(dumb_ptr sd, BlockId id) case NpcSubtype::SCRIPT: sd->npc_pos = run_script(ScriptPointer(script_or_parent(nd->is_script()), 0), sd->bl_id, id); break; - case NpcSubtype::MESSAGE: - if (nd->is_message()->message) - { - clif_scriptmes(sd, id, nd->is_message()->message); - clif_scriptclose(sd, id); - } - break; } return 0; @@ -825,7 +810,7 @@ int npc_scriptcont(dumb_ptr sd, BlockId id) nd = map_id_is_npc(id); - if (!nd /* NPC was disposed? */ || nd->npc_subtype == NpcSubtype::MESSAGE) + if (!nd /* NPC was disposed? */) { clif_scriptclose(sd, id); npc_event_dequeue(sd); @@ -1023,11 +1008,6 @@ void npc_free_internal(dumb_ptr nd_) nd->scr.script.reset(); nd->scr.label_listv.clear(); } - else if (nd_->npc_subtype == NpcSubtype::MESSAGE) - { - dumb_ptr nd = nd_->is_message(); - nd->message = AString(); - } if (nd_->name) npcs_by_name.put(nd_->name, nullptr); nd_.delete_(); -- cgit v1.2.3-60-g2f50