diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-01-16 18:18:57 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-01-17 17:35:36 -0800 |
commit | d0e9a569f832fae6a91d163c6c8b93f7eb924ff5 (patch) | |
tree | 8499075d69e3b00bf12c16da6a52ef4d7e98be2f /src/map/script.cpp | |
parent | b34acd1a97e7f087882675e812fda04d303dc6e0 (diff) | |
download | tmwa-d0e9a569f832fae6a91d163c6c8b93f7eb924ff5.tar.gz tmwa-d0e9a569f832fae6a91d163c6c8b93f7eb924ff5.tar.bz2 tmwa-d0e9a569f832fae6a91d163c6c8b93f7eb924ff5.tar.xz tmwa-d0e9a569f832fae6a91d163c6c8b93f7eb924ff5.zip |
Clean up some things after declassization
Diffstat (limited to 'src/map/script.cpp')
-rw-r--r-- | src/map/script.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/script.cpp b/src/map/script.cpp index e774080..093ced9 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -34,6 +34,8 @@ #include "skill.hpp" #include "storage.hpp" +#include "../poison.hpp" + //#define DEBUG_FUNCIN //#define DEBUG_DISP //#define DEBUG_RUN @@ -2061,11 +2063,12 @@ void builtin_checkweight(ScriptState *st) amount = conv_num(st, &(st->stack->stack_data[st->start + 3])); if (amount <= 0 || nameid < 500) - { //if get wrong item ID or amount<=0, don't count weight of non existing items + { + //if get wrong item ID or amount<=0, don't count weight of non existing items push_val(st->stack, ScriptCode::INT, 0); + return; } - sd = script_rid2sd(st); if (itemdb_weight(nameid) * amount + sd->weight > sd->max_weight) { push_val(st->stack, ScriptCode::INT, 0); @@ -2228,11 +2231,11 @@ void builtin_delitem(ScriptState *st) amount = conv_num(st, &(st->stack->stack_data[st->start + 3])); if (nameid < 500 || amount <= 0) - { //by Lupus. Don't run FOR if u got wrong item ID or amount<=0 + { + //by Lupus. Don't run FOR if u got wrong item ID or amount<=0 //PRINTF("wrong item ID or amount<=0 : delitem %i,\n",nameid,amount); return; } - sd = script_rid2sd(st); for (i = 0; i < MAX_INVENTORY; i++) { @@ -4833,7 +4836,7 @@ void run_script_main(const ScriptCode *script, int pos_, int, int, { if (sd->npc_stackbuf) free(sd->npc_stackbuf); - sd->npc_stackbuf = (char *) + sd->npc_stackbuf = (struct script_data *) calloc(sizeof(stack->stack_data[0]) * stack->sp_max, 1); memcpy(sd->npc_stackbuf, stack->stack_data, sizeof(stack->stack_data[0]) * stack->sp_max); |