make d2x keys backward compatible
authorBradley Bell <btb@icculus.org>
Thu, 27 Mar 2003 03:21:20 +0000 (03:21 +0000)
committerBradley Bell <btb@icculus.org>
Thu, 27 Mar 2003 03:21:20 +0000 (03:21 +0000)
ChangeLog
main/playsave.c

index 9108770..3ac6c89 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-26  Bradley Bell  <btb@icculus.org>
+
+       * main/playsave.c: make d2x keys backward compatible
+
 2003-03-26  Micah J. Lieske  <MicahJon@compuserve.com>
 
        * arch/sdl/event.c, arch/sdl/joy.c: added hat support for sdl
index de6dc8f..261fe2a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: playsave.c,v 1.10 2003-03-27 01:25:41 btb Exp $ */
+/* $Id: playsave.c,v 1.11 2003-03-27 03:21:20 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -675,12 +675,6 @@ int read_player_file()
                        SecondaryOrder[i]=file_read_byte(file);
                 }
 
-               if (player_file_version >= 25)
-                       fread(kconfig_d2x_settings, MAX_D2X_CONTROLS, 1, file);
-               else
-                       for(i=0; i < MAX_D2X_CONTROLS; i++)
-                               kconfig_d2x_settings[i] = default_kconfig_d2x_settings[i];
-
                if (player_file_version>=16)
                 {
                  Cockpit_3d_view[0]=file_read_int(file);
@@ -766,6 +760,12 @@ int read_player_file()
        #endif
        }
 
+       if (player_file_version >= 25)
+               fread(kconfig_d2x_settings, MAX_D2X_CONTROLS, 1, file);
+       else
+               for(i=0; i < MAX_D2X_CONTROLS; i++)
+                       kconfig_d2x_settings[i] = default_kconfig_d2x_settings[i];
+
        if (fclose(file) && errno_ret==EZERO)
                errno_ret                       = errno;
 
@@ -939,8 +939,6 @@ int write_player_file()
         fwrite (&SecondaryOrder[i],sizeof(ubyte),1,file);
        }
 
-               fwrite(kconfig_d2x_settings, MAX_D2X_CONTROLS, 1, file);
-
                file_write_int (Cockpit_3d_view[0],file);
                file_write_int (Cockpit_3d_view[1],file);
 
@@ -970,6 +968,8 @@ int write_player_file()
                file_write_string(buf, file);           // Write out current joystick for player.
        }
 
+       fwrite(kconfig_d2x_settings, MAX_D2X_CONTROLS, 1, file);
+
        if (fclose(file))
                errno_ret                       = errno;