Skip to content

Commit

Permalink
Fix replay data loading
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Apr 23, 2018
1 parent 16448db commit 9ff3a4e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,8 @@ class LunaHighScore: public Luna<HighScore>
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);
Expand All @@ -1269,10 +1271,12 @@ class LunaHighScore: public Luna<HighScore>
}

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();
}
Expand Down

0 comments on commit 9ff3a4e

Please sign in to comment.