Files
dota_factory/src/lib/config/BuildingsConfig.h
Malte Langkabel 3148c9154c Fix Salvage Bay drop-off: config-driven output-buffer capacity
Salvage ships flew to their assigned Salvage Bay with full cargo and
waited there forever without delivering. A Salvage Bay's
outputBuffer.capacity was never initialized (stayed 0), so
deliverScrapToSalvageBay always rejected the hand-over, cargo never
drained, and DeliverScrap stayed the winning behavior indefinitely.

Give the bay a config-driven output-buffer capacity:
- BuildingDef gains optional outputBufferCapacity; ConfigLoader parses
  the new output_buffer_capacity key.
- salvage_bay in both buildings.toml files sets it to 20.
- initSalvageBayBuffer applies it on both operational-creation paths
  (construction completion and placeImmediate).
- REQ-BLD-SALVAGE-BAY documents the config-sized buffer and hand-over.
- Tests: config parse assertion and end-to-end delivery hand-over.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VGNNLeFWhVzvxkK9qVXP2K
2026-07-09 11:05:58 +02:00

32 lines
1.0 KiB
C++

#pragma once
#include <optional>
#include <string>
#include <vector>
#include "BuildingType.h"
// A single entry from buildings.toml [[building]].
struct BuildingDef
{
std::string id; // Raw id string from TOML, e.g. "miner".
BuildingType type; // Parsed from id at load time.
int cost; // REQ-BLD-COST
bool playerPlaceable; // Shown in the build menu if true.
double constructionTimeSeconds; // REQ-BLD-QUEUE
// Rows of the surface_mask (REQ-BLD requirements, "Surface Mask Format").
// Stored as raw strings here; parsing into per-cell tiles + output ports
// happens when buildings are placed, not at load time.
std::vector<std::string> surfaceMask;
// Output-buffer holding size for buildings without a recipe-driven buffer.
// Only the Salvage Bay sets this (REQ-BLD-SALVAGE-BAY).
std::optional<int> outputBufferCapacity;
};
struct BuildingsConfig
{
std::vector<BuildingDef> buildings;
};