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; })

This commit is contained in:
lighta 2013-12-03 12:22:00 -05:00 committed by nanakiwurtz
parent 9c5bf1f241
commit fa47d0c2f3

View File

@ -8495,11 +8495,13 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
continue; continue;
} }
int *combo_idx = aMalloc(data->combos[i]->count);
for( j = 0; j < data->combos[i]->count; j++ ) { for( j = 0; j < data->combos[i]->count; j++ ) {
int id = data->combos[i]->nameid[j]; int id = data->combos[i]->nameid[j];
bool found = false; bool found = false;
for( k = 0; k < EQI_MAX; k++ ) { 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]; index = sd->equip_index[k];
if( index < 0 ) continue; if( index < 0 ) continue;
if( k == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index ) 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]) if(!sd->inventory_data[index])
continue; 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 ( itemdb_type(id) != IT_CARD ) {
if ( sd->inventory_data[index]->nameid != id ) if ( sd->inventory_data[index]->nameid != id )
continue; continue;
combo_idx[j] = index;
found = true; found = true;
break; break;
} else { //Cards } 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++) { for (z = 0; z < sd->inventory_data[index]->slot; z++) {
if (sd->status.inventory[index].card[z] != id) if (sd->status.inventory[index].card[z] != id)
continue; continue;
combo_idx[j] = index;
found = true; found = true;
break; break;
} }
@ -8528,6 +8540,7 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
if( !found ) if( !found )
break;/* we haven't found all the ids for this combo, so we can return */ 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 */ /* 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 ) if( j < data->combos[i]->count )