Skip to content

Commit

Permalink
compulsive consistency tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
z-adams committed Feb 15, 2021
1 parent d8c1393 commit 7b7efff
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/adera/ShipResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ struct ShipResourceType
const uint64_t m_quantaPerUnit;

// The volume (in m^3) of one unit of this resource
const float m_volume;
const float m_volumePerUnit;

// The mass (in kg) of 1 unit of this resource
const float m_mass;
// The mass (in kg) of one unit of this resource
const float m_massPerUnit;

// The density of this resource (kg/m^3)
const float m_density;
Expand All @@ -102,27 +102,27 @@ struct ShipResourceType
constexpr double resource_volume(uint64_t quantity) const
{
double units = static_cast<double>(quantity) / m_quantaPerUnit;
return units * m_volume;
return units * m_volumePerUnit;
}

// Compute the mass of the specified quantity of resource
constexpr double resource_mass(uint64_t quantity) const
{
double units = static_cast<double>(quantity) / m_quantaPerUnit;
return units * m_mass;
return units * m_massPerUnit;
}

// Compute the quantity of resource that fits in the specified volume
constexpr uint64_t resource_capacity(double volume) const
{
double units = volume / m_volume;
double units = volume / m_volumePerUnit;
return static_cast<uint64_t>(units * m_quantaPerUnit);
}

// Compute the quantity of resource that masses the specified amount
constexpr uint64_t resource_quantity(double mass) const
{
double units = mass / m_mass;
double units = mass / m_massPerUnit;
return static_cast<uint64_t>(units * m_quantaPerUnit);
}

Expand All @@ -131,8 +131,8 @@ struct ShipResourceType
: m_identifier(std::move(identifier))
, m_displayName(std::move(displayName))
, m_quantaPerUnit(quantaPerUnit)
, m_volume(volume)
, m_mass(mass)
, m_volumePerUnit(volume)
, m_massPerUnit(mass)
, m_density(density)
{
assert(osp::math::is_power_of_2(m_quantaPerUnit));
Expand Down

0 comments on commit 7b7efff

Please sign in to comment.