diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-21 21:30:46 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-21 21:30:46 +0000 |
commit | 8f049e98306b7eaae81ea7df0a837d91ef21d438 (patch) | |
tree | 7859169f389643fb0f30df7ec801caa43bf44434 /src/map/npc.c | |
parent | 6537ed663f6a57188697bf9ab6fa49dd47562ed1 (diff) | |
download | hercules-8f049e98306b7eaae81ea7df0a837d91ef21d438.tar.gz hercules-8f049e98306b7eaae81ea7df0a837d91ef21d438.tar.bz2 hercules-8f049e98306b7eaae81ea7df0a837d91ef21d438.tar.xz hercules-8f049e98306b7eaae81ea7df0a837d91ef21d438.zip |
* Fixed dynamic shop arrays @bought_nameid, @bought_quantity, @sold_nameid and @sold_quantity not getting reset to zero before use, thus providing attached script with wrong/old data, if it did not clear them by itself in previous call (bugreport:1574, since r5841).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14611 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 0b16aa6f9..d210bea94 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1144,6 +1144,11 @@ static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* i int i; int regkey = add_str("@bought_nameid"); int regkey2 = add_str("@bought_quantity"); + + // discard old contents + script_cleararray_pc(sd, "@bought_nameid", (void*)0); + script_cleararray_pc(sd, "@bought_quantity", (void*)0); + snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnBuyItem", nd->exname); for(i=0;i<n;i++){ pc_setreg(sd,regkey+(i<<24),(int)item_list[i*2+1]); @@ -1371,6 +1376,13 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) return 1; nd = nd->master_nd; //For OnSell triggers. + if( nd ) + { + // discard old contents + script_cleararray_pc(sd, "@sold_nameid", (void*)0); + script_cleararray_pc(sd, "@sold_quantity", (void*)0); + } + for(i=0,z=0;i<n;i++) { int nameid, idx; short qty; |