summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-02-02 16:50:03 -0200
committershennetsind <ind@henn.et>2014-02-02 16:50:03 -0200
commit00ef66fb9261a50e6761cf77c11e7f468494c95f (patch)
treec1bc879e76ecaaf619366d6392c13a72bb5640b9 /src/map/status.c
parentd33469689ea8e671fa0d525d54bce6932dfe9107 (diff)
downloadhercules-00ef66fb9261a50e6761cf77c11e7f468494c95f.tar.gz
hercules-00ef66fb9261a50e6761cf77c11e7f468494c95f.tar.bz2
hercules-00ef66fb9261a50e6761cf77c11e7f468494c95f.tar.xz
hercules-00ef66fb9261a50e6761cf77c11e7f468494c95f.zip
Fixed item combo bypassing disabled item restrictions
Special Thanks to Mhalicot! Also improves the overall memory usage of the item combo feature Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 6cc3269e5..2b0aee97b 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2598,12 +2598,29 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
}
/* we've got combos to process */
- if( sd->combos.count ) {
- for( i = 0; i < sd->combos.count; i++ ) {
- script->run(sd->combos.bonus[i],0,sd->bl.id,0);
- if (!calculating) //Abort, script->run retriggered this.
- return 1;
+ for( i = 0; i < sd->combo_count; i++ ) {
+ struct item_combo *combo = itemdb->id2combo(sd->combos[i].id);
+ unsigned char j;
+
+ /**
+ * ensure combo usage is allowed at this location
+ **/
+ for(j = 0; j < combo->count; j++) {
+ for(k = 0; k < map->list[sd->bl.m].zone->disabled_items_count; k++) {
+ if( map->list[sd->bl.m].zone->disabled_items[k] == combo->nameid[j] ) {
+ break;
+ }
+ }
+ if( k != map->list[sd->bl.m].zone->disabled_items_count )
+ break;
}
+
+ if( j != combo->count )
+ continue;
+
+ script->run(sd->combos[i].bonus,0,sd->bl.id,0);
+ if (!calculating) //Abort, script->run retriggered this.
+ return 1;
}
//Store equipment script bonuses