[Scummvm-cvs-logs] CVS: residual lua.cpp,1.5,1.6 scene.h,1.3,1.4

James Brown ender at users.sourceforge.net
Sun Aug 17 01:31:02 CEST 2003


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

Modified Files:
	lua.cpp scene.h 
Log Message:
!(Coding && Hangover)


Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- lua.cpp	17 Aug 2003 08:11:59 -0000	1.5
+++ lua.cpp	17 Aug 2003 08:30:18 -0000	1.6
@@ -460,8 +460,7 @@
   const char *name = luaL_check_string(2);
   int i, numSectors = Engine::instance()->currScene()->getSectorCount();
 
-  warning("IsActorInSector(%s, %s): STUB", act->name(), name);
-  printf("Looping over %d sectors\n", numSectors);
+  warning("IsActorInSector(%s, %s): SEMI-STUB", act->name(), name);
   for (i=0; i<numSectors; i++) {
    const char *sector_name = Engine::instance()->currScene()->getSectorName(i);
    if (sector_name && strstr(sector_name, name)) {

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- scene.h	17 Aug 2003 08:11:59 -0000	1.3
+++ scene.h	17 Aug 2003 08:30:18 -0000	1.4
@@ -53,22 +53,13 @@
   int setup() const { return currSetup_ - setups_; }
 
   // Sector access functions
+  #define validSector(id) ((numSectors_ >= 0) && (id < numSectors_))
   int getSectorCount() { return numSectors_; }
   const char *getSectorName(int id) const {
-   // FIXME: Will someone explain to me why my machine thinks 0 > 11?!?
-   if (id > numSectors_) {
-    return sectors_[id].name_.c_str();
-   } else {
-     printf("Sector %d > %d\n", id, numSectors_);
-     return NULL;
-   }
-  }
-  int getSectorType(int id) {
-    if (id > numSectors_) return sectors_[id].type_; else return -1; 
-  }
-  int getSectorID(int id) { 
-    if (id > numSectors_) return sectors_[id].id_; else return -1;
+   if (validSector(id)) return sectors_[id].name_.c_str(); else return NULL;
   }
+  int getSectorType(int id) { if (validSector(id)) return sectors_[id].type_; else return -1; }
+  int getSectorID(int id) { if (validSector(id)) return sectors_[id].id_; else return -1; }
   bool isPointInSector(int id, Vector3d point) { return false; } // FIXME: Need pointInPoly func
 
 private:





More information about the Scummvm-git-logs mailing list