fix "PaneDisplay shows bogus values for edits"

This commit is contained in:
Chris Danford
2004-08-21 06:21:12 +00:00
parent 9c23f35047
commit 4f41bacd91
3 changed files with 145 additions and 137 deletions
+17 -12
View File
@@ -142,20 +142,23 @@ void PaneDisplay::Update( float fDeltaTime )
void PaneDisplay::SetContent( PaneContents c ) void PaneDisplay::SetContent( PaneContents c )
{ {
m_textContents[c].SetText( "" ); CString str = "?"; // fill this in
float val = 0; // fill this in
if( (g_Contents[c].req&NEED_NOTES) && !GAMESTATE->m_pCurSteps[m_PlayerNumber] )
return;
if( (g_Contents[c].req&NEED_COURSE) && !GAMESTATE->m_pCurTrail[m_PlayerNumber] )
return;
if( (g_Contents[c].req&NEED_PROFILE) && !PROFILEMAN->IsUsingProfile( m_PlayerNumber ) )
return;
const Song *pSong = GAMESTATE->m_pCurSong; const Song *pSong = GAMESTATE->m_pCurSong;
const Steps *pSteps = GAMESTATE->m_pCurSteps[m_PlayerNumber]; const Steps *pSteps = GAMESTATE->m_pCurSteps[m_PlayerNumber];
const Course *pCourse = GAMESTATE->m_pCurCourse; const Course *pCourse = GAMESTATE->m_pCurCourse;
const Trail *pTrail = GAMESTATE->m_pCurTrail[m_PlayerNumber]; const Trail *pTrail = GAMESTATE->m_pCurTrail[m_PlayerNumber];
const Profile *pProfile = PROFILEMAN->GetProfile( m_PlayerNumber );
if( (g_Contents[c].req&NEED_NOTES) && !pSteps )
goto done;
if( (g_Contents[c].req&NEED_COURSE) && !pTrail )
goto done;
if( (g_Contents[c].req&NEED_PROFILE) && !pProfile )
goto done;
{
RadarValues rv; RadarValues rv;
if( g_Contents[c].req&NEED_NOTES ) if( g_Contents[c].req&NEED_NOTES )
@@ -163,8 +166,6 @@ void PaneDisplay::SetContent( PaneContents c )
else if( g_Contents[c].req&NEED_COURSE ) else if( g_Contents[c].req&NEED_COURSE )
rv = pTrail->GetRadarValues(); rv = pTrail->GetRadarValues();
float val = 0;
CString str;
switch( c ) switch( c )
{ {
case COURSE_NUM_STEPS: case COURSE_NUM_STEPS:
@@ -242,6 +243,9 @@ void PaneDisplay::SetContent( PaneContents c )
break; break;
}; };
if( val == RADAR_VAL_UNKNOWN )
goto done;
/* Scale, round, clamp, etc. for floats: */ /* Scale, round, clamp, etc. for floats: */
switch( c ) switch( c )
{ {
@@ -292,13 +296,14 @@ void PaneDisplay::SetContent( PaneContents c )
case COURSE_PROFILE_RANK: case COURSE_PROFILE_RANK:
str = ssprintf( "%.0f", val ); str = ssprintf( "%.0f", val );
} }
}
int p;
done:
m_textContents[c].SetText( str ); m_textContents[c].SetText( str );
const int num = NUM_ITEM_COLORS( g_Contents[c].name ); const int num = NUM_ITEM_COLORS( g_Contents[c].name );
for( p = 0; p < num; ++p ) for( int p = 0; p < num; ++p )
{ {
const CString metric = ITEM_COLOR(g_Contents[c].name, p); const CString metric = ITEM_COLOR(g_Contents[c].name, p);
CStringArray spec; CStringArray spec;
+2 -1
View File
@@ -12,7 +12,8 @@ RadarValues::RadarValues()
void RadarValues::Init() void RadarValues::Init()
{ {
ZERO( *this ); FOREACH_RadarCategory( rc )
m_fValues[rc] = RADAR_VAL_UNKNOWN;
} }
XNode* RadarValues::CreateNode() const XNode* RadarValues::CreateNode() const
+2
View File
@@ -6,6 +6,8 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#define RADAR_VAL_UNKNOWN -1
struct XNode; struct XNode;
struct RadarValues struct RadarValues