From 38625e55d807c40922015c7d0c4e7cf31f423d29 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Thu, 18 Aug 2011 23:54:01 -0500 Subject: [PATCH] [Course] Add IsPlayableIn(StepsType) and IsRanking() Lua bindings. --- Docs/Changelog_sm5.txt | 1 + src/Course.cpp | 20 +++++++++++++------- src/Course.h | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index f7afc89455..670800140d 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -12,6 +12,7 @@ StepMania 5.0 Preview 3 | 2011081? ---------- * [RageInput] Added "No input devices were loaded." string to languages. [AJ] * [RageInputDevice] Added localized names for InputDeviceState. [AJ] +* [Course] Add IsPlayableIn(StepsType) and IsRanking() Lua bindings. [AJ] 2011/08/16 ---------- diff --git a/src/Course.cpp b/src/Course.cpp index d786c700af..ec6d67057b 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -86,8 +86,6 @@ int CourseEntry::GetNumModChanges() const } - - Course::Course(): m_bIsAutogen(false), m_sPath(""), m_sMainTitle(""), m_sMainTitleTranslit(""), m_sSubTitle(""), m_sSubTitleTranslit(""), m_sScripter(""), m_sDescription(""), m_sBannerPath(""), m_sBackgroundPath(""), @@ -1059,8 +1057,7 @@ public: LUA_REGISTER_CLASS( CourseEntry ) -// Not done with lua yet: still another class. - +// Now for the Course bindings: /** @brief Allow Lua to have access to the Course. */ class LunaCourse: public Luna { @@ -1109,11 +1106,18 @@ public: } DEFINE_METHOD( IsEndless, IsEndless() ) DEFINE_METHOD( IsNonstop, IsNonstop() ) - DEFINE_METHOD( IsOni, IsOni() ) - DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds ) + DEFINE_METHOD( IsOni, IsOni() ) + DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds ) static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner() ); return 1; } - static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground() ); return 1; } + static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground() ); return 1; } DEFINE_METHOD( IsAnEdit, IsAnEdit() ) + static int IsPlayableIn( T* p, lua_State *L ) + { + StepsType st = Enum::Check(L, 1); + lua_pushboolean(L, p->IsPlayableIn( st ) ); + return 1; + } + DEFINE_METHOD( IsRanking, IsRanking() ) LunaCourse() { @@ -1142,6 +1146,8 @@ public: ADD_METHOD( HasBanner ); ADD_METHOD( HasBackground ); ADD_METHOD( IsAnEdit ); + ADD_METHOD( IsPlayableIn ); + ADD_METHOD( IsRanking ); } }; diff --git a/src/Course.h b/src/Course.h index 031169a076..51bce172c2 100644 --- a/src/Course.h +++ b/src/Course.h @@ -190,7 +190,7 @@ public: { Trail trail; bool null; - + CacheData(): trail(), null(false) {} }; typedef map TrailCache_t;