| 1 | /* |
|---|
| 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
|---|
| 3 | * |
|---|
| 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef TRINITY_GRIDNOTIFIERSIMPL_H |
|---|
| 22 | #define TRINITY_GRIDNOTIFIERSIMPL_H |
|---|
| 23 | |
|---|
| 24 | #include "GridNotifiers.h" |
|---|
| 25 | #include "WorldPacket.h" |
|---|
| 26 | #include "Corpse.h" |
|---|
| 27 | #include "Player.h" |
|---|
| 28 | #include "UpdateData.h" |
|---|
| 29 | #include "CreatureAI.h" |
|---|
| 30 | #include "SpellAuras.h" |
|---|
| 31 | |
|---|
| 32 | template<class T> |
|---|
| 33 | inline void |
|---|
| 34 | Trinity::VisibleNotifier::Visit(GridRefManager<T> &m) |
|---|
| 35 | { |
|---|
| 36 | for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) |
|---|
| 37 | { |
|---|
| 38 | i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); |
|---|
| 39 | i_clientGUIDs.erase(iter->getSource()->GetGUID()); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | inline void |
|---|
| 44 | Trinity::ObjectUpdater::Visit(CreatureMapType &m) |
|---|
| 45 | { |
|---|
| 46 | for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) |
|---|
| 47 | if(!iter->getSource()->isSpiritService()) |
|---|
| 48 | iter->getSource()->Update(i_timeDiff); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | inline void |
|---|
| 52 | Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) |
|---|
| 53 | { |
|---|
| 54 | for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) |
|---|
| 55 | { |
|---|
| 56 | if(&i_player==iter->getSource()) |
|---|
| 57 | continue; |
|---|
| 58 | |
|---|
| 59 | // visibility for players updated by ObjectAccessor::UpdateVisibilityFor calls in appropriate places |
|---|
| 60 | |
|---|
| 61 | // Cancel Trade |
|---|
| 62 | if(i_player.GetTrader()==iter->getSource()) |
|---|
| 63 | // iteraction distance |
|---|
| 64 | if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) |
|---|
| 65 | i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows |
|---|
| 66 | } |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c) |
|---|
| 70 | { |
|---|
| 71 | // update creature visibility at player/creature move |
|---|
| 72 | pl->UpdateVisibilityOf(c); |
|---|
| 73 | |
|---|
| 74 | // Creature AI reaction |
|---|
| 75 | if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) |
|---|
| 76 | { |
|---|
| 77 | if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() ) |
|---|
| 78 | c->AI()->MoveInLineOfSight(pl); |
|---|
| 79 | } |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) |
|---|
| 83 | { |
|---|
| 84 | if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) |
|---|
| 85 | { |
|---|
| 86 | if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() ) |
|---|
| 87 | c1->AI()->MoveInLineOfSight(c2); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) |
|---|
| 91 | { |
|---|
| 92 | if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() ) |
|---|
| 93 | c2->AI()->MoveInLineOfSight(c1); |
|---|
| 94 | } |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | inline void |
|---|
| 98 | Trinity::PlayerRelocationNotifier::Visit(CreatureMapType &m) |
|---|
| 99 | { |
|---|
| 100 | if(!i_player.isAlive() || i_player.isInFlight()) |
|---|
| 101 | return; |
|---|
| 102 | |
|---|
| 103 | for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) |
|---|
| 104 | if( iter->getSource()->isAlive()) |
|---|
| 105 | PlayerCreatureRelocationWorker(&i_player,iter->getSource()); |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | template<> |
|---|
| 109 | inline void |
|---|
| 110 | Trinity::CreatureRelocationNotifier::Visit(PlayerMapType &m) |
|---|
| 111 | { |
|---|
| 112 | if(!i_creature.isAlive()) |
|---|
| 113 | return; |
|---|
| 114 | |
|---|
| 115 | for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) |
|---|
| 116 | if( iter->getSource()->isAlive() && !iter->getSource()->isInFlight()) |
|---|
| 117 | PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | template<> |
|---|
| 121 | inline void |
|---|
| 122 | Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m) |
|---|
| 123 | { |
|---|
| 124 | if(!i_creature.isAlive()) |
|---|
| 125 | return; |
|---|
| 126 | |
|---|
| 127 | for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) |
|---|
| 128 | { |
|---|
| 129 | Creature* c = iter->getSource(); |
|---|
| 130 | if( c != &i_creature && c->isAlive()) |
|---|
| 131 | CreatureCreatureRelocationWorker(c, &i_creature); |
|---|
| 132 | } |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target) |
|---|
| 136 | { |
|---|
| 137 | if(!target->isAlive() || target->isInFlight() ) |
|---|
| 138 | return; |
|---|
| 139 | |
|---|
| 140 | if(target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isTotem()) |
|---|
| 141 | return; |
|---|
| 142 | |
|---|
| 143 | if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius())) |
|---|
| 144 | return; |
|---|
| 145 | |
|---|
| 146 | //Check targets for not_selectable unit flag and remove |
|---|
| 147 | if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) |
|---|
| 148 | return; |
|---|
| 149 | |
|---|
| 150 | // Evade target |
|---|
| 151 | if( target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode() ) |
|---|
| 152 | return; |
|---|
| 153 | |
|---|
| 154 | //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) |
|---|
| 155 | if( target->GetTypeId()==TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) ) |
|---|
| 156 | return; |
|---|
| 157 | |
|---|
| 158 | if( i_check->GetTypeId()==TYPEID_PLAYER ) |
|---|
| 159 | { |
|---|
| 160 | if (i_check->IsFriendlyTo( target )) |
|---|
| 161 | return; |
|---|
| 162 | } |
|---|
| 163 | else |
|---|
| 164 | { |
|---|
| 165 | if (!i_check->IsHostileTo( target )) |
|---|
| 166 | return; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | if (i_dynobject.IsAffecting(target)) |
|---|
| 170 | return; |
|---|
| 171 | |
|---|
| 172 | SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId()); |
|---|
| 173 | uint32 eff_index = i_dynobject.GetEffIndex(); |
|---|
| 174 | // Check target immune to spell or aura |
|---|
| 175 | if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo->Effect[eff_index], spellInfo->EffectMechanic[eff_index])) |
|---|
| 176 | return; |
|---|
| 177 | // Apply PersistentAreaAura on target |
|---|
| 178 | PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster()); |
|---|
| 179 | target->AddAura(Aur); |
|---|
| 180 | i_dynobject.AddAffected(target); |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | template<> |
|---|
| 184 | inline void |
|---|
| 185 | Trinity::DynamicObjectUpdater::Visit(CreatureMapType &m) |
|---|
| 186 | { |
|---|
| 187 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 188 | VisitHelper(itr->getSource()); |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | template<> |
|---|
| 192 | inline void |
|---|
| 193 | Trinity::DynamicObjectUpdater::Visit(PlayerMapType &m) |
|---|
| 194 | { |
|---|
| 195 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 196 | VisitHelper(itr->getSource()); |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | // SEARCHERS & LIST SEARCHERS & WORKERS |
|---|
| 200 | |
|---|
| 201 | // WorldObject searchers & workers |
|---|
| 202 | |
|---|
| 203 | template<class Check> |
|---|
| 204 | void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m) |
|---|
| 205 | { |
|---|
| 206 | // already found |
|---|
| 207 | if(i_object) |
|---|
| 208 | return; |
|---|
| 209 | |
|---|
| 210 | for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 211 | { |
|---|
| 212 | if(i_check(itr->getSource())) |
|---|
| 213 | { |
|---|
| 214 | i_object = itr->getSource(); |
|---|
| 215 | return; |
|---|
| 216 | } |
|---|
| 217 | } |
|---|
| 218 | } |
|---|
| 219 | |
|---|
| 220 | template<class Check> |
|---|
| 221 | void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 222 | { |
|---|
| 223 | // already found |
|---|
| 224 | if(i_object) |
|---|
| 225 | return; |
|---|
| 226 | |
|---|
| 227 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 228 | { |
|---|
| 229 | if(i_check(itr->getSource())) |
|---|
| 230 | { |
|---|
| 231 | i_object = itr->getSource(); |
|---|
| 232 | return; |
|---|
| 233 | } |
|---|
| 234 | } |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | template<class Check> |
|---|
| 238 | void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 239 | { |
|---|
| 240 | // already found |
|---|
| 241 | if(i_object) |
|---|
| 242 | return; |
|---|
| 243 | |
|---|
| 244 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 245 | { |
|---|
| 246 | if(i_check(itr->getSource())) |
|---|
| 247 | { |
|---|
| 248 | i_object = itr->getSource(); |
|---|
| 249 | return; |
|---|
| 250 | } |
|---|
| 251 | } |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | template<class Check> |
|---|
| 255 | void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m) |
|---|
| 256 | { |
|---|
| 257 | // already found |
|---|
| 258 | if(i_object) |
|---|
| 259 | return; |
|---|
| 260 | |
|---|
| 261 | for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 262 | { |
|---|
| 263 | if(i_check(itr->getSource())) |
|---|
| 264 | { |
|---|
| 265 | i_object = itr->getSource(); |
|---|
| 266 | return; |
|---|
| 267 | } |
|---|
| 268 | } |
|---|
| 269 | } |
|---|
| 270 | |
|---|
| 271 | template<class Check> |
|---|
| 272 | void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m) |
|---|
| 273 | { |
|---|
| 274 | // already found |
|---|
| 275 | if(i_object) |
|---|
| 276 | return; |
|---|
| 277 | |
|---|
| 278 | for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 279 | { |
|---|
| 280 | if(i_check(itr->getSource())) |
|---|
| 281 | { |
|---|
| 282 | i_object = itr->getSource(); |
|---|
| 283 | return; |
|---|
| 284 | } |
|---|
| 285 | } |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | template<class Check> |
|---|
| 289 | void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 290 | { |
|---|
| 291 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 292 | if(i_check(itr->getSource())) |
|---|
| 293 | i_objects.push_back(itr->getSource()); |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | template<class Check> |
|---|
| 297 | void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 298 | { |
|---|
| 299 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 300 | if(i_check(itr->getSource())) |
|---|
| 301 | i_objects.push_back(itr->getSource()); |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | template<class Check> |
|---|
| 305 | void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m) |
|---|
| 306 | { |
|---|
| 307 | for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 308 | if(i_check(itr->getSource())) |
|---|
| 309 | i_objects.push_back(itr->getSource()); |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | template<class Check> |
|---|
| 313 | void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m) |
|---|
| 314 | { |
|---|
| 315 | for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 316 | if(i_check(itr->getSource())) |
|---|
| 317 | i_objects.push_back(itr->getSource()); |
|---|
| 318 | } |
|---|
| 319 | |
|---|
| 320 | template<class Check> |
|---|
| 321 | void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m) |
|---|
| 322 | { |
|---|
| 323 | for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 324 | if(i_check(itr->getSource())) |
|---|
| 325 | i_objects.push_back(itr->getSource()); |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | // Gameobject searchers |
|---|
| 329 | |
|---|
| 330 | template<class Check> |
|---|
| 331 | void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m) |
|---|
| 332 | { |
|---|
| 333 | // already found |
|---|
| 334 | if(i_object) |
|---|
| 335 | return; |
|---|
| 336 | |
|---|
| 337 | for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 338 | { |
|---|
| 339 | if(i_check(itr->getSource())) |
|---|
| 340 | { |
|---|
| 341 | i_object = itr->getSource(); |
|---|
| 342 | return; |
|---|
| 343 | } |
|---|
| 344 | } |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | template<class Check> |
|---|
| 348 | void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m) |
|---|
| 349 | { |
|---|
| 350 | for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 351 | { |
|---|
| 352 | if(i_check(itr->getSource())) |
|---|
| 353 | i_object = itr->getSource(); |
|---|
| 354 | } |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | template<class Check> |
|---|
| 358 | void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m) |
|---|
| 359 | { |
|---|
| 360 | for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 361 | if(i_check(itr->getSource())) |
|---|
| 362 | i_objects.push_back(itr->getSource()); |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | // Unit searchers |
|---|
| 366 | |
|---|
| 367 | template<class Check> |
|---|
| 368 | void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 369 | { |
|---|
| 370 | // already found |
|---|
| 371 | if(i_object) |
|---|
| 372 | return; |
|---|
| 373 | |
|---|
| 374 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 375 | { |
|---|
| 376 | if(i_check(itr->getSource())) |
|---|
| 377 | { |
|---|
| 378 | i_object = itr->getSource(); |
|---|
| 379 | return; |
|---|
| 380 | } |
|---|
| 381 | } |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | template<class Check> |
|---|
| 385 | void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 386 | { |
|---|
| 387 | // already found |
|---|
| 388 | if(i_object) |
|---|
| 389 | return; |
|---|
| 390 | |
|---|
| 391 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 392 | { |
|---|
| 393 | if(i_check(itr->getSource())) |
|---|
| 394 | { |
|---|
| 395 | i_object = itr->getSource(); |
|---|
| 396 | return; |
|---|
| 397 | } |
|---|
| 398 | } |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | template<class Check> |
|---|
| 402 | void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 403 | { |
|---|
| 404 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 405 | { |
|---|
| 406 | if(i_check(itr->getSource())) |
|---|
| 407 | i_object = itr->getSource(); |
|---|
| 408 | } |
|---|
| 409 | } |
|---|
| 410 | |
|---|
| 411 | template<class Check> |
|---|
| 412 | void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 413 | { |
|---|
| 414 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 415 | { |
|---|
| 416 | if(i_check(itr->getSource())) |
|---|
| 417 | i_object = itr->getSource(); |
|---|
| 418 | } |
|---|
| 419 | } |
|---|
| 420 | |
|---|
| 421 | template<class Check> |
|---|
| 422 | void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 423 | { |
|---|
| 424 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 425 | if(i_check(itr->getSource())) |
|---|
| 426 | i_objects.push_back(itr->getSource()); |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | template<class Check> |
|---|
| 430 | void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 431 | { |
|---|
| 432 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 433 | if(i_check(itr->getSource())) |
|---|
| 434 | i_objects.push_back(itr->getSource()); |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | // Creature searchers |
|---|
| 438 | |
|---|
| 439 | template<class Check> |
|---|
| 440 | void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 441 | { |
|---|
| 442 | // already found |
|---|
| 443 | if(i_object) |
|---|
| 444 | return; |
|---|
| 445 | |
|---|
| 446 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 447 | { |
|---|
| 448 | if(i_check(itr->getSource())) |
|---|
| 449 | { |
|---|
| 450 | i_object = itr->getSource(); |
|---|
| 451 | return; |
|---|
| 452 | } |
|---|
| 453 | } |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | template<class Check> |
|---|
| 457 | void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 458 | { |
|---|
| 459 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 460 | { |
|---|
| 461 | if(i_check(itr->getSource())) |
|---|
| 462 | i_object = itr->getSource(); |
|---|
| 463 | } |
|---|
| 464 | } |
|---|
| 465 | |
|---|
| 466 | template<class Check> |
|---|
| 467 | void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m) |
|---|
| 468 | { |
|---|
| 469 | for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 470 | if(i_check(itr->getSource())) |
|---|
| 471 | i_objects.push_back(itr->getSource()); |
|---|
| 472 | } |
|---|
| 473 | |
|---|
| 474 | template<class Check> |
|---|
| 475 | void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m) |
|---|
| 476 | { |
|---|
| 477 | // already found |
|---|
| 478 | if(i_object) |
|---|
| 479 | return; |
|---|
| 480 | |
|---|
| 481 | for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) |
|---|
| 482 | { |
|---|
| 483 | if(i_check(itr->getSource())) |
|---|
| 484 | { |
|---|
| 485 | i_object = itr->getSource(); |
|---|
| 486 | return; |
|---|
| 487 | } |
|---|
| 488 | } |
|---|
| 489 | } |
|---|
| 490 | |
|---|
| 491 | #endif // TRINITY_GRIDNOTIFIERSIMPL_H |
|---|