summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-01-15 16:47:30 -0200
committershennetsind <ind@henn.et>2014-01-15 16:47:30 -0200
commita3ccc2de2d7d51202c4e4fc43ccd600d67cc0685 (patch)
treefec7bcd0930aaa092796c48864efe868a08154ad /src/map
parent533ff4f5ea21695edf89cd94ef06eb89f5a5aa7d (diff)
downloadhercules-a3ccc2de2d7d51202c4e4fc43ccd600d67cc0685.tar.gz
hercules-a3ccc2de2d7d51202c4e4fc43ccd600d67cc0685.tar.bz2
hercules-a3ccc2de2d7d51202c4e4fc43ccd600d67cc0685.tar.xz
hercules-a3ccc2de2d7d51202c4e4fc43ccd600d67cc0685.zip
Fixed autotrading persistency problem with multiple non-stackable items
Thanks to Mhalicot! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/pc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 0a1a474ad..cc2566a6e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -10435,7 +10435,7 @@ void pc_autotrade_prepare(struct map_session_data *sd) {
**/
void pc_autotrade_populate(struct map_session_data *sd) {
struct autotrade_vending *data;
- int i, j, cursor = 0;
+ int i, j, k, cursor = 0;
if( !(data = idb_get(pc->at_db,sd->status.char_id)) )
return;
@@ -10444,7 +10444,16 @@ void pc_autotrade_populate(struct map_session_data *sd) {
if( !data->vending[i].amount )
continue;
- ARR_FIND(0, MAX_CART, j, !memcmp((char*)(&data->list[i]) + sizeof(data->list[0].id), (char*)(&sd->status.cart[j]) + sizeof(data->list[0].id), sizeof(struct item) - sizeof(data->list[0].id)));
+ for(j = 0; j < MAX_CART; j++) {
+ if( !memcmp((char*)(&data->list[i]) + sizeof(data->list[0].id), (char*)(&sd->status.cart[j]) + sizeof(data->list[0].id), sizeof(struct item) - sizeof(data->list[0].id)) ) {
+ if( cursor ) {
+ ARR_FIND(0, cursor, k, sd->vending[k].index == j);
+ if( k != cursor )
+ continue;
+ }
+ break;
+ }
+ }
if( j != MAX_CART ) {
sd->vending[cursor].index = j;