CRasterFont: Remove ignored maybe_unused attributes

This commit is contained in:
Luke Street 2020-05-27 12:40:35 -04:00
parent 04597c2787
commit 330eeebf08
3 changed files with 29 additions and 28 deletions

View File

@ -4,38 +4,39 @@
namespace urde {
CStaticInterference::CStaticInterference(size_t sourceCount) { m_sources.reserve(sourceCount); }
CStaticInterference::CStaticInterference(size_t sourceCount) { x0_sources.reserve(sourceCount); }
void CStaticInterference::RemoveSource(TUniqueId id) {
const auto iter = std::find_if(m_sources.cbegin(), m_sources.cend(), [id](const auto& src) { return src.id == id; });
const auto iter =
std::find_if(x0_sources.cbegin(), x0_sources.cend(), [id](const auto& src) { return src.id == id; });
if (iter == m_sources.cend()) {
if (iter == x0_sources.cend()) {
return;
}
m_sources.erase(iter);
x0_sources.erase(iter);
}
void CStaticInterference::Update(CStateManager&, float dt) {
std::vector<CStaticInterferenceSource> newSources;
newSources.reserve(m_sources.size());
for (CStaticInterferenceSource& src : m_sources) {
if (src.timeLeft >= 0.f) {
src.timeLeft -= dt;
newSources.reserve(x0_sources.size());
for (CStaticInterferenceSource& src : x0_sources) {
if (src.x8_timeLeft >= 0.f) {
src.x8_timeLeft -= dt;
newSources.push_back(src);
}
}
m_sources = std::move(newSources);
x0_sources = std::move(newSources);
}
float CStaticInterference::GetTotalInterference() const {
float validAccum = 0.f;
float invalidAccum = 0.f;
for (const CStaticInterferenceSource& src : m_sources) {
if (src.id == kInvalidUniqueId)
invalidAccum += src.magnitude;
for (const CStaticInterferenceSource& src : x0_sources) {
if (src.x0_id == kInvalidUniqueId)
invalidAccum += src.x4_magnitude;
else
validAccum += src.magnitude;
validAccum += src.x4_magnitude;
}
if (validAccum > 0.80000001f)
validAccum = 0.80000001f;
@ -47,16 +48,16 @@ float CStaticInterference::GetTotalInterference() const {
void CStaticInterference::AddSource(TUniqueId id, float magnitude, float duration) {
magnitude = zeus::clamp(0.f, magnitude, 1.f);
const auto search = std::find_if(m_sources.begin(), m_sources.end(),
[id](const CStaticInterferenceSource& source) { return source.id == id; });
if (search != m_sources.cend()) {
search->magnitude = magnitude;
search->timeLeft = duration;
const auto search = std::find_if(x0_sources.begin(), x0_sources.end(),
[id](const CStaticInterferenceSource& source) { return source.x0_id == id; });
if (search != x0_sources.cend()) {
search->x4_magnitude = magnitude;
search->x8_timeLeft = duration;
return;
}
if (m_sources.size() < m_sources.capacity()) {
m_sources.push_back({id, magnitude, duration});
if (x0_sources.size() < x0_sources.capacity()) {
x0_sources.push_back({id, magnitude, duration});
}
}

View File

@ -7,13 +7,13 @@ namespace urde {
class CStateManager;
struct CStaticInterferenceSource {
TUniqueId id;
float magnitude;
float timeLeft;
TUniqueId x0_id;
float x4_magnitude;
float x8_timeLeft;
};
class CStaticInterference {
std::vector<CStaticInterferenceSource> m_sources;
std::vector<CStaticInterferenceSource> x0_sources;
public:
explicit CStaticInterference(size_t sourceCount);

View File

@ -81,10 +81,10 @@ public:
};
class CFontInfo {
[[maybe_unused]] bool x0_ = false;
[[maybe_unused]] bool x1_ = false;
[[maybe_unused]] s32 x4_ = 0;
[[maybe_unused]] s32 x8_fontSize = 0;
bool x0_ = false;
bool x1_ = false;
s32 x4_ = 0;
s32 x8_fontSize = 0;
char xc_name[64] = "";
public: