From 9ff3a4e0749884895f0167e952d29af011c7a8b2 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sun, 22 Apr 2018 22:49:59 -0300 Subject: [PATCH] Fix replay data loading --- src/HighScore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/HighScore.cpp b/src/HighScore.cpp index 3e37cbea06..e07f53ca66 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -1257,6 +1257,8 @@ class LunaHighScore: public Luna auto v = p->GetOffsetVector(); bool loaded = v.size() > 0; if (loaded || p->LoadReplayData()) { + if (!loaded) + v = p->GetOffsetVector(); for (size_t i = 0; i < v.size(); ++i) v[i] = v[i] * 1000; LuaHelpers::CreateTableFromArray(v, L); @@ -1269,10 +1271,12 @@ class LunaHighScore: public Luna } static int GetNoteRowVector(T* p, lua_State *L) { - auto& v = p->GetNoteRowVector(); - bool loaded = v.size() > 0; + auto* v = &(p->GetNoteRowVector()); + bool loaded = v->size() > 0; if (loaded || p->LoadReplayData()) { - LuaHelpers::CreateTableFromArray(v, L); + if (!loaded) + v = &(p->GetNoteRowVector()); + LuaHelpers::CreateTableFromArray((*v), L); if(!loaded) p->UnloadReplayData(); }