[timing] Slightly (?) better (??) casting.
This commit is contained in:
@@ -17,14 +17,14 @@ void NotesLoaderJson::GetApplicableFiles( const RString &sPath, vector<RString>
|
||||
|
||||
static void Deserialize(TimingSegment &seg, const Json::Value &root)
|
||||
{
|
||||
(&seg)->SetBeat((float)(root["Beat"].asDouble()));
|
||||
if ((&seg)->GetType() == SEGMENT_BPM)
|
||||
seg.SetBeat((float)(root["Beat"].asDouble()));
|
||||
if (seg.GetType() == SEGMENT_BPM)
|
||||
{
|
||||
static_cast<BPMSegment *>(&seg)->SetBPM((float)(root["BPM"].asDouble()));
|
||||
static_cast<BPMSegment &>(seg).SetBPM((float)(root["BPM"].asDouble()));
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<StopSegment *>(&seg)->SetPause((float)(root["Seconds"].asDouble()));
|
||||
static_cast<StopSegment &>(seg).SetPause((float)(root["Seconds"].asDouble()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
static void Serialize(const TimingSegment &seg, Json::Value &root)
|
||||
{
|
||||
root["Beat"] = (&seg)->GetBeat();
|
||||
if ((&seg)->GetType() == SEGMENT_BPM)
|
||||
root["Beat"] = seg.GetBeat();
|
||||
if (seg.GetType() == SEGMENT_BPM)
|
||||
{
|
||||
root["BPM"] = static_cast<BPMSegment *>(const_cast<TimingSegment *>(&seg))->GetBPM();
|
||||
root["BPM"] = static_cast<BPMSegment &>(const_cast<TimingSegment &>(seg)).GetBPM();
|
||||
}
|
||||
else
|
||||
{
|
||||
root["Seconds"] = static_cast<StopSegment *>(const_cast<TimingSegment *>(&seg))->GetPause();
|
||||
root["Seconds"] = static_cast<StopSegment &>(const_cast<TimingSegment &>(seg)).GetPause();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user