summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-03-24 14:32:09 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:47:24 -0400
commit6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8 (patch)
tree811c8fc97471c8241aeae9acc3a9749a26e5fdc9
parent502b3b714f0f636dac80bd600e174a173bd7028e (diff)
downloadtmwa-6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8.tar.gz
tmwa-6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8.tar.bz2
tmwa-6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8.tar.xz
tmwa-6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8.zip
remove MESSAGE npc subtype
-rw-r--r--src/map/map.hpp10
-rw-r--r--src/map/npc-parse.cpp30
-rw-r--r--src/map/npc-parse.hpp8
-rw-r--r--src/map/npc.cpp22
4 files changed, 1 insertions, 69 deletions
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<npc_data_script> as_script();
dumb_ptr<npc_data_shop> as_shop();
dumb_ptr<npc_data_warp> as_warp();
- dumb_ptr<npc_data_message> as_message();
public:
dumb_ptr<npc_data_script> is_script();
dumb_ptr<npc_data_shop> is_shop();
dumb_ptr<npc_data_warp> is_warp();
- dumb_ptr<npc_data_message> 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<flooritem_data> block_list::is_item() { return bl_type == BL::IT
inline dumb_ptr<npc_data_script> npc_data::as_script() { return dumb_ptr<npc_data_script>(static_cast<npc_data_script *>(this)) ; }
inline dumb_ptr<npc_data_shop> npc_data::as_shop() { return dumb_ptr<npc_data_shop>(static_cast<npc_data_shop *>(this)) ; }
inline dumb_ptr<npc_data_warp> npc_data::as_warp() { return dumb_ptr<npc_data_warp>(static_cast<npc_data_warp *>(this)) ; }
-inline dumb_ptr<npc_data_message> npc_data::as_message() { return dumb_ptr<npc_data_message>(static_cast<npc_data_message *>(this)) ; }
inline dumb_ptr<npc_data_script> npc_data::is_script() { return npc_subtype == NpcSubtype::SCRIPT ? as_script() : nullptr ; }
inline dumb_ptr<npc_data_shop> npc_data::is_shop() { return npc_subtype == NpcSubtype::SHOP ? as_shop() : nullptr ; }
inline dumb_ptr<npc_data_warp> npc_data::is_warp() { return npc_subtype == NpcSubtype::WARP ? as_warp() : nullptr ; }
-inline dumb_ptr<npc_data_message> 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<npc_data> 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_data> npc_spawn_text(Borrowed<map_local> m, int x, int y,
- Species npc_class, NpcName name, AString message)
-{
- dumb_ptr<npc_data_message> 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_data> npc_spawn_text(Borrowed<map_local> 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<npc_data> 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<map_session_data> sd, Borrowed<map_local> 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<map_session_data> sd, Borrowed<map_local> 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<map_session_data> 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<map_session_data> 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<npc_data> nd_)
nd->scr.script.reset();
nd->scr.label_listv.clear();
}
- else if (nd_->npc_subtype == NpcSubtype::MESSAGE)
- {
- dumb_ptr<npc_data_message> nd = nd_->is_message();
- nd->message = AString();
- }
if (nd_->name)
npcs_by_name.put(nd_->name, nullptr);
nd_.delete_();