implement sensor range requirements

This commit is contained in:
2026-04-29 21:01:41 +02:00
parent 58b7cda21c
commit b0320ac117
9 changed files with 178 additions and 30 deletions

View File

@@ -397,6 +397,14 @@ ShipsConfig ConfigLoader::loadShips(const std::string& path)
def.movement.speedFormula = requireFormula(mMt["speed_formula"], file, mPath + ".speed_formula");
}
// Sensor
{
const std::string snsPath = elemPath + ".sensor";
const toml::table& snsTable = requireTable(mt["sensor"], file, snsPath);
toml::table& snsMt = const_cast<toml::table&>(snsTable);
def.sensor.sensorRangeFormula = requireFormula(snsMt["sensor_range_formula"], file, snsPath + ".sensor_range_formula");
}
// Loot
{
const std::string lPath = elemPath + ".loot";

View File

@@ -33,6 +33,11 @@ struct ShipMovement
Formula speedFormula; // REQ-SHP-STATS, REQ-SHP-MOVEMENT
};
struct ShipSensor
{
Formula sensorRangeFormula; // REQ-SHP-SENSOR, REQ-SHP-STATS
};
struct ShipCombat
{
Formula damageFormula;
@@ -69,6 +74,7 @@ struct ShipDef
ShipThreat threat;
ShipHealth health;
ShipMovement movement;
ShipSensor sensor;
ShipLoot loot;
// Role-specific sections. A ship is a combat ship if combat is present,