diff --git a/engine/src/cmd/jump_capable.cpp b/engine/src/cmd/jump_capable.cpp index 1bd793f5a..36be5dabd 100644 --- a/engine/src/cmd/jump_capable.cpp +++ b/engine/src/cmd/jump_capable.cpp @@ -271,8 +271,7 @@ bool JumpCapable::AutoPilotToErrorMessage(const Unit *target, failuremessage = configuration()->graphics_config.hud.already_near_message; return false; } - unit->ftl_energy.Deplete(true, static_cast(totpercent) * unit->ftl_drive.GetAtomConsumption()); - // TODO: figure out to do unit->ftl_drive.Consume() instead + if (unsafe == false && totpercent == 0) { end = endne; } diff --git a/engine/src/components/energy_container.cpp b/engine/src/components/energy_container.cpp index f26825e1d..c109e1da5 100644 --- a/engine/src/components/energy_container.cpp +++ b/engine/src/components/energy_container.cpp @@ -131,7 +131,22 @@ void EnergyContainer::Load(std::string upgrade_key, std::string unit_key) { } void EnergyContainer::SaveToCSV(std::map& unit) const { - unit[FUEL_CAPACITY] = std::to_string(MaxLevel()); + switch(type) { + case ComponentType::Fuel: + unit[FUEL_CAPACITY] = std::to_string(MaxLevel() / configuration()->fuel.fuel_factor); + break; + + case ComponentType::Capacitor: + unit[FUEL_CAPACITY] = std::to_string(MaxLevel() / configuration()->fuel.energy_factor); + break; + + case ComponentType::FtlCapacitor: + unit[FUEL_CAPACITY] = std::to_string(MaxLevel() / configuration()->fuel.ftl_energy_factor); + break; + + default: // This really can't happen + abort(); + } } diff --git a/engine/src/components/ftl_drive.cpp b/engine/src/components/ftl_drive.cpp index 4bfe03daf..2d3a76e1a 100644 --- a/engine/src/components/ftl_drive.cpp +++ b/engine/src/components/ftl_drive.cpp @@ -50,17 +50,15 @@ void FtlDrive::Load(std::string upgrade_key, std::string unit_key) { Component::Load(upgrade_key, unit_key); - const double ftl_drive_factor = configuration()->fuel.ftl_drive_factor; - // Consumer double energy = UnitCSVFactory::GetVariable(unit_key, "Warp_Usage_Cost", 0.0f); - SetConsumption(energy * ftl_drive_factor); + SetConsumption(energy * configuration()->fuel.ftl_drive_factor); // FTL Drive } void FtlDrive::SaveToCSV(std::map& unit) const { - unit["Warp_Usage_Cost"] = std::to_string(consumption); + unit["Warp_Usage_Cost"] = std::to_string(consumption / configuration()->fuel.ftl_drive_factor); } // FTL drive is integrated and so cannot be upgraded/downgraded diff --git a/engine/src/components/jump_drive.cpp b/engine/src/components/jump_drive.cpp index 5478424ae..d5be93a24 100644 --- a/engine/src/components/jump_drive.cpp +++ b/engine/src/components/jump_drive.cpp @@ -78,12 +78,10 @@ bool JumpDrive::Enabled() const { void JumpDrive::Load(std::string upgrade_key, std::string unit_key) { Component::Load(upgrade_key, unit_key); - const double jump_drive_factor = configuration()->fuel.jump_drive_factor; - // Consumer double energy = UnitCSVFactory::GetVariable(unit_key, "Outsystem_Jump_Cost", 0.0f); // Jump drive is unique - consumption and atom_consumption are identical - atom_consumption = consumption = energy * jump_drive_factor; + atom_consumption = consumption = energy * configuration()->fuel.jump_drive_factor; // Jump Drive @@ -98,7 +96,7 @@ void JumpDrive::Load(std::string upgrade_key, std::string unit_key) { void JumpDrive::SaveToCSV(std::map& unit) const { unit["Jump_Drive_Present"] = std::to_string(Installed()); unit["Jump_Drive_Delay"] = std::to_string(delay); - unit["Outsystem_Jump_Cost"] = std::to_string(consumption); + unit["Outsystem_Jump_Cost"] = std::to_string(consumption / configuration()->fuel.jump_drive_factor); } bool JumpDrive::CanDowngrade() const { diff --git a/engine/src/components/reactor.cpp b/engine/src/components/reactor.cpp index c90fb076b..b4726865f 100644 --- a/engine/src/components/reactor.cpp +++ b/engine/src/components/reactor.cpp @@ -62,7 +62,7 @@ void Reactor::Load(std::string upgrade_key, std::string unit_key) { void Reactor::SaveToCSV(std::map& unit) const { // TODO: This won't record damage to recharge - unit[REACTOR_RECHARGE] = std::to_string(capacity.MaxValue()); + unit[REACTOR_RECHARGE] = std::to_string(capacity.MaxValue() / configuration()->fuel.reactor_factor); } diff --git a/engine/src/configuration/configuration.h b/engine/src/configuration/configuration.h index 83824b812..4b5cb67eb 100644 --- a/engine/src/configuration/configuration.h +++ b/engine/src/configuration/configuration.h @@ -189,11 +189,11 @@ struct Fuel { double fuel_factor{60.0}; // Multiply fuel by this to get fuel by minutes double energy_factor{1.0}; - double ftl_energy_factor{0.1}; + double ftl_energy_factor{1.0}; double reactor_factor{1.0}; - double ftl_drive_factor{1.0}; + double ftl_drive_factor{0.1}; double jump_drive_factor{1.0}; // 0 infinite, 1 fuel, 2 energy, 3 ftl_energy, 4 disabled