modified trigger reader
authorBradley Bell <btb@icculus.org>
Thu, 3 Apr 2003 07:15:43 +0000 (07:15 +0000)
committerBradley Bell <btb@icculus.org>
Thu, 3 Apr 2003 07:15:43 +0000 (07:15 +0000)
ChangeLog
main/cntrlcen.c
main/cntrlcen.h
main/gamesave.c

index d56d0b3..6f4f20e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-04-02  Bradley Bell  <btb@icculus.org>
 
+       * main/cntrlcen.c, main/cntrlcen.h, main/gamesave.c: modified
+       trigger reader
+
        * main/wall.c: don't die when trying to toggle nonexistent
        segment... vertigo level 10 is buggy!
 
index a2f1922..9ec060c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: cntrlcen.c,v 1.8 2003-03-01 01:51:15 btb Exp $ */
+/* $Id: cntrlcen.c,v 1.9 2003-04-03 07:15:43 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -17,7 +17,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: cntrlcen.c,v 1.8 2003-03-01 01:51:15 btb Exp $";
+static char rcsid[] = "$Id: cntrlcen.c,v 1.9 2003-04-03 07:15:43 btb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -530,14 +530,18 @@ extern int reactor_read_n(reactor *r, int n, CFILE *fp)
 /*
  * reads a control_center_triggers structure from a CFILE
  */
-extern void control_center_triggers_read(control_center_triggers *cct, CFILE *fp)
+extern int control_center_triggers_read_n(control_center_triggers *cct, int n, CFILE *fp)
 {
-       int i;
+       int i, j;
 
-       cct->num_links = cfile_read_short(fp);
-       for (i = 0; i < MAX_CONTROLCEN_LINKS; i++)
-               cct->seg[i] = cfile_read_short(fp);
-       for (i = 0; i < MAX_CONTROLCEN_LINKS; i++)
-               cct->side[i] = cfile_read_short(fp);
+       for (i = 0; i < n; i++)
+       {
+               cct->num_links = cfile_read_short(fp);
+               for (j = 0; j < MAX_CONTROLCEN_LINKS; j++)
+                       cct->seg[j] = cfile_read_short(fp);
+               for (j = 0; j < MAX_CONTROLCEN_LINKS; j++)
+                       cct->side[j] = cfile_read_short(fp);
+       }
+       return i;
 }
 #endif
index da22dd5..048ec10 100644 (file)
@@ -76,7 +76,7 @@ extern int Reactor_strength;
 
 #ifdef FAST_FILE_IO
 #define reactor_read_n(r, n, fp) cfread(r, sizeof(reactor), n, fp)
-#define control_center_triggers_read(cct, fp) cfread(cct, sizeof(control_center_triggers), 1, fp)
+#define control_center_triggers_read_n(cct, n, fp) cfread(cct, sizeof(control_center_triggers), n, fp)
 #else
 /*
  * reads n reactor structs from a CFILE
@@ -84,9 +84,9 @@ extern int Reactor_strength;
 extern int reactor_read_n(reactor *r, int n, CFILE *fp);
 
 /*
- * reads a control_center_triggers structure from a CFILE
+ * reads n control_center_triggers structs from a CFILE
  */
-extern void control_center_triggers_read(control_center_triggers *cct, CFILE *fp);
+extern int control_center_triggers_read_n(control_center_triggers *cct, int n, CFILE *fp);
 #endif
 
 #endif
index 520f85e..fd38692 100644 (file)
@@ -24,7 +24,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-char gamesave_rcsid[] = "$Id: gamesave.c,v 1.18 2003-02-28 03:54:55 btb Exp $";
+char gamesave_rcsid[] = "$Id: gamesave.c,v 1.19 2003-04-03 07:15:43 btb Exp $";
 #endif
 
 #include <stdio.h>
@@ -1137,9 +1137,10 @@ int load_game_data(CFILE *LoadFile)
        //================ READ CONTROL CENTER TRIGGER INFO ===============
 
        if (game_fileinfo.control_offset > -1)
-               if (!cfseek( LoadFile, game_fileinfo.control_offset,SEEK_SET )) {
-                       Assert(game_fileinfo.control_howmany == 1);
-                       control_center_triggers_read(&ControlCenterTriggers, LoadFile);
+               if (!cfseek(LoadFile, game_fileinfo.control_offset, SEEK_SET))
+               {
+                       Assert(game_fileinfo.control_sizeof == sizeof(control_center_triggers));
+                       control_center_triggers_read_n(&ControlCenterTriggers, game_fileinfo.control_howmany, LoadFile);
                }
 
        //================ READ MATERIALOGRIFIZATIONATORS INFO ===============