Can't load map from JSON anymore #127
-
Hey, I've recently updated to 0.9.0 Rocky and had a problem while trying to load map from JSON:
Basically, I used the code below and it worked before 0.9.0 update: if (rocky::Result<> _loadMapFileStatus = _loadMapFile(*app.mapNode, app.vsgcontext); _loadMapFileStatus.failed())
{
Log()->critical(_loadMapFileStatus.error().string());
Log()->critical("Failed to load map file. Exiting application...");
return EXIT_FAILURE;
} And here's rocky::Result<> _loadMapFile(rocky::MapNode& _mapNode, rocky::Context _context)
{
rocky::Result<> status;
std::string mapFilePath;
if (_hasInternetConnection())
{
Log()->info("Internet connection detected. Loading online map file...");
mapFilePath = ConfigManager::getInstance().getNativeDir() + "data/world/openstreetmap.map.json";
}
else
{
Log()->info("No internet connection available. Loading offline map file...");
mapFilePath = ConfigManager::getInstance().getNativeDir() + "data/world/offline.map.json";
}
if (auto mapFile = rocky::URI(mapFilePath).read(_context->io); mapFile.ok())
{
auto parseResult = _mapNode.from_json(mapFile->content.data, _context->io.from(mapFilePath));
if (parseResult.failed())
{
status = parseResult.error();
}
}
else
{
status = mapFile.error();
}
return status;
} What's wrong with my code? I'm trying to load JSON map right after creating |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I've just tried to open rocky_engine (because it is also manages OSM) and it gives me the same assertion error, which is weird. Readymap is OK even within my application... |
Beta Was this translation helpful? Give feedback.
-
Nothing wrong with your code, it was a bug and I have pushed a fix. |
Beta Was this translation helpful? Give feedback.
Nothing wrong with your code, it was a bug and I have pushed a fix.