From a3ccc2de2d7d51202c4e4fc43ccd600d67cc0685 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 15 Jan 2014 16:47:30 -0200 Subject: Fixed autotrading persistency problem with multiple non-stackable items Thanks to Mhalicot! Signed-off-by: shennetsind --- src/map/pc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/map/pc.c') 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; -- cgit v1.2.3-60-g2f50