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

[svn] *** Source: MaNGOS ***
* Implement localization of creature/gameobject name that say/yell. Author: evilstar (rewrited by: Vladimir)
* Fix auth login queue. Author: Derex
* Allowed switching INVTYPE_HOLDABLE items during combat, used correct spells for triggering global cooldown at weapon switch. Author: mobel/simak
* Fixed some format arg type/value pairs. Other warnings. Author: Vladimir
* [238_world.sql] Allow have team dependent graveyards at entrance map for instances. Author: Vladimir

NOTE:
Entrance map graveyards selected by same way as local (by distance from entrance) Until DB support will work in old way base at current DB data.

Original author: visagalis
Date: 2008-11-14 17:03:03-06:00

Files:
1 modified

Legend:

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

    r229 r230  
    48284828        } 
    48294829 
    4830         if(entry->map_id != areaEntry->mapid && team != 0) 
    4831         { 
    4832             sLog.outErrorDb("Table `game_graveyard_zone` has record for ghost zone (%u) at map %u and graveyard (%u) at map %u for team %u, but in case maps are different, player faction setting is ignored. Use faction 0 instead.",zoneId,areaEntry->mapid, safeLocId, entry->map_id, team); 
    4833             team = 0; 
    4834         } 
    4835  
    48364830        if(!AddGraveYardLink(safeLocId,zoneId,team,false)) 
    48374831            sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); 
     
    48554849    //     then check faction 
    48564850    //   if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated 
    4857     //     then skip check faction 
     4851    //     then check faction 
    48584852    GraveYardMap::const_iterator graveLow  = mGraveYardMap.lower_bound(zoneId); 
    48594853    GraveYardMap::const_iterator graveUp   = mGraveYardMap.upper_bound(zoneId); 
     
    48644858    } 
    48654859 
     4860    // at corpse map 
    48664861    bool foundNear = false; 
    48674862    float distNear; 
    48684863    WorldSafeLocsEntry const* entryNear = NULL; 
     4864 
     4865    // at entrance map for corpse map 
     4866    bool foundEntr = false; 
     4867    float distEntr; 
     4868    WorldSafeLocsEntry const* entryEntr = NULL; 
     4869 
     4870    // some where other 
    48694871    WorldSafeLocsEntry const* entryFar = NULL; 
     4872 
     4873    MapEntry const* mapEntry = sMapStore.LookupEntry(MapId); 
    48704874 
    48714875    for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr) 
     
    48804884        } 
    48814885 
    4882         // remember first graveyard at another map and ignore other 
    4883         if(MapId != entry->map_id) 
    4884         { 
    4885             if(!entryFar) 
    4886                 entryFar = entry; 
    4887             continue; 
    4888         } 
    4889  
    4890         // skip enemy faction graveyard at same map (normal area, city, or battleground) 
     4886        // skip enemy faction graveyard 
    48914887        // team == 0 case can be at call from .neargrave 
    48924888        if(data.team != 0 && team != 0 && data.team != team) 
    48934889            continue; 
    48944890 
     4891        // find now nearest graveyard at other map 
     4892        if(MapId != entry->map_id) 
     4893        { 
     4894            // if find graveyard at different map from where entrance placed (or no entrance data), use any first 
     4895            if (!mapEntry || mapEntry->entrance_map < 0 || mapEntry->entrance_map != entry->map_id || 
     4896                mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0) 
     4897            { 
     4898                // not have any corrdinates for check distance anyway 
     4899                entryFar = entry; 
     4900                continue; 
     4901            } 
     4902 
     4903            // at entrance map calculate distance (2D); 
     4904            float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x) 
     4905                +(entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y); 
     4906            if(foundEntr) 
     4907            { 
     4908                if(dist2 < distEntr) 
     4909                { 
     4910                    distEntr = dist2; 
     4911                    entryEntr = entry; 
     4912                } 
     4913            } 
     4914            else 
     4915            { 
     4916                foundEntr = true; 
     4917                distEntr = dist2; 
     4918                entryEntr = entry; 
     4919            } 
     4920        } 
    48954921        // find now nearest graveyard at same map 
    4896         float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z); 
    4897         if(foundNear) 
    4898         { 
    4899             if(dist2 < distNear) 
    4900             { 
     4922        else 
     4923        { 
     4924            float dist2 = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y)+(entry->z - z)*(entry->z - z); 
     4925            if(foundNear) 
     4926            { 
     4927                if(dist2 < distNear) 
     4928                { 
     4929                    distNear = dist2; 
     4930                    entryNear = entry; 
     4931                } 
     4932            } 
     4933            else 
     4934            { 
     4935                foundNear = true; 
    49014936                distNear = dist2; 
    49024937                entryNear = entry; 
    49034938            } 
    49044939        } 
    4905         else 
    4906         { 
    4907             foundNear = true; 
    4908             distNear = dist2; 
    4909             entryNear = entry; 
    4910         } 
    4911     } 
    4912  
     4940    } 
     4941 
     4942            // find now nearest graveyard at same map 
    49134943    if(entryNear) 
    49144944        return entryNear; 
     4945 
     4946    if(entryEntr) 
     4947        return entryEntr; 
    49154948 
    49164949    return entryFar; 
     
    51325165    for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); itr++) 
    51335166    { 
    5134         if(itr->second.target_mapId == mapEntry->parent_map) 
     5167        if(itr->second.target_mapId == mapEntry->entrance_map) 
    51355168        { 
    51365169            AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);