Skip to content

Commit

Permalink
Don't request ReplayData from network if we already have it
Browse files Browse the repository at this point in the history
to save EO some trouble with players using the replay feature more often now hopefully
  • Loading branch information
poco0317 committed Nov 16, 2019
1 parent 7d80865 commit 809c34b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Etterna/Singletons/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2683,9 +2683,30 @@ class LunaDownloadManager : public Luna<DownloadManager>
string username = hs->GetDisplayName();
string scoreid = hs->scoreid;
string ck = hs->GetChartKey();

bool alreadyHasReplay = false;
alreadyHasReplay |= !hs->GetNoteRowVector().empty();
alreadyHasReplay |=
!hs->GetCopyOfSetOnlineReplayTimestampVector().empty();
alreadyHasReplay |= !hs->GetOffsetVector().empty();

LuaReference f;
if (lua_isfunction(L, 2))
f = GetFuncArg(2, L);

if (alreadyHasReplay) {
if (!f.IsNil() && f.IsSet()) {
auto L = LUA->Get();
f.PushSelf(L);
RString Error =
"Error running RequestChartLeaderBoard Finish Function: ";
hs->PushSelf(L);
LuaHelpers::RunScriptOnStack(
L, Error, 2, 0, true); // 2 args, 0 results
}
return 0;
}

DLMAN->RequestReplayData(scoreid, userid, username, ck, f);
return 0;
}
Expand Down

0 comments on commit 809c34b

Please sign in to comment.