From 6681ad9dd4a6f8f603884993c3bf7c481f1384bb Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 27 Dec 2005 17:10:08 +0000 Subject: [PATCH] theme date/time strings --- stepmania/src/DateTime.cpp | 20 +++++++++----------- stepmania/src/DateTime.h | 9 +++++---- stepmania/src/DateTimeLua.cpp | 1 + 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/stepmania/src/DateTime.cpp b/stepmania/src/DateTime.cpp index 02bb058137..3429dec6fb 100644 --- a/stepmania/src/DateTime.cpp +++ b/stepmania/src/DateTime.cpp @@ -1,6 +1,8 @@ #include "global.h" #include "DateTime.h" #include "RageUtil.h" +#include "EnumHelper.h" +#include "ThemeMetric.h" DateTime::DateTime() @@ -177,7 +179,8 @@ CString HourInDayToString( int iHourInDayIndex ) return ssprintf("Hour%02d", iHourInDayIndex); } -static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] = +enum Month {}; +static const CString MonthNames[] = { "January", "February", @@ -192,13 +195,8 @@ static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] = "November", "December", }; - -CString MonthToString( int iMonthIndex ) -{ - if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) ) - return CString(); - return MONTH_TO_NAME[iMonthIndex]; -} +XToString( Month, MONTHS_IN_YEAR ); +XToThemedString( Month, MONTHS_IN_YEAR ); CString LastWeekToString( int iLastWeekIndex ) { @@ -210,7 +208,7 @@ CString LastWeekToString( int iLastWeekIndex ) } } -CString LastDayToDisplayString( int iLastDayIndex ) +CString LastDayToThemedString( int iLastDayIndex ) { CString s = LastDayToString( iLastDayIndex ); s.Replace( "Day", "" ); @@ -218,7 +216,7 @@ CString LastDayToDisplayString( int iLastDayIndex ) return s; } -CString LastWeekToDisplayString( int iLastWeekIndex ) +CString LastWeekToThemedString( int iLastWeekIndex ) { CString s = LastWeekToString( iLastWeekIndex ); s.Replace( "Week", "" ); @@ -226,7 +224,7 @@ CString LastWeekToDisplayString( int iLastWeekIndex ) return s; } -CString HourInDayToDisplayString( int iHourIndex ) +CString HourInDayToThemedString( int iHourIndex ) { int iBeginHour = iHourIndex; iBeginHour--; diff --git a/stepmania/src/DateTime.h b/stepmania/src/DateTime.h index 17ee6135cc..177873d354 100644 --- a/stepmania/src/DateTime.h +++ b/stepmania/src/DateTime.h @@ -12,14 +12,15 @@ const int MONTHS_IN_YEAR = 12; CString DayInYearToString( int iDayInYearIndex ); CString LastDayToString( int iLastDayIndex ); +CString LastDayToThemedString( int iLastDayIndex ); CString DayOfWeekToString( int iDayOfWeekIndex ); +CString DayOfWeekToThemedString( int iDayOfWeekIndex ); CString HourInDayToString( int iHourIndex ); +CString HourInDayToThemedString( int iHourIndex ); CString MonthToString( int iMonthIndex ); +CString MonthToThemedString( int iMonthIndex ); CString LastWeekToString( int iLastWeekIndex ); - -CString LastDayToDisplayString( int iLastDayIndex ); -CString LastWeekToDisplayString( int iLastWeekIndex ); -CString HourInDayToDisplayString( int iHourIndex ); +CString LastWeekToThemedString( int iLastWeekIndex ); tm AddDays( tm start, int iDaysToMove ); tm GetYesterday( tm start ); diff --git a/stepmania/src/DateTimeLua.cpp b/stepmania/src/DateTimeLua.cpp index 3786ee1fd9..64d5bb00fb 100644 --- a/stepmania/src/DateTimeLua.cpp +++ b/stepmania/src/DateTimeLua.cpp @@ -4,6 +4,7 @@ #include "RageUtil.h" LuaFunction( MonthToString, MonthToString( IArg(1) ) ); +LuaFunction( MonthToThemedString, MonthToThemedString( IArg(1) ) ); LuaFunction( MonthOfYear, GetLocalTime().tm_mon ); LuaFunction( DayOfMonth, GetLocalTime().tm_mday ); LuaFunction( Hour, GetLocalTime().tm_hour );