Skip to content

Commit

Permalink
FIX(mapcraft_markers) setting world crop after cache update
Browse files Browse the repository at this point in the history
Cause:
    If render.conf contains multiple definitions of the same world with different
    crop setting it would cause cache to mistakenly update timestamp on whole
    region but some entities would left out because of cropping.

Consequence:
    This would cause Markers not be generated on global map. Markers would be
    only generated in cropped area.

Fix:
    When syncing world data with cache, crop is not applied. This way, world
    get correctly synced into cache on the first pass completely.

Result:
    Markers are generated correctly respecting their world they are displayed on.
    And cache is updated correctly for regions that are cropped in some worlds.
    First pass can take significant time, but any subsequent pass is instant
    beacause whole world is in cache (if you are using multiple world definitions
    with same world data, e.g. views)

    This would cause unnecessary work being done on worlds that have only cropped
    view of their world.
  • Loading branch information
zkraus authored and m0r13 committed Oct 5, 2018
1 parent 9025f8d commit c46e873
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mapcrafter_markers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Markers findMarkers(const config::MapcrafterConfig& config) {
mc::WorldCrop world_crop = world_it->second.getWorldCrop();
mc::World world(world_it->second.getInputDir().string(),
world_it->second.getDimension());
world.setWorldCrop(world_crop);
if (!world.load()) {
LOG(ERROR) << "Unable to load world " << world_it->first << "!";
continue;
Expand All @@ -79,6 +78,10 @@ Markers findMarkers(const config::MapcrafterConfig& config) {
util::LogOutputProgressHandler progress;
entities.update(&progress);

// Setting world crop after WorldEntitiesCache is fully updated
// to allow markers of the same non-cropped world to be generated
world.setWorldCrop(world_crop);

// use name of the world section as world name, not the world_name
std::string world_name = world_it->second.getShortName();
std::vector<mc::SignEntity> signs = entities.getSigns(world.getWorldCrop());
Expand Down

0 comments on commit c46e873

Please sign in to comment.