Changeset 233 for trunk/src/game/Map.cpp

Show
Ignore:
Timestamp:
11/19/08 13:49:07 (17 years ago)
Author:
yumileroy
Message:

[svn] * Reimplemented packet/update forwarding in more generic way
* Implemented far sight spells (Far Sight, Eagle Eye, etc) at unlimited range and properly forward packets
* Implemented bind vision spells (Mind Vision, etc) to forward packets at unlimited distance
* Implemented Sentry Totem (both vision switching/forwarding and alerting)
* Other misc possession fixes
* Added .bindsight and .unbindsight commands

Please test out the above spells (including Mind Control) and report any issues on the forums.

Original author: gvcoman
Date: 2008-11-14 20:40:35-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Map.cpp

    r229 r233  
    316316    CellPair pair = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); 
    317317    Cell cell(pair); 
    318     NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); 
     318    NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); 
     319    GridType &grid = (*ngrid)(cell.CellX(), cell.CellY()); 
    319320 
    320321    if (active) 
    321322    { 
    322         (*grid)(cell.CellX(), cell.CellY()).RemoveGridObject<T>(obj, obj->GetGUID()); 
    323         (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<T>(obj, obj->GetGUID()); 
     323        if (!grid.GetWorldObject(obj->GetGUID(), obj)) 
     324        { 
     325            grid.RemoveGridObject<T>(obj, obj->GetGUID()); 
     326            grid.AddWorldObject<T>(obj, obj->GetGUID()); 
     327        } 
    324328    } else 
    325329    { 
    326         (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<T>(obj, obj->GetGUID()); 
    327         (*grid)(cell.CellX(), cell.CellY()).AddGridObject<T>(obj, obj->GetGUID()); 
     330        if (!grid.GetGridObject(obj->GetGUID(), obj)) 
     331        { 
     332            grid.RemoveWorldObject<T>(obj, obj->GetGUID()); 
     333            grid.AddGridObject<T>(obj, obj->GetGUID()); 
     334        } 
    328335    } 
    329336} 
     
    331338template void Map::SwitchGridContainers(Creature *, bool); 
    332339template void Map::SwitchGridContainers(Corpse *, bool); 
     340template void Map::SwitchGridContainers(DynamicObject *, bool); 
    333341 
    334342template<class T>