@@ -2425,24 +2425,20 @@ vector<HighScore> Profile::GetScoresByKey(RString ck) {
2425
2425
return o;
2426
2426
}
2427
2427
2428
- float Profile::GetWifePBByKey (RString key ) {
2428
+ float Profile::GetWifePBByKey (RString ck, float rate ) {
2429
2429
float o = 0 .f ;
2430
+ auto it = HighScoresByChartKey.find (ck);
2431
+ if (it == HighScoresByChartKey.end ())
2432
+ return o;
2430
2433
2434
+ // why will this only compile using at -mina
2435
+ auto & hsrm = HighScoresByChartKey.at (ck);
2436
+ auto iit = hsrm.find (rate);
2437
+ if (iit == hsrm.end ())
2438
+ return o;
2431
2439
2432
-
2433
- FOREACHM_CONST (SongID, HighScoresForASong, m_SongHighScores, i) {
2434
- const SongID& id = i->first ;
2435
- const HighScoresForASong& hsfas = i->second ;
2436
- FOREACHM_CONST (StepsID, HighScoresForASteps, hsfas.m_StepsHighScores , j) {
2437
- const StepsID& sid = j->first ;
2438
- if (sid.GetKey () == key) {
2439
- FOREACH_CONST (HighScore, j->second .hsl .vHighScores , hs)
2440
- if (hs->GetWifeScore () > o && GAMESTATE->m_SongOptions .GetCurrent ().m_fMusicRate == hs->GetMusicRate ())
2441
- o = hs->GetWifeScore ();
2442
- }
2443
- }
2444
- }
2445
- return o;
2440
+ // this _should_ be valid as the vector _should_ be sorted already -mina
2441
+ return hsrm.at (rate).at (0 ).GetWifeScore ();
2446
2442
}
2447
2443
2448
2444
bool Profile::ChartkeyHasGoal (RString ck) {
@@ -3780,6 +3776,11 @@ class LunaProfile : public Luna<Profile>
3780
3776
return 1 ;
3781
3777
}
3782
3778
3779
+ static int GetPBWifeScoreByKey (T* p, lua_State *L) {
3780
+ lua_pushnumber (L, p->GetWifePBByKey (SArg (1 ), FArg (2 )));
3781
+ return 1 ;
3782
+ }
3783
+
3783
3784
LunaProfile ()
3784
3785
{
3785
3786
ADD_METHOD ( AddScreenshot );
@@ -3860,6 +3861,7 @@ class LunaProfile : public Luna<Profile>
3860
3861
ADD_METHOD ( GetTopSSRHighScore );
3861
3862
ADD_METHOD ( RecalcTopSSR );
3862
3863
ADD_METHOD ( GetPBHighScoreByKey );
3864
+ ADD_METHOD ( GetPBWifeScoreByKey );
3863
3865
ADD_METHOD ( ValidateAllScores );
3864
3866
ADD_METHOD ( GetGoalByKey );
3865
3867
ADD_METHOD ( RemoveGoalsByKey );
0 commit comments