[Scummvm-cvs-logs] CVS: residual lua.cpp,1.14,1.15

James Brown ender at users.sourceforge.net
Wed Aug 20 18:04:02 CEST 2003


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv8472

Modified Files:
	lua.cpp 
Log Message:
Change get_costume error to a warning, to let us get down to the garage. Me, or someone, needs to look into why knocking on the door down there freezes (Glottis never makes it out)


Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- lua.cpp	20 Aug 2003 16:01:58 -0000	1.14
+++ lua.cpp	20 Aug 2003 20:04:52 -0000	1.15
@@ -76,18 +76,18 @@
     lua_pushnil();
 }
 
-static Costume *get_costume(Actor *a, int param) {
+static Costume *get_costume(Actor *a, int param, char *called_from) {
   Costume *result;
   if (lua_isnil(lua_getparam(param))) {
     result = a->currentCostume();
     if (result == NULL)
-      error("Actor %s has no costume\n", a->name());
+      warning("Actor %s has no costume [%s]\n", a->name(), called_from);
   }
   else {
     result = a->findCostume(luaL_check_string(param));
     if (result == NULL)
-      error("Actor %s has no costume %s\n", a->name(),
-	    lua_getstring(lua_getparam(param)));
+      warning("Actor %s has no costume %s [%s]\n", a->name(),
+	    lua_getstring(lua_getparam(param)), called_from);
   }
   return result;
 }
@@ -238,8 +238,10 @@
   Actor *act = check_actor(1);
   int index = check_int(2);
   int chore = check_int(3);
-  Costume *costume = get_costume(act, 4);
+  Costume *costume = get_costume(act, 4, "setActorTalkChore");
 
+  if (!costume)
+    return;
   costume->setTalkChore(index, chore);
 }
 
@@ -358,14 +360,20 @@
 static void PlayActorChore() {
   Actor *act = check_actor(1);
   int num = check_int(2);
-  Costume *cost = get_costume(act, 3);
+  Costume *cost = get_costume(act, 3, "playActorChore");
+
+  if (!cost)
+    return;
   cost->playChore(num);
 }
 
 static void PlayActorChoreLooping() {
   Actor *act = check_actor(1);
   int num = check_int(2);
-  Costume *cost = get_costume(act, 3);
+  Costume *cost = get_costume(act, 3, "playActorChoreLooping");
+
+  if (!cost)
+    return;
   cost->playChoreLooping(num);
 }
 
@@ -373,13 +381,20 @@
   Actor *act = check_actor(1);
   int num = check_int(2);
   bool val = getbool(3);
-  Costume *cost = get_costume(act, 4);
+  Costume *cost = get_costume(act, 4, "setActorChoreLooping");
+
+  if (!cost)
+    return;
   cost->setChoreLooping(num, val);
 }
 
 static void StopActorChore() {
   Actor *act = check_actor(1);
-  Costume *cost = get_costume(act, 3);
+  Costume *cost = get_costume(act, 3, "stopActorChore");
+
+  if (!cost)
+    return;
+
   if (lua_isnil(lua_getparam(2)))
     cost->stopChores();
   else
@@ -389,8 +404,14 @@
 static void IsActorChoring() {
   Actor *act = check_actor(1);
   bool excludeLooping = getbool(3);
-  Costume *cost = get_costume(act, 4);
+  Costume *cost = get_costume(act, 4, "isActorChoring");
   int result;
+
+
+  if (!cost) {
+    lua_pushnil();
+    return;
+  }
   if (lua_isnil(lua_getparam(2)))
     result = cost->isChoring(excludeLooping);
   else





More information about the Scummvm-git-logs mailing list