Skip to content

Commit

Permalink
add match results counter message
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jan 14, 2017
1 parent fcb31fc commit 43f9411
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ local f = Def.ActorFrame{
end
end,
},
LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+frameWidth/2,175 + spacingY * 3;zoom,textzoom;halign,0;settext,""),
FilterResultsMessageCommand=function(self, msg)
self:settext("Matches: "..msg.Matches.."/"..msg.Total)
end
},
}

local function CreateFilterInputBox(i)
Expand Down
12 changes: 10 additions & 2 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,11 +609,12 @@ void MusicWheel::FilterBySkillsets(vector<Song*>& inv) {
if (val > lb && val < ub) // if dealing with an explicit range evaluate as such
addsong = addsong || true;
}
else
else {
if (lb > 0.f && val > lb) // must be a nicer way to handle this but im tired
addsong = addsong || true;
if (ub > 0.f && val < ub)
addsong = addsong || true;
}
}
}

Expand All @@ -637,11 +638,12 @@ void MusicWheel::FilterBySkillsets(vector<Song*>& inv) {
if (val < lb || val > ub)
addsong = false;
}
else
else {
if (lb > 0.f && val < lb)
addsong = false;
if (ub > 0.f && val > ub)
addsong = false;
}
}
}
if (addsong)
Expand Down Expand Up @@ -702,12 +704,18 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
vector<Song*> arraySongs;
GetSongList( arraySongs, so );

Message msg("FilterResults");
msg.SetParam("Total", arraySongs.size());

if (searching)
FilterBySearch(arraySongs, findme);

if (GAMESTATE->AnyActiveFilter())
FilterBySkillsets(arraySongs);

msg.SetParam("Matches", arraySongs.size());
MESSAGEMAN->Broadcast(msg);

bool bUseSections = true;

// sort the songs
Expand Down

0 comments on commit 43f9411

Please sign in to comment.