summaryrefslogtreecommitdiff
path: root/src/emap/script_buildins.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r--src/emap/script_buildins.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index de5ba06..9430eb7 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -20,6 +20,7 @@
#include "map/mapreg.h"
#include "map/npc.h"
#include "map/pc.h"
+#include "map/refine.h"
#include "map/script.h"
#include "map/quest.h"
@@ -1321,7 +1322,8 @@ BUILDIN(failedRemoveCardsIndex)
if (sd->status.inventory[i].card[c] && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD)
{
cardflag = 1;
- sd->status.inventory[i].card[c] = 0;
+ if (typefail == 1)
+ sd->status.inventory[i].card[c] = 0;
if (typefail == 2)
{ // add cards to inventory, clear
@@ -1507,6 +1509,12 @@ BUILDIN(npcWalkTo)
if (nd)
{
unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit
+ if (nd->ud == NULL)
+ {
+ ShowWarning("buildin_npcwalkto: floating NPC don't have unit data.\n");
+ return false;
+ }
+
if (!nd->status.hp)
{
status_calc_npc(nd, SCO_FIRST);
@@ -1516,7 +1524,7 @@ BUILDIN(npcWalkTo)
status_calc_npc(nd, SCO_NONE);
}
nd->vd.dead_sit = 0;
- script_pushint(st, unit->walktoxy(&nd->bl,x,y,0));
+ script_pushint(st, unit->walktoxy(&nd->bl, x, y, 0));
return true;
}
else