diff options
| author | Anubisss <none@none> | 2009-05-27 21:30:03 +0200 |
|---|---|---|
| committer | Anubisss <none@none> | 2009-05-27 21:30:03 +0200 |
| commit | 4ce92ed6fa6c73de41169669f7df0f35611d072e (patch) | |
| tree | 8f56e36009562c12332710dcaff6e35e6b0d74ee /src/game/CreatureAI.cpp | |
| parent | ba934b35d6f8a13904463cfa1d5dd92e0a9c01f1 (diff) | |
*Merge SD2.
*r983: Add additional checks for zoneInCombat-function.
*r984: Remove two useless functions, cleanup some code. - The most part of the patch skipped.
*r985: Clean up some code and prevent Spark from doing certain actions if in certain areas
*r986: Remove most EventAI code - Skip this patch
*r987: Correct and remove now obsolete documentation. - Skip: delete EventAI.txt
--HG--
branch : trunk
Diffstat (limited to 'src/game/CreatureAI.cpp')
| -rw-r--r-- | src/game/CreatureAI.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index e9970071f23..f61aca24405 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -73,14 +73,24 @@ void CreatureAI::DoZoneInCombat(Creature* creature) return; } - Map::PlayerList const &PlayerList = map->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map::PlayerList const &PlList = map->GetPlayers(); + + if(PlList.isEmpty()) + return; + + for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { - if (i->getSource()->isAlive()) + if(Player* pPlayer = i->getSource()) { - creature->SetInCombatWith(i->getSource()); - i->getSource()->SetInCombatWith(creature); - creature->AddThreat(i->getSource(), 0.0f); + if(pPlayer->isGameMaster()) + continue; + + if(pPlayer->isAlive()) + { + creature->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(creature); + creature->AddThreat(pPlayer, 0.0f); + } } } } |
