Skip to content

Commit

Permalink
Corrected GM level override checks for Nouse and Trade
Browse files Browse the repository at this point in the history
- Values are now clamped to the [0,100] range. Removed useless
  positivity check for item_usage.override (fixes a compiler warning).
- Special thanks to KeiKun, ossi0110.

Signed-off-by: Haru <haru@dotalux.com>
  • Loading branch information
MishimaHaruna committed May 31, 2014
1 parent 5b52814 commit e9b9764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/map/itemdb.c
Expand Up @@ -1430,7 +1430,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
entry->flag.trade_restriction = ITR_NONE;
}

if (entry->gm_lv_trade_override < 0) {
if (entry->gm_lv_trade_override < 0 || entry->gm_lv_trade_override > 100) {
ShowWarning("itemdb_validate_entry: Invalid trade-override GM level %d for item %d (%s) in '%s', defaulting to none.\n",
entry->gm_lv_trade_override, entry->nameid, entry->jname, source);
entry->gm_lv_trade_override = 0;
Expand All @@ -1446,7 +1446,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
entry->item_usage.flag = INR_NONE;
}

if (entry->item_usage.override < 0) {
if (entry->item_usage.override > 100) {
ShowWarning("itemdb_validate_entry: Invalid nouse-override GM level %d for item %d (%s) in '%s', defaulting to none.\n",
entry->item_usage.override, entry->nameid, entry->jname, source);
entry->item_usage.override = 0;
Expand Down

0 comments on commit e9b9764

Please sign in to comment.