Skip to content

Commit

Permalink
load hasgoal status for existing goals and send said bool to lua
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 28, 2017
1 parent d366e66 commit e918b68
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/MusicWheelItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ void MusicWheelItem::RefreshGrades()
{
if(pWID->m_pSong->IsFavorited())
msg.SetParam( "Favorited", 1);
if (pWID->m_pSong->HasGoal())
msg.SetParam("HasGoal", 1);
msg.SetParam( "Grade", BestpHSL->HighGrade);
msg.SetParam( "Difficulty", DifficultyToString(dcBest));
msg.SetParam( "NumTimesPlayed", BestpHSL->GetNumTimesPlayed() );
Expand Down
6 changes: 6 additions & 0 deletions src/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ class Song

bool IsFavorited() { return isfavorited; }
void SetFavorited(bool b) { isfavorited = b; }
bool HasGoal () { return hasgoal; }
void SetHasGoal(bool b) { hasgoal = b; }
bool IsPermaMirror() { return permamirror; }
void SetPermaMirror(bool b) { permamirror = b; }

void SetEnabled( bool b ) { m_bEnabled = b; }
bool GetEnabled() const { return m_bEnabled; }
Expand Down Expand Up @@ -473,6 +477,8 @@ class Song

private:
bool isfavorited = false;
bool permamirror = false;
bool hasgoal = false;
bool m_loaded_from_autosave;
/** @brief the Steps that belong to this Song. */
vector<Steps*> m_vpSteps;
Expand Down
12 changes: 12 additions & 0 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,18 @@ void SongManager::SetFavoritedStatus(vector<RString>& favs) {
}
}

// hurr should probably redo both of these -mina
void SongManager::SetHasGoal(map<RString, vector<ScoreGoal>> goalmap) {
FOREACH(Song*, m_pSongs, song) {
FOREACH_CONST(Steps*, (*song)->GetAllSteps(), steps) {
RString sck = (*steps)->GetChartKey();
auto it = goalmap.find(sck);
if(it != goalmap.end())
(*song)->SetHasGoal(true);
}
}
}

RString SongManager::GetSongGroupBannerPath( const RString &sSongGroup ) const
{
for( unsigned i = 0; i < m_sSongGroupNames.size(); ++i )
Expand Down
2 changes: 2 additions & 0 deletions src/SongManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct lua_State;
#include "ThemeMetric.h"
#include "RageTexturePreloader.h"
#include "RageUtil.h"
#include "Profile.h"

RString SONG_GROUP_COLOR_NAME( size_t i );
RString COURSE_GROUP_COLOR_NAME( size_t i );
Expand Down Expand Up @@ -70,6 +71,7 @@ class SongManager

bool IsGroupNeverCached(const RString& group) const;
void SetFavoritedStatus(vector<RString>& favs);
void SetHasGoal(map<RString, vector<ScoreGoal>> goalmap);

RString GetSongGroupBannerPath( const RString &sSongGroup ) const;
//RString GetSongGroupBackgroundPath( RString sSongGroup ) const;
Expand Down

0 comments on commit e918b68

Please sign in to comment.