Capture complete immutable world views at simulation boundaries
This commit is contained in:
1 parent
68f91a236a
commit
fd17a2f3ff
6 files changed
+350
-35
No files matched your search
+13
-5
@@ -282,13 +282,21 @@ void Storage::add_item(ItemType type) {
|
||||
|
||||
World::World(std::uint64_t seed, std::int32_t width, std::int32_t height,
|
||||
std::size_t workers, ExecutionMode mode, WorkerPoolOptions worker_options)
|
||||
: seed_(seed),
|
||||
width_(width),
|
||||
height_(height),
|
||||
: WorldState(seed, width, height),
|
||||
worker_count_(checked_worker_count(workers, mode)),
|
||||
execution_mode_(mode),
|
||||
worker_options_(std::move(worker_options)),
|
||||
blocked_(checked_cell_count(width, height), 0) {}
|
||||
worker_options_(std::move(worker_options)) {
|
||||
blocked_.resize(checked_cell_count(width, height), 0);
|
||||
}
|
||||
|
||||
World::World(CaptureTag, const World& source)
|
||||
: WorldState(source),
|
||||
worker_count_(source.worker_count_),
|
||||
execution_mode_(source.execution_mode_) {}
|
||||
|
||||
std::shared_ptr<const World> World::capture() const {
|
||||
return std::shared_ptr<const World>(new const World(CaptureTag{}, *this));
|
||||
}
|
||||
|
||||
std::size_t World::cell_index(GridPosition position) const noexcept {
|
||||
return static_cast<std::size_t>(position.y) * static_cast<std::size_t>(width_) +
|
||||
|
||||
Reference in new issue
Block a user