Explorar o código

* Fixed item_combo bug, related bugreport http://rathena.org/board/tracker/issue-8321-maximum-hp-bug/
Thank lighta and everyone who told how to reproduce

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh %!s(int64=11) %!d(string=hai) anos
pai
achega
22cfb75276
Modificáronse 1 ficheiros con 4 adicións e 6 borrados
  1. 4 6
      src/map/pc.c

+ 4 - 6
src/map/pc.c

@@ -8550,7 +8550,6 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
 						continue;
 				}
 				
-
 				if ( itemdb_type(id) != IT_CARD ) {
 					if ( sd->inventory_data[index]->nameid != id )
 						continue;
@@ -8574,7 +8573,6 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
 				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 )
 			continue;
@@ -8620,6 +8618,10 @@ static int pc_removecombo(struct map_session_data *sd, struct item_data *data )
 		sd->combos.id[x] = 0;
 		retval++;
 
+		/* check if combo requirements still fit */
+		if( pc_checkcombo( sd, data ) )
+			continue;
+
 		/* move next value to empty slot */
 		for( j = 0, cursor = 0; j < sd->combos.count; j++ ) {
 			if( sd->combos.bonus[j] == NULL )
@@ -8632,10 +8634,6 @@ static int pc_removecombo(struct map_session_data *sd, struct item_data *data )
 			cursor++;
 		}
 
-		/* check if combo requirements still fit */
-		if( pc_checkcombo( sd, data ) )
-			continue;
-
 		/* it's empty, we can clear all the memory */
 		if( (sd->combos.count = cursor) == 0 ) {
 			aFree(sd->combos.bonus);