From bcec471213ae8d9f3554c131e71cb95f957c4619 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Fri, 15 Jul 2011 18:39:41 -0400 Subject: [PATCH] [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? --- src/NotesLoaderJson.cpp | 10 +++++----- src/NotesWriterJson.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/NotesLoaderJson.cpp b/src/NotesLoaderJson.cpp index 4ebf450c59..3727b7a53c 100644 --- a/src/NotesLoaderJson.cpp +++ b/src/NotesLoaderJson.cpp @@ -15,16 +15,16 @@ void NotesLoaderJson::GetApplicableFiles( const RString &sPath, vector 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())); - if (seg->GetType() == SEGMENT_BPM) + (&seg)->SetBeat((float)(root["Beat"].asDouble())); + if ((&seg)->GetType() == SEGMENT_BPM) { - static_cast(seg)->SetBPM((float)(root["BPM"].asDouble())); + static_cast(&seg)->SetBPM((float)(root["BPM"].asDouble())); } else { - static_cast(seg)->SetPause((float)(root["Seconds"].asDouble())); + static_cast(&seg)->SetPause((float)(root["Seconds"].asDouble())); } } diff --git a/src/NotesWriterJson.cpp b/src/NotesWriterJson.cpp index f4ef393da6..26cc3a28b3 100644 --- a/src/NotesWriterJson.cpp +++ b/src/NotesWriterJson.cpp @@ -9,16 +9,16 @@ #include "NoteData.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(); - if (seg->GetType() == SEGMENT_BPM) + root["Beat"] = (&seg)->GetBeat(); + if ((&seg)->GetType() == SEGMENT_BPM) { - root["BPM"] = static_cast(const_cast(seg))->GetBPM(); + root["BPM"] = static_cast(const_cast(&seg))->GetBPM(); } else { - root["Seconds"] = static_cast(const_cast(seg))->GetPause(); + root["Seconds"] = static_cast(const_cast(&seg))->GetPause(); } }