-
Notifications
You must be signed in to change notification settings - Fork 55
attempt to fix extractors and core #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
i-am-fyre
wants to merge
1
commit into
mangosthree:master
Choose a base branch
from
i-am-fyre:fix-extractors-and-core
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,9 +166,9 @@ namespace MMAP | |
| } | ||
|
|
||
| // load and init dtNavMesh - read parameters from file | ||
| uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i.mmap") + 1; | ||
| uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%04i.mmap") + 1; | ||
| char* fileName = new char[pathLen]; | ||
| snprintf(fileName, pathLen, (sWorld.GetDataPath() + "mmaps/%03i.mmap").c_str(), mapId); | ||
| snprintf(fileName, pathLen, (sWorld.GetDataPath() + "mmaps/%04i.mmap").c_str(), mapId); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change causes Segmentation Fault because the format is out of bounds |
||
|
|
||
| FILE* file = fopen(fileName, "rb"); | ||
| if (!file) | ||
|
|
@@ -190,14 +190,14 @@ namespace MMAP | |
| if (DT_SUCCESS != mesh->init(¶ms)) | ||
| { | ||
| dtFreeNavMesh(mesh); | ||
| sLog.outError("MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName); | ||
| sLog.outError("MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %04u from file %s", mapId, fileName); | ||
| delete[] fileName; | ||
| return false; | ||
| } | ||
|
|
||
| delete[] fileName; | ||
|
|
||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:loadMapData: Loaded %03i.mmap", mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:loadMapData: Loaded %04i.mmap", mapId); | ||
|
|
||
| // store inside our map list | ||
| MMapData* mmap_data = new MMapData(mesh); | ||
|
|
@@ -228,14 +228,14 @@ namespace MMAP | |
| uint32 packedGridPos = packTileID(x, y); | ||
| if (mmap->mmapLoadedTiles.find(packedGridPos) != mmap->mmapLoadedTiles.end()) | ||
| { | ||
| sLog.outError("MMAP:loadMap: Asked to load already loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); | ||
| sLog.outError("MMAP:loadMap: Asked to load already loaded navmesh tile. %04u%02i%02i.mmtile", mapId, x, y); | ||
| return false; | ||
| } | ||
|
|
||
| // load this tile :: mmaps/MMMXXYY.mmtile | ||
| uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i%02i%02i.mmtile") + 1; | ||
| uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%04i%02i%02i.mmtile") + 1; | ||
| char* fileName = new char[pathLen]; | ||
| snprintf(fileName, pathLen, (sWorld.GetDataPath() + "mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y); | ||
| snprintf(fileName, pathLen, (sWorld.GetDataPath() + "mmaps/%04i%02i%02i.mmtile").c_str(), mapId, x, y); | ||
|
|
||
| FILE* file = fopen(fileName, "rb"); | ||
| if (!file) | ||
|
|
@@ -252,14 +252,14 @@ namespace MMAP | |
|
|
||
| if (fileHeader.mmapMagic != MMAP_MAGIC) | ||
| { | ||
| sLog.outError("MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); | ||
| sLog.outError("MMAP:loadMap: Bad header in mmap %04u%02i%02i.mmtile", mapId, x, y); | ||
| fclose(file); | ||
| return false; | ||
| } | ||
|
|
||
| if (fileHeader.mmapVersion != MMAP_VERSION) | ||
| { | ||
| sLog.outError("MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", | ||
| sLog.outError("MMAP:loadMap: %04u%02i%02i.mmtile was built with generator v%i, expected v%i", | ||
| mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION); | ||
| fclose(file); | ||
| return false; | ||
|
|
@@ -271,7 +271,7 @@ namespace MMAP | |
| size_t result = fread(data, fileHeader.size, 1, file); | ||
| if (!result) | ||
| { | ||
| sLog.outError("MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y); | ||
| sLog.outError("MMAP:loadMap: Bad header or data in mmap %04u%02i%02i.mmtile", mapId, x, y); | ||
| fclose(file); | ||
| return false; | ||
| } | ||
|
|
@@ -284,14 +284,14 @@ namespace MMAP | |
| // memory allocated for data is now managed by detour, and will be deallocated when the tile is removed | ||
| if (mmap->navMesh->addTile(data, fileHeader.size, DT_TILE_FREE_DATA, 0, &tileRef) != DT_SUCCESS) | ||
| { | ||
| sLog.outError("MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y); | ||
| sLog.outError("MMAP:loadMap: Could not load %04u%02i%02i.mmtile into navmesh", mapId, x, y); | ||
| dtFree(data); | ||
| return false; | ||
| } | ||
|
|
||
| mmap->mmapLoadedTiles.insert(std::pair<uint32, dtTileRef>(packedGridPos, tileRef)); | ||
| ++loadedTiles; | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:loadMap: Loaded mmtile %04i[%02i,%02i] into %04i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -301,7 +301,7 @@ namespace MMAP | |
| if (loadedMMaps.find(mapId) == loadedMMaps.end()) | ||
| { | ||
| // file may not exist, therefore not loaded | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh map. %04u%02i%02i.mmtile", mapId, x, y); | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -312,7 +312,7 @@ namespace MMAP | |
| if (mmap->mmapLoadedTiles.find(packedGridPos) == mmap->mmapLoadedTiles.end()) | ||
| { | ||
| // file may not exist, therefore not loaded | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh tile. %04u%02i%02i.mmtile", mapId, x, y); | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -324,14 +324,14 @@ namespace MMAP | |
| // this is technically a memory leak | ||
| // if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used | ||
| // we cannot recover from this error - assert out | ||
| sLog.outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); | ||
| sLog.outError("MMAP:unloadMap: Could not unload %04u%02i%02i.mmtile from navmesh", mapId, x, y); | ||
| MANGOS_ASSERT(false); | ||
| } | ||
| else | ||
| { | ||
| mmap->mmapLoadedTiles.erase(packedGridPos); | ||
| --loadedTiles; | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded mmtile %04i[%02i,%02i] from %04i", mapId, x, y, mapId); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -343,7 +343,7 @@ namespace MMAP | |
| if (loadedMMaps.find(mapId) == loadedMMaps.end()) | ||
| { | ||
| // file may not exist, therefore not loaded | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh map %03u", mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Asked to unload not loaded navmesh map %04u", mapId); | ||
| return false; | ||
| } | ||
|
|
||
|
|
@@ -355,18 +355,18 @@ namespace MMAP | |
| uint32 y = (i->first & 0x0000FFFF); | ||
| if (DT_SUCCESS != mmap->navMesh->removeTile(i->second, NULL, NULL)) | ||
| { | ||
| sLog.outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); | ||
| sLog.outError("MMAP:unloadMap: Could not unload %04u%02i%02i.mmtile from navmesh", mapId, x, y); | ||
| } | ||
| else | ||
| { | ||
| --loadedTiles; | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded mmtile %04i[%02i,%02i] from %04i", mapId, x, y, mapId); | ||
| } | ||
| } | ||
|
|
||
| delete mmap; | ||
| loadedMMaps.erase(mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded %03i.mmap", mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMap: Unloaded %04i.mmap", mapId); | ||
|
|
||
| return true; | ||
| } | ||
|
|
@@ -377,22 +377,22 @@ namespace MMAP | |
| if (loadedMMaps.find(mapId) == loadedMMaps.end()) | ||
| { | ||
| // file may not exist, therefore not loaded | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %04u", mapId); | ||
| return false; | ||
| } | ||
|
|
||
| MMapData* mmap = loadedMMaps[mapId]; | ||
| if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) | ||
| { | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %04u instanceId %u", mapId, instanceId); | ||
| return false; | ||
| } | ||
|
|
||
| dtNavMeshQuery* query = mmap->navMeshQueries[instanceId]; | ||
|
|
||
| dtFreeNavMeshQuery(query); | ||
| mmap->navMeshQueries.erase(instanceId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:unloadMapInstance: Unloaded mapId %04u instanceId %u", mapId, instanceId); | ||
|
|
||
| return true; | ||
| } | ||
|
|
@@ -423,11 +423,11 @@ namespace MMAP | |
| if (DT_SUCCESS != query->init(mmap->navMesh, 1024)) | ||
| { | ||
| dtFreeNavMeshQuery(query); | ||
| sLog.outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); | ||
| sLog.outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %04u instanceId %u", mapId, instanceId); | ||
| return NULL; | ||
| } | ||
|
|
||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); | ||
| DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %04u instanceId %u", mapId, instanceId); | ||
| mmap->navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query)); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this chage causes egmentation fault due to the format on this case is out of bounds