From becc8312ff9a373ba22760ba89cdff6fe5e4895a Mon Sep 17 00:00:00 2001 From: mekolat Date: Sat, 23 Apr 2016 14:42:18 -0400 Subject: forbid puppet creation if name already exists --- src/map/script-fun.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 13a635d..b39a763 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -1121,6 +1121,13 @@ void builtin_puppet(ScriptState *st) { int x, y; + NpcName npc = stringish(ZString(conv_str(st, &AARG(3)))); + if (npc_name2id(npc) != nullptr) + { + push_int(st->stack, 0); + return; + } + dumb_ptr bl = map_id2bl(st->oid); dumb_ptr parent_nd = bl->is_npc()->is_script(); dumb_ptr nd; @@ -1137,7 +1144,6 @@ void builtin_puppet(ScriptState *st) nd->scr.event_needs_map = false; // PlayerName::SpellName - NpcName npc = stringish(ZString(conv_str(st, &AARG(3)))); nd->name = npc; // Dynamically set location -- cgit v1.2.3-60-g2f50