Skip to content

Commit 809c34b

Browse files
committed
Don't request ReplayData from network if we already have it
to save EO some trouble with players using the replay feature more often now hopefully
1 parent 7d80865 commit 809c34b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Etterna/Singletons/DownloadManager.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -2683,9 +2683,30 @@ class LunaDownloadManager : public Luna<DownloadManager>
26832683
string username = hs->GetDisplayName();
26842684
string scoreid = hs->scoreid;
26852685
string ck = hs->GetChartKey();
2686+
2687+
bool alreadyHasReplay = false;
2688+
alreadyHasReplay |= !hs->GetNoteRowVector().empty();
2689+
alreadyHasReplay |=
2690+
!hs->GetCopyOfSetOnlineReplayTimestampVector().empty();
2691+
alreadyHasReplay |= !hs->GetOffsetVector().empty();
2692+
26862693
LuaReference f;
26872694
if (lua_isfunction(L, 2))
26882695
f = GetFuncArg(2, L);
2696+
2697+
if (alreadyHasReplay) {
2698+
if (!f.IsNil() && f.IsSet()) {
2699+
auto L = LUA->Get();
2700+
f.PushSelf(L);
2701+
RString Error =
2702+
"Error running RequestChartLeaderBoard Finish Function: ";
2703+
hs->PushSelf(L);
2704+
LuaHelpers::RunScriptOnStack(
2705+
L, Error, 2, 0, true); // 2 args, 0 results
2706+
}
2707+
return 0;
2708+
}
2709+
26892710
DLMAN->RequestReplayData(scoreid, userid, username, ck, f);
26902711
return 0;
26912712
}

0 commit comments

Comments
 (0)