aboutsummaryrefslogtreecommitdiff
path: root/src/game/LootMgr.h
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-06 19:39:42 -0600
committermegamage <none@none>2009-03-06 19:39:42 -0600
commit4f6c96b98c5d5a065f902aa6106c928bf0b2a668 (patch)
treee790dd5071091cbaeffb9d919eba777b519cf25f /src/game/LootMgr.h
parent417c7c83196aba0c4afdefd75c3edaba91337a88 (diff)
[7394] Check loot_template.maxcount for max allowed value (255) and make better report for this case. Author: VladimirMangos
Also optimize strcture LootStoreItem that let use 4 byte for loot template element in memory instead 5 bytes. But limit group id to 127 max value. Check this at loading. --HG-- branch : trunk
Diffstat (limited to 'src/game/LootMgr.h')
-rw-r--r--src/game/LootMgr.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h
index 7841a2e0d3b..79d292cf8d4 100644
--- a/src/game/LootMgr.h
+++ b/src/game/LootMgr.h
@@ -65,17 +65,17 @@ struct LootStoreItem
uint32 itemid; // id of the item
float chance; // always positive, chance to drop for both quest and non-quest items, chance to be used for refs
int32 mincountOrRef; // mincount for drop items (positive) or minus referenced TemplateleId (negative)
- uint8 group :8;
+ uint8 group :7;
+ bool needs_quest :1; // quest drop (negative ChanceOrQuestChance in DB)
uint8 maxcount :8; // max drop count for the item (mincountOrRef positive) or Ref multiplicator (mincountOrRef negative)
uint16 conditionId :16; // additional loot condition Id
- bool needs_quest :1; // quest drop (negative ChanceOrQuestChance in DB)
// Constructor, converting ChanceOrQuestChance -> (chance, needs_quest)
// displayid is filled in IsValid() which must be called after
LootStoreItem(uint32 _itemid, float _chanceOrQuestChance, int8 _group, uint8 _conditionId, int32 _mincountOrRef, uint8 _maxcount)
: itemid(_itemid), chance(fabs(_chanceOrQuestChance)), mincountOrRef(_mincountOrRef),
- group(_group), maxcount(_maxcount), conditionId(_conditionId),
- needs_quest(_chanceOrQuestChance < 0) {}
+ group(_group), needs_quest(_chanceOrQuestChance < 0), maxcount(_maxcount), conditionId(_conditionId)
+ {}
bool Roll(bool rate) const; // Checks if the entry takes it's chance (at loot generation)
bool IsValid(LootStore const& store, uint32 entry) const;