mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 23:47:43 +00:00
CIntElement: Remove const_cast
CIESampleAndHold caches values internally for use later in a non-visible manner to the user of the class. This is a good place for mutable to be used. This improves the readability of the GetValue() implementation.
This commit is contained in:
@@ -189,12 +189,12 @@ bool CIESampleAndHold::GetValue(int frame, int& valOut) const {
|
||||
int b, c;
|
||||
xc_waitFramesMin->GetValue(frame, b);
|
||||
x10_waitFramesMax->GetValue(frame, c);
|
||||
/* const-correctness, who needs it? */
|
||||
const_cast<CIESampleAndHold*>(this)->x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame;
|
||||
x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame;
|
||||
x4_sampleSource->GetValue(frame, valOut);
|
||||
const_cast<CIESampleAndHold*>(this)->x14_holdVal = valOut;
|
||||
} else
|
||||
x14_holdVal = valOut;
|
||||
} else {
|
||||
valOut = x14_holdVal;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user