mirror of
https://github.com/mangosfour/server.git
synced 2026-01-02 01:37:05 +00:00
[9422] Return success result for Zone<->map coordinates convertions.
This will prevent #INF-inity values in gps for zones where zone coordinates calculation impossible with current code. Also fix small typo in debug output format for honor
This commit is contained in:
parent
a916e31316
commit
b2019913d4
5 changed files with 25 additions and 12 deletions
|
|
@ -772,30 +772,34 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT
|
|||
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
|
||||
}
|
||||
|
||||
void Zone2MapCoordinates(float& x,float& y,uint32 zone)
|
||||
bool Zone2MapCoordinates(float& x,float& y,uint32 zone)
|
||||
{
|
||||
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
|
||||
|
||||
// if not listed then map coordinates (instance)
|
||||
if(!maEntry)
|
||||
return;
|
||||
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
||||
return false;
|
||||
|
||||
std::swap(x,y); // at client map coords swapped
|
||||
x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1;
|
||||
y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Map2ZoneCoordinates(float& x,float& y,uint32 zone)
|
||||
bool Map2ZoneCoordinates(float& x,float& y,uint32 zone)
|
||||
{
|
||||
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
|
||||
|
||||
// if not listed then map coordinates (instance)
|
||||
if(!maEntry)
|
||||
return;
|
||||
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
||||
return false;
|
||||
|
||||
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
|
||||
y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down
|
||||
std::swap(x,y); // client have map coords swapped
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue