Yan18
Member
- Joined
- Jun 14, 2014
- Messages
- 104
- Solutions
- 3
- Reaction score
- 17
Hello there
I have a doubt in the following verification inside the function Game::combatChangeHealth from game.cpp:
Why is it returning the own function in the begin of the function in the case has events CREATURE_EVENT_HEALTHCHANGE in for loop?? I would like to understand what this happen.
I have a doubt in the following verification inside the function Game::combatChangeHealth from game.cpp:
C++:
if (damage.origin != ORIGIN_NONE)
{
const auto& events = target->getCreatureEvents(CREATURE_EVENT_HEALTHCHANGE);
if (!events.empty())
{
for (CreatureEvent* creatureEvent : events)
{
creatureEvent->executeHealthChange(target, attacker, damage);
}
damage.origin = ORIGIN_NONE;
return combatChangeHealth(attacker, target, damage, damage.primary.type);
}
}
Why is it returning the own function in the begin of the function in the case has events CREATURE_EVENT_HEALTHCHANGE in for loop?? I would like to understand what this happen.