From ad9eb5e89df045c6a67fbb42988e6c8921be1417 Mon Sep 17 00:00:00 2001 From: Chaz Brown Date: Fri, 9 Oct 2009 13:49:41 -0400 Subject: * Some changes to scarlet ghouls script, still needs proper core support to work 100% correctly. * Add item script for the harvester's gift, to prevent creating more than 5 scarlet ghouls, I know this can be done in a better way, but, I couldn't figure out how. * Add new function Unit::GetAllMinionsByEntry(std::list& Minions, uint32 entry) used to correctly count how many scarlet ghouls a player has, can probably be handy in other situations. --HG-- branch : trunk --- src/game/Unit.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 09bbeec2979..02ad5bb69cb 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8703,6 +8703,18 @@ void Unit::SetMinion(Minion *minion, bool apply) } } +void Unit::GetAllMinionsByEntry(std::list& Minions, uint32 entry) +{ + for(Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();) + { + Unit *unit = *itr; + ++itr; + if(unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT + && ((Creature*)unit)->isSummon()) // minion, actually + Minions.push_back((Creature*)unit); + } +} + void Unit::RemoveAllMinionsByEntry(uint32 entry) { for(Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();) -- cgit v1.2.3