rename blueprint to schematic
This commit is contained in:
@@ -30,9 +30,9 @@ Simulation::Simulation(GameConfig config, unsigned int seed)
|
||||
[this]() { return allocateId(); },
|
||||
[this](int amount) { m_buildingBlocksStock += amount; },
|
||||
[this](const std::string& id, QVector2D pos) {
|
||||
const std::map<std::string, BlueprintState>::const_iterator it =
|
||||
m_blueprintLevels.find(id);
|
||||
if (it == m_blueprintLevels.end() || !it->second.unlocked)
|
||||
const std::map<std::string, SchematicState>::const_iterator it =
|
||||
m_schematicLevels.find(id);
|
||||
if (it == m_schematicLevels.end() || !it->second.unlocked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -44,13 +44,13 @@ Simulation::Simulation(GameConfig config, unsigned int seed)
|
||||
m_waveSystem = std::make_unique<WaveSystem>(m_config, m_rng);
|
||||
m_combatSystem = std::make_unique<CombatSystem>(m_config);
|
||||
|
||||
// Initialize blueprint unlock state.
|
||||
// Initialize schematic unlock state.
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
BlueprintState state;
|
||||
SchematicState state;
|
||||
state.unlocked = def.availableFromStart;
|
||||
state.level = def.availableFromStart ? def.blueprint.playerProductionLevel : 0;
|
||||
m_blueprintLevels[def.id] = state;
|
||||
state.level = def.availableFromStart ? def.schematic.playerProductionLevel : 0;
|
||||
m_schematicLevels[def.id] = state;
|
||||
}
|
||||
|
||||
placeInitialStructures();
|
||||
@@ -82,7 +82,7 @@ void Simulation::reset(unsigned int seed)
|
||||
m_currentEnemyStationIds[0] = kInvalidEntityId;
|
||||
m_currentEnemyStationIds[1] = kInvalidEntityId;
|
||||
m_fireEvents.clear();
|
||||
m_blueprintDropEvents.clear();
|
||||
m_schematicDropEvents.clear();
|
||||
|
||||
m_beltSystem = BeltSystem(m_config.world.beltSpeedTilesPerSecond);
|
||||
m_buildingSystem = std::make_unique<BuildingSystem>(
|
||||
@@ -91,9 +91,9 @@ void Simulation::reset(unsigned int seed)
|
||||
[this]() { return allocateId(); },
|
||||
[this](int amount) { m_buildingBlocksStock += amount; },
|
||||
[this](const std::string& id, QVector2D pos) {
|
||||
const std::map<std::string, BlueprintState>::const_iterator it =
|
||||
m_blueprintLevels.find(id);
|
||||
if (it == m_blueprintLevels.end() || !it->second.unlocked)
|
||||
const std::map<std::string, SchematicState>::const_iterator it =
|
||||
m_schematicLevels.find(id);
|
||||
if (it == m_schematicLevels.end() || !it->second.unlocked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -105,13 +105,13 @@ void Simulation::reset(unsigned int seed)
|
||||
m_waveSystem = std::make_unique<WaveSystem>(m_config, m_rng);
|
||||
m_combatSystem = std::make_unique<CombatSystem>(m_config);
|
||||
|
||||
m_blueprintLevels.clear();
|
||||
m_schematicLevels.clear();
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
BlueprintState state;
|
||||
SchematicState state;
|
||||
state.unlocked = def.availableFromStart;
|
||||
state.level = def.availableFromStart ? def.blueprint.playerProductionLevel : 0;
|
||||
m_blueprintLevels[def.id] = state;
|
||||
state.level = def.availableFromStart ? def.schematic.playerProductionLevel : 0;
|
||||
m_schematicLevels[def.id] = state;
|
||||
}
|
||||
|
||||
placeInitialStructures();
|
||||
@@ -290,7 +290,7 @@ void Simulation::tickDeathsAndLoot()
|
||||
// Look up scrap drop amount from config.
|
||||
for (const ShipDef& def : m_config.ships.ships)
|
||||
{
|
||||
if (def.id == s->blueprintId && def.loot.scrapDrop > 0)
|
||||
if (def.id == s->schematicId && def.loot.scrapDrop > 0)
|
||||
{
|
||||
const Tick despawnAt = m_currentTick
|
||||
+ secondsToTicks(m_config.world.scrapDespawnSeconds);
|
||||
@@ -366,11 +366,11 @@ void Simulation::tickDeathsAndLoot()
|
||||
{
|
||||
m_waveSystem->applyPush();
|
||||
placeEnemyStationSet(m_waveSystem->generation());
|
||||
awardBlueprintDrop();
|
||||
awardSchematicDrop();
|
||||
}
|
||||
}
|
||||
|
||||
void Simulation::awardBlueprintDrop()
|
||||
void Simulation::awardSchematicDrop()
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
ids.reserve(m_config.ships.ships.size());
|
||||
@@ -382,16 +382,16 @@ void Simulation::awardBlueprintDrop()
|
||||
std::uniform_int_distribution<int> dist(0, static_cast<int>(ids.size()) - 1);
|
||||
const std::string chosen = ids[static_cast<std::size_t>(dist(m_rng))];
|
||||
|
||||
BlueprintState& state = m_blueprintLevels.at(chosen);
|
||||
SchematicState& state = m_schematicLevels.at(chosen);
|
||||
const bool wasNew = !state.unlocked;
|
||||
state.unlocked = true;
|
||||
state.level += 1;
|
||||
|
||||
BlueprintDropEvent evt;
|
||||
evt.blueprintId = chosen;
|
||||
SchematicDropEvent evt;
|
||||
evt.schematicId = chosen;
|
||||
evt.newLevel = state.level;
|
||||
evt.wasNewUnlock = wasNew;
|
||||
m_blueprintDropEvents.push_back(evt);
|
||||
m_schematicDropEvents.push_back(evt);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -405,10 +405,10 @@ std::vector<FireEvent> Simulation::drainFireEvents()
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<BlueprintDropEvent> Simulation::drainBlueprintDropEvents()
|
||||
std::vector<SchematicDropEvent> Simulation::drainSchematicDropEvents()
|
||||
{
|
||||
std::vector<BlueprintDropEvent> result;
|
||||
result.swap(m_blueprintDropEvents);
|
||||
std::vector<SchematicDropEvent> result;
|
||||
result.swap(m_schematicDropEvents);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -436,22 +436,22 @@ double Simulation::threatLevel() const
|
||||
return m_waveSystem->threatLevel();
|
||||
}
|
||||
|
||||
int Simulation::blueprintLevel(const std::string& shipId) const
|
||||
int Simulation::schematicLevel(const std::string& shipId) const
|
||||
{
|
||||
const std::map<std::string, BlueprintState>::const_iterator it =
|
||||
m_blueprintLevels.find(shipId);
|
||||
if (it == m_blueprintLevels.end())
|
||||
const std::map<std::string, SchematicState>::const_iterator it =
|
||||
m_schematicLevels.find(shipId);
|
||||
if (it == m_schematicLevels.end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return it->second.level;
|
||||
}
|
||||
|
||||
bool Simulation::isBlueprintUnlocked(const std::string& shipId) const
|
||||
bool Simulation::isSchematicUnlocked(const std::string& shipId) const
|
||||
{
|
||||
const std::map<std::string, BlueprintState>::const_iterator it =
|
||||
m_blueprintLevels.find(shipId);
|
||||
if (it == m_blueprintLevels.end())
|
||||
const std::map<std::string, SchematicState>::const_iterator it =
|
||||
m_schematicLevels.find(shipId);
|
||||
if (it == m_schematicLevels.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user