Changeset 230 for trunk/src/game/ObjectMgr.cpp
- Timestamp:
- 11/19/08 13:48:46 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/ObjectMgr.cpp
r229 r230 4828 4828 } 4829 4829 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 4836 4830 if(!AddGraveYardLink(safeLocId,zoneId,team,false)) 4837 4831 sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); … … 4855 4849 // then check faction 4856 4850 // if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated 4857 // then skipcheck faction4851 // then check faction 4858 4852 GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId); 4859 4853 GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId); … … 4864 4858 } 4865 4859 4860 // at corpse map 4866 4861 bool foundNear = false; 4867 4862 float distNear; 4868 4863 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 4869 4871 WorldSafeLocsEntry const* entryFar = NULL; 4872 4873 MapEntry const* mapEntry = sMapStore.LookupEntry(MapId); 4870 4874 4871 4875 for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr) … … 4880 4884 } 4881 4885 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 4891 4887 // team == 0 case can be at call from .neargrave 4892 4888 if(data.team != 0 && team != 0 && data.team != team) 4893 4889 continue; 4894 4890 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 } 4895 4921 // 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; 4901 4936 distNear = dist2; 4902 4937 entryNear = entry; 4903 4938 } 4904 4939 } 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 4913 4943 if(entryNear) 4914 4944 return entryNear; 4945 4946 if(entryEntr) 4947 return entryEntr; 4915 4948 4916 4949 return entryFar; … … 5132 5165 for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); itr++) 5133 5166 { 5134 if(itr->second.target_mapId == mapEntry-> parent_map)5167 if(itr->second.target_mapId == mapEntry->entrance_map) 5135 5168 { 5136 5169 AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first);