fix ugly label names on SBookkeeping

This commit is contained in:
Chris Danford
2005-06-14 18:36:01 +00:00
parent 2276b03c55
commit acb02d206d
4 changed files with 40 additions and 7 deletions
+27
View File
@@ -181,6 +181,33 @@ CString LastWeekToString( int iLastWeekIndex )
}
}
CString LastDayToDisplayString( int iLastDayIndex )
{
CString s = LastDayToString( iLastDayIndex );
s.Replace( "Day", "" );
s.Replace( "Ago", " Ago" );
return s;
}
CString LastWeekToDisplayString( int iLastWeekIndex )
{
CString s = LastWeekToString( iLastWeekIndex );
s.Replace( "Week", "" );
s.Replace( "Ago", " Ago" );
return s;
}
CString HourInDayToDisplayString( int iHourIndex )
{
int iBeginHour = iHourIndex;
iBeginHour--;
wrap( iBeginHour, 24 );
iBeginHour++;
return ssprintf("%02d:00+", iBeginHour );
}
tm AddDays( tm start, int iDaysToMove )
{
/*
+4
View File
@@ -17,6 +17,10 @@ CString HourInDayToString( int iHourIndex );
CString MonthToString( int iMonthIndex );
CString LastWeekToString( int iLastWeekIndex );
CString LastDayToDisplayString( int iLastDayIndex );
CString LastWeekToDisplayString( int iLastWeekIndex );
CString HourInDayToDisplayString( int iHourIndex );
tm AddDays( tm start, int iDaysToMove );
tm GetYesterday( tm start );
int GetDayOfWeek( tm time );
+8 -6
View File
@@ -55,9 +55,11 @@ ScreenBookkeeping::~ScreenBookkeeping()
LOG->Trace( "ScreenBookkeeping::~ScreenBookkeeping()" );
}
void ScreenBookkeeping::DrawPrimitives()
void ScreenBookkeeping::Update( float fDelta )
{
Screen::DrawPrimitives();
ChangeView( m_View ); // refresh so that counts change in real-time
ScreenWithMenuElements::Update( fDelta );
}
void ScreenBookkeeping::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
@@ -143,7 +145,7 @@ void ScreenBookkeeping::ChangeView( View newView )
CString sTitle, sData;
for( int i=0; i<NUM_LAST_DAYS; i++ )
{
sTitle += LastDayToString(i) + "\n";
sTitle += LastDayToDisplayString(i) + "\n";
sData += ssprintf("%d",coins[i]) + "\n";
iTotalLast += coins[i];
}
@@ -173,7 +175,7 @@ void ScreenBookkeeping::ChangeView( View newView )
for( int row=0; row<52/4; row++ )
{
int week = row*4+col;
sTemp += LastWeekToString(week) + ssprintf(": %d",coins[week]) + "\n";
sTemp += LastWeekToDisplayString(week) + ssprintf(": %d",coins[week]) + "\n";
}
m_textData[col].SetHorizAlign( Actor::align_left );
@@ -213,14 +215,14 @@ void ScreenBookkeeping::ChangeView( View newView )
CString sTitle1, sData1;
for( int i=0; i<HOURS_IN_DAY/2; i++ )
{
sTitle1 += HourInDayToString(i) + "\n";
sTitle1 += HourInDayToDisplayString(i) + "\n";
sData1 += ssprintf("%d",coins[i]) + "\n";
}
CString sTitle2, sData2;
for( int i=(HOURS_IN_DAY/2); i<HOURS_IN_DAY; i++ )
{
sTitle2 += HourInDayToString(i) + "\n";
sTitle2 += HourInDayToDisplayString(i) + "\n";
sData2 += ssprintf("%d",coins[i]) + "\n";
}
+1 -1
View File
@@ -18,7 +18,7 @@ public:
virtual void Init();
virtual ~ScreenBookkeeping();
virtual void DrawPrimitives();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM );