Keep logistics targets stable through storage and resource removal
This commit is contained in:
1 parent
a4cf99c265
commit
8260e09be7
9 files changed
+494
-87
No files matched your search
@@ -17,6 +17,8 @@ namespace settlement {
|
||||
|
||||
using AgentId = std::uint64_t;
|
||||
using JobId = std::uint64_t;
|
||||
using ResourceNodeId = std::uint64_t;
|
||||
using StorageId = std::uint64_t;
|
||||
|
||||
struct GridPosition {
|
||||
std::int32_t x = 0;
|
||||
@@ -237,8 +239,8 @@ struct Agent {
|
||||
std::vector<GridPosition> route;
|
||||
std::size_t route_cursor = 0;
|
||||
std::uint32_t work_remaining = 0;
|
||||
std::size_t resource_node_index = no_entity_index;
|
||||
std::size_t storage_index = no_entity_index;
|
||||
ResourceNodeId resource_node_id = 0;
|
||||
StorageId storage_id = 0;
|
||||
Inventory inventory;
|
||||
std::vector<GridPosition> haul_route;
|
||||
std::size_t production_index = no_entity_index;
|
||||
@@ -260,7 +262,7 @@ struct WorkJob {
|
||||
};
|
||||
|
||||
struct ResourceNode {
|
||||
std::uint64_t id = 0;
|
||||
ResourceNodeId id = 0;
|
||||
GridPosition position;
|
||||
ItemType type = ItemType::None;
|
||||
std::uint32_t quantity = 0;
|
||||
@@ -282,7 +284,7 @@ struct ItemStack {
|
||||
};
|
||||
|
||||
struct Storage {
|
||||
std::uint64_t id = 0;
|
||||
StorageId id = 0;
|
||||
GridPosition position;
|
||||
std::uint32_t capacity = 0;
|
||||
std::uint32_t reserved_slots = 0;
|
||||
@@ -317,13 +319,13 @@ struct Storage {
|
||||
};
|
||||
|
||||
struct MaterialReservation {
|
||||
std::size_t storage_index;
|
||||
StorageId storage_id;
|
||||
ItemType type;
|
||||
std::uint32_t count;
|
||||
};
|
||||
|
||||
struct ConstructionStop {
|
||||
std::size_t storage_index;
|
||||
StorageId storage_id;
|
||||
std::vector<GridPosition> route_to_next;
|
||||
};
|
||||
|
||||
@@ -443,6 +445,8 @@ public:
|
||||
[[nodiscard]] const std::vector<WorkJob>& jobs() const noexcept;
|
||||
[[nodiscard]] const std::vector<ResourceNode>& resource_nodes() const noexcept;
|
||||
[[nodiscard]] const std::vector<Storage>& storages() const noexcept;
|
||||
[[nodiscard]] const Storage* find_storage(StorageId id) const noexcept;
|
||||
[[nodiscard]] const ResourceNode* find_resource_node(ResourceNodeId id) const noexcept;
|
||||
[[nodiscard]] const std::vector<ProductionOrder>& production_orders() const noexcept;
|
||||
[[nodiscard]] const ProductionOrder* assigned_bed(AgentId agent) const noexcept;
|
||||
[[nodiscard]] bool is_bed_cell(GridPosition position) const noexcept;
|
||||
@@ -463,6 +467,8 @@ private:
|
||||
bool reachable = false;
|
||||
};
|
||||
|
||||
[[nodiscard]] Storage& storage_by_id(StorageId id);
|
||||
[[nodiscard]] ResourceNode& resource_node_by_id(ResourceNodeId id);
|
||||
[[nodiscard]] std::size_t cell_index(GridPosition position) const noexcept;
|
||||
[[nodiscard]] PathResult find_path(GridPosition start, GridPosition goal) const;
|
||||
[[nodiscard]] PathResult assignment_path(GridPosition start, GridPosition goal);
|
||||
|
||||
Reference in new issue
Block a user