Go to the source code of this file.
Functions | |
| LevelScript * | getLevelScript (lua_State *L) |
| Level * | getLevel (lua_State *L) |
| int | script_level_save (lua_State *L) throw () |
| void level_save(serialized) | |
| int | script_level_load (lua_State *L) throw () |
| void level_load(moves) | |
| int | script_level_action_move (lua_State *L) throw () |
| bool level_action_move(symbol) | |
| int | script_level_action_save (lua_State *L) throw () |
| bool level_action_save() | |
| int | script_level_action_load (lua_State *L) throw () |
| bool level_action_load() | |
| int | script_level_action_restart (lua_State *L) throw () |
| bool level_action_restart() | |
| int | script_level_createRoom (lua_State *L) throw () |
| void level_createRoom(width, height, picture) Example: createRoom(40, 50, "kitchen-bg.png") | |
| int | script_level_getRestartCounter (lua_State *L) throw () |
| int level_getRestartCounter() | |
| int | script_level_getDepth (lua_State *L) throw () |
| int level_getDepth() | |
| int | script_level_isNewRound (lua_State *L) throw () |
| bool level_isNewRound() | |
| int | script_level_isSolved (lua_State *L) throw () |
| bool level_isSolved() | |
| int | script_level_newDemo (lua_State *L) throw () |
| void level_newDemo(demofile) | |
| int | script_level_planShow (lua_State *L) throw () |
| void level_planShow(func) | |
| int | script_level_isShowing (lua_State *L) throw () |
| bool level_isShowing() | |
|
|
Definition at line 29 of file level-script.cpp. 00030 {
00031 return getLevelScript(L)->level();
00032 }
|
|
|
Definition at line 23 of file level-script.cpp. 00024 {
00025 return dynamic_cast<LevelScript*>(script_getLeader(L));
00026 }
|
|
|
bool level_action_load()
Definition at line 104 of file level-script.cpp. 00105 {
00106 BEGIN_NOEXCEPTION;
00107 bool sucess = getLevel(L)->action_load();
00108 lua_pushboolean(L, sucess);
00109 END_NOEXCEPTION;
00110 //NOTE: return sucess
00111 return 1;
00112 }
|
|
|
bool level_action_move(symbol)
Definition at line 66 of file level-script.cpp. 00067 {
00068 BEGIN_NOEXCEPTION;
00069 size_t size;
00070 const char *symbol = luaL_checklstring(L, 1, &size);
00071 if (size != 1) {
00072 ExInfo error = ExInfo("bad symbol length")
00073 .addInfo("length", size)
00074 .addInfo("symbol", symbol);
00075 LOG_WARNING(error);
00076 luaL_error(L, error.what());
00077 }
00078
00079 bool sucess = getLevel(L)->action_move(symbol[0]);
00080 lua_pushboolean(L, sucess);
00081 END_NOEXCEPTION;
00082 //NOTE: return sucess
00083 return 1;
00084 }
|
|
|
bool level_action_restart()
Definition at line 118 of file level-script.cpp. 00119 {
00120 BEGIN_NOEXCEPTION;
00121 bool sucess = getLevel(L)->action_restart();
00122 lua_pushboolean(L, sucess);
00123 END_NOEXCEPTION;
00124 //NOTE: return sucess
00125 return 1;
00126 }
|
|
|
bool level_action_save()
Definition at line 90 of file level-script.cpp. 00091 {
00092 BEGIN_NOEXCEPTION;
00093 bool sucess = getLevel(L)->action_save();
00094 lua_pushboolean(L, sucess);
00095 END_NOEXCEPTION;
00096 //NOTE: return sucess
00097 return 1;
00098 }
|
|
|
void level_createRoom(width, height, picture) Example: createRoom(40, 50, "kitchen-bg.png")
Definition at line 136 of file level-script.cpp. 00137 {
00138 BEGIN_NOEXCEPTION;
00139 int w = luaL_checkint(L, 1);
00140 int h = luaL_checkint(L, 2);
00141 const char *picture = luaL_checkstring(L, 3);
00142
00143 getLevel(L)->createRoom(w, h, Path::dataReadPath(picture));
00144 END_NOEXCEPTION;
00145 return 0;
00146 }
|
|
|
int level_getDepth()
Definition at line 169 of file level-script.cpp. 00170 {
00171 BEGIN_NOEXCEPTION;
00172 int depth = getLevel(L)->getDepth();
00173 lua_pushnumber(L, depth);
00174 END_NOEXCEPTION;
00175 //NOTE: return depth
00176 return 1;
00177 }
|
|
|
int level_getRestartCounter() Returns number of attemps, starts from 1. Definition at line 154 of file level-script.cpp. 00155 {
00156 BEGIN_NOEXCEPTION;
00157 int counter = getLevel(L)->getRestartCounter();
00158 lua_pushnumber(L, counter);
00159 END_NOEXCEPTION;
00160 //NOTE: return counter
00161 return 1;
00162 }
|
|
|
bool level_isNewRound()
Definition at line 184 of file level-script.cpp. 00185 {
00186 BEGIN_NOEXCEPTION;
00187 bool newRound = getLevel(L)->isNewRound();
00188 lua_pushboolean(L, newRound);
00189 END_NOEXCEPTION;
00190 //NOTE: return newRound
00191 return 1;
00192 }
|
|
|
bool level_isShowing()
Definition at line 243 of file level-script.cpp. 00244 {
00245 BEGIN_NOEXCEPTION;
00246 bool showing = getLevel(L)->isShowing();
00247 lua_pushboolean(L, showing);
00248 END_NOEXCEPTION;
00249 //NOTE: return showing
00250 return 1;
00251 }
|
|
|
bool level_isSolved()
Definition at line 199 of file level-script.cpp. 00200 {
00201 BEGIN_NOEXCEPTION;
00202 bool solved = getLevelScript(L)->room()->isSolved();
00203 lua_pushboolean(L, solved);
00204 END_NOEXCEPTION;
00205 //NOTE: return solved
00206 return 1;
00207 }
|
|
|
void level_load(moves)
Definition at line 52 of file level-script.cpp. 00053 {
00054 BEGIN_NOEXCEPTION;
00055 const char *moves = luaL_checkstring(L, 1);
00056 getLevel(L)->loadGame(moves);
00057 END_NOEXCEPTION;
00058 return 0;
00059 }
|
|
|
void level_newDemo(demofile)
Definition at line 213 of file level-script.cpp. 00214 {
00215 BEGIN_NOEXCEPTION;
00216 const char *demofile = luaL_checkstring(L, 1);
00217
00218 getLevel(L)->newDemo(Path::dataReadPath(demofile));
00219 END_NOEXCEPTION;
00220 return 0;
00221 }
|
|
|
void level_planShow(func)
Definition at line 227 of file level-script.cpp. 00228 {
00229 BEGIN_NOEXCEPTION;
00230 luaL_checktype(L, 1, LUA_TFUNCTION);
00231 int funcRef = luaL_ref(L, LUA_REGISTRYINDEX);
00232
00233 Command *command = getLevelScript(L)->createCommand(funcRef);
00234 getLevel(L)->planShow(command);
00235 END_NOEXCEPTION;
00236 return 0;
00237 }
|
|
|
void level_save(serialized)
Definition at line 39 of file level-script.cpp. 00040 {
00041 BEGIN_NOEXCEPTION;
00042 const char *serialized = luaL_checkstring(L, 1);
00043 getLevel(L)->saveGame(serialized);
00044 END_NOEXCEPTION;
00045 return 0;
00046 }
|
1.4.2