[Scummvm-git-logs] scummvm master -> e35989324b5650b9d9fa19c64e07c9fc95716825

aquadran noreply at scummvm.org
Wed Jan 5 08:00:53 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e35989324b GRIM: Allow pass nil param to findscript func for all games


Commit: e35989324b5650b9d9fa19c64e07c9fc95716825
    https://github.com/scummvm/scummvm/commit/e35989324b5650b9d9fa19c64e07c9fc95716825
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-01-05T09:00:46+01:00

Commit Message:
GRIM: Allow pass nil param to findscript func for all games

Changed paths:
    engines/grim/lua/ltask.cpp


diff --git a/engines/grim/lua/ltask.cpp b/engines/grim/lua/ltask.cpp
index 4d0ca7cd28f..90c018af461 100644
--- a/engines/grim/lua/ltask.cpp
+++ b/engines/grim/lua/ltask.cpp
@@ -173,16 +173,15 @@ void find_script() {
 	lua_Object paramObj = lua_getparam(1);
 	lua_Type type = paramObj == LUA_NOOBJECT ? LUA_T_NIL : ttype(Address(paramObj));
 
-	if (paramObj == LUA_NOOBJECT || (type != LUA_T_CPROTO && type != LUA_T_PROTO && type != LUA_T_TASK)) {
-		if (g_grim->getGameType() == GType_GRIM) {
-			lua_error("Bad argument to find_script");
-		} else {
-			ttype(lua_state->stack.top) = LUA_T_TASK;
-			nvalue(lua_state->stack.top) = lua_state->id;
-			incr_top;
-			lua_pushnumber(1.0f);
-			return;
-		}
+	if (type != LUA_T_CPROTO && type != LUA_T_PROTO && type != LUA_T_TASK && type != LUA_T_NIL)
+		lua_error("Bad argument to find_script");
+
+	if (type == LUA_T_NIL) {
+		ttype(lua_state->stack.top) = LUA_T_TASK;
+		nvalue(lua_state->stack.top) = lua_state->id;
+		incr_top;
+		lua_pushnumber(1.0f);
+		return;
 	}
 
 	if (type == LUA_T_TASK) {
@@ -344,7 +343,7 @@ void runtasks(LState *const rootState) {
 		LState *nextState = nullptr;
 		bool stillRunning;
 		if (!lua_state->all_paused && !lua_state->updated && !lua_state->paused) {
-			jmp_buf	errorJmp;
+			jmp_buf errorJmp;
 			lua_state->errorJmp = &errorJmp;
 			if (setjmp(errorJmp)) {
 				lua_Task *t, *m;




More information about the Scummvm-git-logs mailing list