From 4c2a8e4cd7b5b496340e7fa26bb578de0e664309 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 29 Jul 2005 23:02:10 +0000 Subject: [PATCH] add CourseTypeToString add lua bindings --- stepmania/src/Course.cpp | 11 +++++++++++ stepmania/src/Course.h | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 6a4f2c7124..a515bc401c 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -24,6 +24,15 @@ #include +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::Register( L ); } }; diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index c4ba0e5a75..01a5b92fa2 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -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); }