diff options
| author | megamage <none@none> | 2009-03-06 19:52:46 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-03-06 19:52:46 -0600 |
| commit | f6ca5c601ef6089220fb0bfe3bc155fbbf3de812 (patch) | |
| tree | b9598e93d132aea806527aa4de13046e3c80dc5d /src/game/LootMgr.cpp | |
| parent | dbb8c78394660c277f9056d899df8b0f9f1f8cb0 (diff) | |
| parent | 4f6c96b98c5d5a065f902aa6106c928bf0b2a668 (diff) | |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/LootMgr.cpp')
| -rw-r--r-- | src/game/LootMgr.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index da5b4343d24..046fa28f106 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -117,11 +117,18 @@ void LootStore::LoadLootTable() float chanceOrQuestChance = fields[2].GetFloat(); uint8 group = fields[3].GetUInt8(); int32 mincountOrRef = fields[4].GetInt32(); - uint8 maxcount = fields[5].GetUInt8(); + uint32 maxcount = fields[5].GetUInt32(); ConditionType condition = (ConditionType)fields[6].GetUInt8(); uint32 cond_value1 = fields[7].GetUInt32(); uint32 cond_value2 = fields[8].GetUInt32(); + if(maxcount > std::numeric_limits<uint8>::max()) + { + sLog.outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, maxcount,std::numeric_limits<uint8>::max()); + continue; // error already printed to log/console. + } + + if(!PlayerCondition::IsValid(condition,cond_value1, cond_value2)) { sLog.outErrorDb("... in table '%s' entry %u item %u", GetName(), entry, item); @@ -251,6 +258,12 @@ bool LootStoreItem::Roll(bool rate) const // Checks correctness of values bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { + if(group >= 1 << 7) // it stored in 7 bit field + { + sLog.outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7); + return false; + } + if (mincountOrRef == 0) { sLog.outErrorDb("Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); |
