diff options
author | mekolat <mekolat@users.noreply.github.com> | 2016-04-23 14:42:18 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2016-04-23 15:01:58 -0400 |
commit | becc8312ff9a373ba22760ba89cdff6fe5e4895a (patch) | |
tree | 73a4dd54a36ff0cdd863df9d27e9a18d09851539 /src/map | |
parent | 48b9900248f74b8dc5179e34e851047e05c862b3 (diff) | |
download | tmwa-becc8312ff9a373ba22760ba89cdff6fe5e4895a.tar.gz tmwa-becc8312ff9a373ba22760ba89cdff6fe5e4895a.tar.bz2 tmwa-becc8312ff9a373ba22760ba89cdff6fe5e4895a.tar.xz tmwa-becc8312ff9a373ba22760ba89cdff6fe5e4895a.zip |
forbid puppet creation if name already exists
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/script-fun.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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<NpcName>(ZString(conv_str(st, &AARG(3)))); + if (npc_name2id(npc) != nullptr) + { + push_int<ScriptDataInt>(st->stack, 0); + return; + } + dumb_ptr<block_list> bl = map_id2bl(st->oid); dumb_ptr<npc_data_script> parent_nd = bl->is_npc()->is_script(); dumb_ptr<npc_data_script> nd; @@ -1137,7 +1144,6 @@ void builtin_puppet(ScriptState *st) nd->scr.event_needs_map = false; // PlayerName::SpellName - NpcName npc = stringish<NpcName>(ZString(conv_str(st, &AARG(3)))); nd->name = npc; // Dynamically set location |