[timing] Still struggling. Issues below.
Loader: can't instantiate TimingSegment due to abstract nature. Writer: thinks there is no definition with what is provided. Anyone want a crack at it?
This commit is contained in:
@@ -15,16 +15,16 @@ void NotesLoaderJson::GetApplicableFiles( const RString &sPath, vector<RString>
|
|||||||
GetDirListing( sPath + RString("*.json"), out );
|
GetDirListing( sPath + RString("*.json"), out );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Deserialize(TimingSegment *seg, const Json::Value &root)
|
static void Deserialize(TimingSegment &seg, const Json::Value &root)
|
||||||
{
|
{
|
||||||
seg->SetBeat((float)(root["Beat"].asDouble()));
|
(&seg)->SetBeat((float)(root["Beat"].asDouble()));
|
||||||
if (seg->GetType() == SEGMENT_BPM)
|
if ((&seg)->GetType() == SEGMENT_BPM)
|
||||||
{
|
{
|
||||||
static_cast<BPMSegment *>(seg)->SetBPM((float)(root["BPM"].asDouble()));
|
static_cast<BPMSegment *>(&seg)->SetBPM((float)(root["BPM"].asDouble()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static_cast<StopSegment *>(seg)->SetPause((float)(root["Seconds"].asDouble()));
|
static_cast<StopSegment *>(&seg)->SetPause((float)(root["Seconds"].asDouble()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,16 @@
|
|||||||
#include "NoteData.h"
|
#include "NoteData.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
|
|
||||||
static void Serialize(const TimingSegment *seg, Json::Value &root)
|
static void Serialize(const TimingSegment &seg, Json::Value &root)
|
||||||
{
|
{
|
||||||
root["Beat"] = seg->GetBeat();
|
root["Beat"] = (&seg)->GetBeat();
|
||||||
if (seg->GetType() == SEGMENT_BPM)
|
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
|
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