PDA

Просмотр полной версии : small fix


Den
04.05.2011, 21:10
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index a5859af..b3d14a7 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -49,55 +49,6 @@

extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];

-class PrioritizeManaUnitWraper
-{
- public:
- explicit PrioritizeManaUnitWraper(Unit* unit) : i_unit(unit)
- {
- uint32 maxmana = unit->GetMaxPower(POWER_MANA);
- i_percent = maxmana ? unit->GetPower(POWER_MANA) * 100 / maxmana : 101;
- }
- Unit* getUnit() const { return i_unit; }
- uint32 getPercent() const { return i_percent; }
- private:
- Unit* i_unit;
- uint32 i_percent;
-};
-
-struct PrioritizeMana
-{
- int operator()( PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y ) const
- {
- return x.getPercent() > y.getPercent();
- }
-};
-
-typedef std::priority_queue<PrioritizeManaUnitWraper, std::vector<PrioritizeManaUnitWraper>, PrioritizeMana> PrioritizeManaUnitQueue;
-
-class PrioritizeHealthUnitWraper
-{
-public:
- explicit PrioritizeHealthUnitWraper(Unit* unit) : i_unit(unit)
- {
- i_percent = unit->GetHealth() * 100 / unit->GetMaxHealth();
- }
- Unit* getUnit() const { return i_unit; }
- uint32 getPercent() const { return i_percent; }
-private:
- Unit* i_unit;
- uint32 i_percent;
-};
-
-struct PrioritizeHealth
-{
- int operator()( PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y ) const
- {
- return x.getPercent() > y.getPercent();
- }
-};
-
-typedef std::priority_queue<PrioritizeHealthUnitWraper, std::vector<PrioritizeHealthUnitWraper>, PrioritizeHealth> PrioritizeHealthUnitQueue;
-
bool IsQuestTameSpell(uint32 spellId)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
diff --git a/src/game/Spell.h b/src/game/Spell.h
index a0dc2a4..5fb0801 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -868,4 +868,54 @@ class SpellEvent : public BasicEvent
protected:
Spell* m_Spell;
};
+
+class PrioritizeManaUnitWraper
+{
+ public:
+ explicit PrioritizeManaUnitWraper(Unit* unit) : i_unit(unit)
+ {
+ uint32 maxmana = unit->GetMaxPower(POWER_MANA);
+ i_percent = maxmana ? unit->GetPower(POWER_MANA) * 100 / maxmana : 101;
+ }
+ Unit* getUnit() const { return i_unit; }
+ uint32 getPercent() const { return i_percent; }
+ private:
+ Unit* i_unit;
+ uint32 i_percent;
+};
+
+struct PrioritizeMana
+{
+ int operator()( PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y ) const
+ {
+ return x.getPercent() > y.getPercent();
+ }
+};
+
+typedef std::priority_queue<PrioritizeManaUnitWraper, std::vector<PrioritizeManaUnitWraper>, PrioritizeMana> PrioritizeManaUnitQueue;
+
+class PrioritizeHealthUnitWraper
+{
+public:
+ explicit PrioritizeHealthUnitWraper(Unit* unit) : i_unit(unit)
+ {
+ i_percent = unit->GetHealth() * 100 / unit->GetMaxHealth();
+ }
+ Unit* getUnit() const { return i_unit; }
+ uint32 getPercent() const { return i_percent; }
+private:
+ Unit* i_unit;
+ uint32 i_percent;
+};
+
+struct PrioritizeHealth
+{
+ int operator()( PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y ) const
+ {
+ return x.getPercent() > y.getPercent();
+ }
+};
+
+typedef std::priority_queue<PrioritizeHealthUnitWraper, std::vector<PrioritizeHealthUnitWraper>, PrioritizeHealth> PrioritizeHealthUnitQueue;
+
#endif

Vladimir
08.05.2011, 05:14
Зачем? Все использования PrioritizeHealth/PrioritizeMana
в Spell.cpp