add CourseTypeToString

add lua bindings
This commit is contained in:
Chris Danford
2005-07-29 23:02:10 +00:00
parent e4cce264ad
commit 4c2a8e4cd7
2 changed files with 15 additions and 2 deletions
+11
View File
@@ -24,6 +24,15 @@
#include <limits.h>
static const CString CourseTypeNames[] = {
"Nonstop",
"Oni",
"Endless",
"Survival",
};
XToString( CourseType, NUM_CourseType );
XToThemedString( CourseType, NUM_CourseType );
static const CString SongSortNames[] = {
"Randomize",
"MostPlays",
@@ -1351,12 +1360,14 @@ public:
static int GetPlayMode( T* p, lua_State *L ) { lua_pushnumber(L, p->GetPlayMode() ); return 1; }
static int GetDisplayFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayFullTitle() ); return 1; }
static int GetTranslitFullTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetTranslitFullTitle() ); return 1; }
static int HasMods( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMods() ); return 1; }
static void Register(lua_State *L)
{
ADD_METHOD( GetPlayMode )
ADD_METHOD( GetDisplayFullTitle )
ADD_METHOD( GetTranslitFullTitle )
ADD_METHOD( HasMods )
Luna<T>::Register( L );
}
};
+4 -2
View File
@@ -26,9 +26,11 @@ enum CourseType
COURSE_TYPE_ONI, // if life meter type is BATTERY
COURSE_TYPE_ENDLESS, // if set to REPEAT
COURSE_TYPE_SURVIVAL, // if life meter type is TIME
NUM_COURSE_TYPES
NUM_CourseType
};
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_COURSE_TYPES, i )
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_CourseType, i )
const CString& CourseTypeToString( CourseType i );
const CString& CourseTypeToThemedString( CourseType i );
inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); }
inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); }