rename blueprint to schematic
This commit is contained in:
@@ -17,11 +17,11 @@ static GameConfig loadConfig()
|
||||
return ConfigLoader::loadFromDirectory(DOTA_FACTORY_CONFIG_DIR);
|
||||
}
|
||||
|
||||
static const ShipDef* findAvailableBlueprint(const GameConfig& cfg)
|
||||
static const ShipDef* findAvailableSchematic(const GameConfig& cfg)
|
||||
{
|
||||
for (const ShipDef& def : cfg.ships.ships)
|
||||
{
|
||||
if (def.availableFromStart && !def.blueprint.materials.empty())
|
||||
if (def.availableFromStart && !def.schematic.materials.empty())
|
||||
{
|
||||
return &def;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ static void fillMaterials(Simulation& sim, EntityId yardId, const ShipDef& def)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (const RecipeIngredient& ing : def.blueprint.materials)
|
||||
for (const RecipeIngredient& ing : def.schematic.materials)
|
||||
{
|
||||
b.inputBuffer.counts[ItemType{ing.item}] = ing.amount;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ TEST_CASE("Shipyard: spawns a player ship after production cycle completes",
|
||||
{
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
const ShipDef* def = findAvailableBlueprint(sim.config());
|
||||
const ShipDef* def = findAvailableSchematic(sim.config());
|
||||
REQUIRE(def != nullptr);
|
||||
const BuildingDef* yardDef = findShipyardDef(sim.config());
|
||||
REQUIRE(yardDef != nullptr);
|
||||
@@ -93,7 +93,7 @@ TEST_CASE("Shipyard: spawns a player ship after production cycle completes",
|
||||
REQUIRE(static_cast<int>(sim.ships().allShips().size()) == shipsBefore);
|
||||
|
||||
// Tick until the cycle completes.
|
||||
const Tick cycleTicks = secondsToTicks(def->blueprint.productionTimeSeconds);
|
||||
const Tick cycleTicks = secondsToTicks(def->schematic.productionTimeSeconds);
|
||||
for (Tick i = 1; i < cycleTicks; ++i)
|
||||
{
|
||||
sim.tick();
|
||||
@@ -107,7 +107,7 @@ TEST_CASE("Shipyard: spawns a player ship after production cycle completes",
|
||||
bool foundPlayerShip = false;
|
||||
for (const Ship& ship : sim.ships().allShips())
|
||||
{
|
||||
if (!ship.isEnemy && ship.blueprintId == def->id)
|
||||
if (!ship.isEnemy && ship.schematicId == def->id)
|
||||
{
|
||||
foundPlayerShip = true;
|
||||
break;
|
||||
@@ -116,7 +116,7 @@ TEST_CASE("Shipyard: spawns a player ship after production cycle completes",
|
||||
REQUIRE(foundPlayerShip);
|
||||
}
|
||||
|
||||
TEST_CASE("Shipyard: does not spawn without a blueprint set", "[shipyard]")
|
||||
TEST_CASE("Shipyard: does not spawn without a schematic set", "[shipyard]")
|
||||
{
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
@@ -136,7 +136,7 @@ TEST_CASE("Shipyard: does not spawn with insufficient materials", "[shipyard]")
|
||||
{
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
const ShipDef* def = findAvailableBlueprint(sim.config());
|
||||
const ShipDef* def = findAvailableSchematic(sim.config());
|
||||
REQUIRE(def != nullptr);
|
||||
const BuildingDef* yardDef = findShipyardDef(sim.config());
|
||||
REQUIRE(yardDef != nullptr);
|
||||
@@ -147,7 +147,7 @@ TEST_CASE("Shipyard: does not spawn with insufficient materials", "[shipyard]")
|
||||
sim.buildings().setRecipe(yardId, def->id);
|
||||
// Materials remain at zero (default after setRecipe); no cycle starts.
|
||||
|
||||
const Tick cycleTicks = secondsToTicks(def->blueprint.productionTimeSeconds);
|
||||
const Tick cycleTicks = secondsToTicks(def->schematic.productionTimeSeconds);
|
||||
for (Tick i = 0; i <= cycleTicks; ++i)
|
||||
{
|
||||
sim.tick();
|
||||
@@ -160,7 +160,7 @@ TEST_CASE("Shipyard: spawns a second ship after materials replenished", "[shipya
|
||||
{
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
const ShipDef* def = findAvailableBlueprint(sim.config());
|
||||
const ShipDef* def = findAvailableSchematic(sim.config());
|
||||
REQUIRE(def != nullptr);
|
||||
const BuildingDef* yardDef = findShipyardDef(sim.config());
|
||||
REQUIRE(yardDef != nullptr);
|
||||
@@ -168,7 +168,7 @@ TEST_CASE("Shipyard: spawns a second ship after materials replenished", "[shipya
|
||||
const EntityId yardId = placeShipyard(sim, *yardDef);
|
||||
sim.buildings().setRecipe(yardId, def->id);
|
||||
|
||||
const Tick cycleTicks = secondsToTicks(def->blueprint.productionTimeSeconds);
|
||||
const Tick cycleTicks = secondsToTicks(def->schematic.productionTimeSeconds);
|
||||
|
||||
// First cycle: capture count immediately after the spawn tick.
|
||||
fillMaterials(sim, yardId, *def);
|
||||
|
||||
Reference in New Issue
Block a user