add findShipDef/findModuleDef/findRecipeDef to config structs and re-use them in the rest of the code base

This commit is contained in:
2026-08-03 20:57:31 +02:00
parent af6828c348
commit 553a7e0701
12 changed files with 100 additions and 189 deletions

View File

@@ -49,4 +49,18 @@ struct ShipDef
struct ShipsConfig
{
std::vector<ShipDef> ships;
// Returns the definition for the given ship schematic id, or nullptr if the
// id has no entry in ships.toml.
const ShipDef* findShipDef(const std::string& id) const
{
for (const ShipDef& def : ships)
{
if (def.id == id)
{
return &def;
}
}
return nullptr;
}
};