Add a PlayerNumber. If pn = PLAYER_INVALID, then count all tap notes, irrespective of player. If tn.pn = PLAYER_INVALID, count it.

This commit is contained in:
Steve Checkoway
2006-07-14 04:14:51 +00:00
parent 753d33e752
commit af1652ef28
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -129,7 +129,7 @@ int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex =
/* Return the last tap score of a row: the grade of the tap that completed /* Return the last tap score of a row: the grade of the tap that completed
* the row. If the row has no tap notes, return -1. If any tap notes aren't * the row. If the row has no tap notes, return -1. If any tap notes aren't
* graded (any tap is TNS_None) or are missed (TNS_Miss), return it. */ * graded (any tap is TNS_None) or are missed (TNS_Miss), return it. */
int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow ) int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )
{ {
float scoretime = -9999; float scoretime = -9999;
int best_track = -1; int best_track = -1;
@@ -139,6 +139,8 @@ int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow )
const TapNote &tn = in.GetTapNote( t, iRow ); const TapNote &tn = in.GetTapNote( t, iRow );
if( tn.type == TapNote::empty || tn.type == TapNote::mine ) if( tn.type == TapNote::empty || tn.type == TapNote::mine )
continue; continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn && pn != PLAYER_INVALID )
continue;
TapNoteScore tns = tn.result.tns; TapNoteScore tns = tn.result.tns;
@@ -157,9 +159,9 @@ int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow )
} }
const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow ) const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn )
{ {
int iTrack = LastTapNoteScoreTrack( in, iRow ); int iTrack = LastTapNoteScoreTrack( in, iRow, pn );
if( iTrack == -1 ) if( iTrack == -1 )
return TAP_EMPTY; return TAP_EMPTY;
return in.GetTapNote( iTrack, iRow ); return in.GetTapNote( iTrack, iRow );
+2 -1
View File
@@ -4,6 +4,7 @@
#define NOTEDATAWITHSCORING_H #define NOTEDATAWITHSCORING_H
#include "NoteTypes.h" #include "NoteTypes.h"
#include "PlayerNumber.h"
struct RadarValues; struct RadarValues;
class NoteData; class NoteData;
@@ -12,7 +13,7 @@ namespace NoteDataWithScoring
{ {
bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow ); bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow );
TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow ); TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow );
const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow ); const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn = PLAYER_INVALID );
void GetActualRadarValues( const NoteData &in, const PlayerStageStats &pss, float fSongSeconds, RadarValues& out ); void GetActualRadarValues( const NoteData &in, const PlayerStageStats &pss, float fSongSeconds, RadarValues& out );
}; };