Update of /cvsroot/netrek/client/netrekxp/include
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31222/include

Modified Files:
	data.h proto.h struct.h 
Log Message:
First pass at creating a dynamic rather than static shiplist.  Struct shiplist is a linked list of ships that contains all the ship info (fuel, hull, etc).  This shiplist is updated by shipcap packet.  Replaced old static shipvals struct.  Struct ship now has entries for keymaps and buttonmaps - this info has been moved out of the stats struct.  This eliminates the need for struct shipdef, which was just a static struct that held ship name and keymap/buttonmap strings.  Much of the keymap/buttonmap handling had to be redone, as well as initialization of ships and keymaps.
Still some bugs to work out, keymaps are not working right.
Going to remove the invidivual rcfile for each ship - this feature isn't very useful, as you can already define ship specific keymaps and buttonmaps in a single rc file.
This patch removed the last ifdef PARADISE so that config value is now set to defined for posterity purposes, but it doesn't do anything.

Index: data.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/data.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- data.h	16 Apr 2008 02:57:07 -0000	1.98
+++ data.h	18 Apr 2008 03:42:36 -0000	1.99
@@ -41,6 +41,7 @@
 extern struct thingy *thingies;
 extern struct t_unit *terrainInfo;
 extern struct ship *myship;
+extern struct shiplist *shiptypes;
 extern struct stats *mystats;
 extern struct planet *planets;
 extern struct phaser *phasers;
@@ -70,7 +71,13 @@
 extern int udcounter;
 extern char *title;
 extern struct plupdate pl_update[];
-extern char buttonmap[];
+#ifdef MOUSE_AS_SHIFT
+extern unsigned char default_keymap[672];
+#else
+extern unsigned char default_keymap[96];
+#endif
+extern unsigned char default_buttonmap[23];
+extern int currentship;
 extern int messpend;
 #ifdef XTRA_MESSAGE_UI
 extern int messageHUD;          /* Show message being typed on the local display */

Index: struct.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- struct.h	16 Apr 2008 02:57:08 -0000	1.26
+++ struct.h	18 Apr 2008 03:42:36 -0000	1.27
@@ -237,22 +237,18 @@
 #define PARADISE_SHIP_OFFSET 7	/* To make jumpship first entry in the paradise ship bitmap array */
 #define NUM_TYPES_PARADISE 15	/* Typical total number of ships on a paradise server */
 #define NUM_TYPES_BRONCO 8	/* Concrete total number of ships on a bronco server */
-#ifdef PARADISE
-#define ATT 6
-#define JUMPSHIP 7
-#define SGALAXY 8	/* Not sure where to put this .. */
-#else
-#define SGALAXY	6
-#define ATT	7
-#define JUMPSHIP 8
-#endif
+
+#define DEFAULT -1
 #define SCOUT 0
 #define DESTROYER 1
 #define CRUISER 2
 #define BATTLESHIP 3
 #define ASSAULT 4
 #define STARBASE 5
-#define FLAGSHIP 8	/* shares bitmap with galaxy class */
+#define ATT 6		/* paradise */
+#define SGALAXY 6	/* bronco */
+#define JUMPSHIP 7	/* can be ATT on bronco */
+#define FLAGSHIP 8
 #define WARBASE 9
 #define LIGHTCRUISER 10
 #define CARRIER 11
@@ -260,6 +256,11 @@
 #define PATROL 13
 #define PUCK 14
 
+struct shiplist {
+    struct ship *ship;
+    struct shiplist *prev, *next;
+};
+
 struct ship
 {
     short s_phaserdamage;
@@ -281,6 +282,13 @@
     /* char s_name[16]; */
     char s_desig[2];
     short s_bitmap;
+#ifdef MOUSE_AS_SHIFT
+    unsigned char s_keymap[672];       /* keymap for this ship */
+#else
+    unsigned char s_keymap[96];        /* keymap for this ship */
+#endif
+    unsigned char s_buttonmap[23];     /* buttonmap for this ship */
+    char *rcfile;                      /* pointer to ship specific rcfile */
 };
 
 struct stats
@@ -305,12 +313,6 @@
     LONG st_lastlogin;          /* Last time this player was
                                  * played */
     int st_flags;               /* Misc option flags */
-
-#ifdef MOUSE_AS_SHIFT
-    unsigned char st_keymap[672];       /* keymap for this player */
-#else
-    unsigned char st_keymap[96];        /* keymap for this player */
-#endif
     int st_rank;                /* Ranking of the player */
 };
 
@@ -837,15 +839,6 @@
 
 #endif /* HOCKEY_LINES */
 
-struct shipdef
-{
-    char *name;
-    char *rcfile;
-    unsigned char *keymap;
-    unsigned char *buttonmap;
-    unsigned char *ckeymap;
-};
-
 #ifdef TOOLS
 struct key_list
 {

Index: proto.h
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- proto.h	16 Apr 2008 00:08:02 -0000	1.61
+++ proto.h	18 Apr 2008 03:42:36 -0000	1.62
@@ -219,9 +219,9 @@
 /******************************************************************************/
 /***  getship.c
 /******************************************************************************/
-void getshipdefaults ();
-void getship (struct ship *shipp,
-              int s_type);
+void initialize_shiptypes();
+void getshipdefaults (struct ship *shipp, int s_type);
+struct ship * getship (int s_type);
 
 /******************************************************************************/
 /***  helpwin.c
@@ -255,6 +255,10 @@
 unsigned char getctrlkey (unsigned char **s);
 unsigned char getkeyfromctrl (unsigned char c);
 void initkeymap (void);
+void buildShipKeymap (struct ship *shipp);
+void keymapAdd (char *str, char *kmap);
+void ckeymapAdd (char *cstr, char *kmap);
+void buttonmapAdd (char *str, char *bmap);
 void initinput (void);
 RETSIGTYPE detsetallow (int _dummy);
 void input ();