MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / previewAddBiomeRegion

Method previewAddBiomeRegion

source/game/StarWorldLayout.cpp:490–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490List<RectI> WorldLayout::previewAddBiomeRegion(Vec2I const& position, int width) const {
491 auto layerAndCell = findLayerAndCell(position[0], position[1]);
492 auto targetLayer = m_layers[layerAndCell.first];
493 auto targetRegion = targetLayer.cells[layerAndCell.second];
494
495 int insertX = position[0] > 0 ? position[0] : 1;
496
497 // need a dummy region to expand
498 std::shared_ptr<WorldRegion> dummyRegion;
499
500 targetLayer.boundaries.insertAt(layerAndCell.second, insertX);
501 targetLayer.cells.insertAt(layerAndCell.second, dummyRegion);
502
503 targetLayer.boundaries.insertAt(layerAndCell.second, insertX - 1);
504 targetLayer.cells.insertAt(layerAndCell.second, targetRegion);
505
506 auto expandResult = expandRegionInLayer(targetLayer, layerAndCell.second + 1, width);
507
508 return expandResult.second;
509}
510
511List<RectI> WorldLayout::previewExpandBiomeRegion(Vec2I const& position, int width) const {
512 auto layerAndCell = findLayerAndCell(position[0], position[1]);

Callers 2

addBiomeRegionMethod · 0.45
pregenerateAddBiomeMethod · 0.45

Calls 1

insertAtMethod · 0.80

Tested by

no test coverage detected