From fa47d0c2f3c5c82e08c1f571fd6d99f8bfcbac24 Mon Sep 17 00:00:00 2001 From: lighta Date: Tue, 3 Dec 2013 12:22:00 -0500 Subject: [PATCH] Fix item_combo who wasn't checking for different index in case of same item required for combo (e.g 2890:2890,{ bonus bAgi,10; }) --- src/map/pc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/map/pc.c b/src/map/pc.c index 9e13cddd43..b2c19bd0b3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -8495,11 +8495,13 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) { continue; } + int *combo_idx = aMalloc(data->combos[i]->count); for( j = 0; j < data->combos[i]->count; j++ ) { int id = data->combos[i]->nameid[j]; bool found = false; - + for( k = 0; k < EQI_MAX; k++ ) { + bool do_continue = false; //used to continue that specific loop with some check that also use some loop index = sd->equip_index[k]; if( index < 0 ) continue; if( k == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index ) continue; @@ -8508,10 +8510,19 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) { if(!sd->inventory_data[index]) continue; + if(j>0){ + for (z = 0; z < data->combos[i]->count; z++) + if(combo_idx[z] == index) //we already have that index recorded + do_continue=true; + if(do_continue) + continue; + } + if ( itemdb_type(id) != IT_CARD ) { if ( sd->inventory_data[index]->nameid != id ) continue; + combo_idx[j] = index; found = true; break; } else { //Cards @@ -8520,6 +8531,7 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) { for (z = 0; z < sd->inventory_data[index]->slot; z++) { if (sd->status.inventory[index].card[z] != id) continue; + combo_idx[j] = index; found = true; break; } @@ -8528,6 +8540,7 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) { if( !found ) break;/* we haven't found all the ids for this combo, so we can return */ } + aFree(combo_idx); /* means we broke out of the count loop w/o finding all ids, we can move to the next combo */ if( j < data->combos[i]->count )