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

Modified Files:
	cowmain.c dashboard.c data.c defaults.c getname.c getship.c 
	helpwin.c input.c newwin.c option.c playback.c redraw.c 
	socket.c 
Log Message:
Second round of the ship and keymap changes, this one focused on fixing the things the last patch broke.
Removed shipchange(function)
Defined ATT_BRONCO since it's defined statically on bronco as type 7 but as type 6 on paradise.  Was necessary to get ATT working right on both.
Removed option for ship specific netrekrc file (rcfile-<ship>).  Still can use ship specific keymaps and buttonmaps.
Refit string (displayed by client in message window upon entering refit state) now works on paradise servers to provide the correct list of available ships.
Fixed keymap bug in getname and playback - was incorrectly using ship keymap instead of default keymap.
Added call to buildShipKeymap() in getshipdefaults(), which is in turn called during ship initialization by initialize_shiptypes().  This will set up the individual ship keymaps and buttonmaps at client startup.
Fixed help window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well.
Fixed buildShipKeymap() function so it properly resets the ship's individual keymap before trying to parse the keymap from the netrekrc file.  Same with buttonmap.
Fixed broken logic in the team select screen.  Spacebar and clicking on a team window now both work properly again.
Fixed options window key remapping to effect not only current ship, but the default keymap and every individual ship keymap as well.  Same with buttonmap.  Also reduced the amount of duplicate code considerably by calling the keymapAdd and buttonmapAdd functions instead of trying to reprocess the strings inline.
Fixed incorrect comment on how SP_SHIP_CAP is sent by bronco vs paradise.
Redid handleShipCap() so it works the way it is supposed to.  It obeys the operation value in the ship cap packet.  And adds news ships or modifies ships correctly.

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- redraw.c	16 Apr 2008 00:08:20 -0000	1.15
+++ redraw.c	19 Apr 2008 16:23:00 -0000	1.16
@@ -220,7 +220,7 @@
     else
         buf[16] = ' ';
     buf[17] = ' ';
-    if (me->p_ship.s_type != ATT)
+    if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
     {
         buf[18] = (char) ('0' + (me->p_damage / 100));
         if (buf[18] == '0')
@@ -239,7 +239,7 @@
         buf[20] = 'k';
     }
     buf[21] = ' ';
-    if (me->p_ship.s_type != ATT)
+    if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
     {
         buf[22] = (char) ('0' + (me->p_shield / 100));
         if (buf[22] == '0')
@@ -445,7 +445,7 @@
     sprintf (buf,
              "Flags        Warp Dam Shd Torps  Kills Armies   Fuel  Wtemp Etemp  Time");
     W_WriteText (tstatw, 50, 5, textColor, buf, strlen (buf), W_RegularFont);
-    if (me->p_ship.s_type != ATT)
+    if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
         sprintf (buf,
                 "Maximum:   %2d/%2d  %3d %3d              %2d/%2d  %6d   %3d   %3d",
                  maxspeed, me->p_ship.s_maxspeed,

Index: getship.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- getship.c	18 Apr 2008 03:42:37 -0000	1.7
+++ getship.c	19 Apr 2008 16:22:59 -0000	1.8
@@ -262,7 +262,7 @@
       shipp->s_bitmap = SGALAXY;
     }
     break;
-  case JUMPSHIP:                     /* or ATT */
+  case JUMPSHIP:                     /* or ATT_BRONCO */
     if (paradise) {
       shipp->s_phaserdamage = 25;
       shipp->s_torpspeed = 18;
@@ -295,13 +295,13 @@
       shipp->s_maxegntemp = 10000; /* att: */
       shipp->s_width = 20; /* att: */
       shipp->s_height = 20;        /* att: */
-      shipp->s_type = ATT; /* att: */
+      shipp->s_type = ATT_BRONCO; /* att: */
       shipp->s_phaserfuse = 2; /* att: */
       shipp->s_repair = 30000; /* att: */
-      shipp->s_letter = 'X';
+      shipp->s_letter = '*';
       shipp->s_desig[0] = 'A';
       shipp->s_desig[1] = 'T';
-      shipp->s_bitmap = ATT;
+      shipp->s_bitmap = ATT_BRONCO;
     }
     break;
   case FLAGSHIP:
@@ -425,4 +425,5 @@
     shipp->s_bitmap = PATROL;
     break;
   }
+  buildShipKeymap(shipp);
 }

Index: dashboard.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dashboard.c	16 Apr 2008 00:08:07 -0000	1.26
+++ dashboard.c	19 Apr 2008 16:22:58 -0000	1.27
@@ -763,7 +763,7 @@
             color = W_Yellow;
         else
             color = W_Green;
-        if (me->p_ship.s_type == ATT)
+        if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO))
             db_bar ("Sh", 15 * W_Textwidth, 3 + W_Textheight + SPACING,
                     me->p_shield, me->p_ship.s_maxshield, me->p_ship.s_maxshield,
                     DB_5DIGITS, color);
@@ -785,7 +785,7 @@
             color = W_Yellow;
         else
             color = W_Green;
-        if (me->p_ship.s_type == ATT)
+        if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO))
             db_bar ("Hu", 15 * W_Textwidth, 3 + 2 * (W_Textheight + SPACING),
                     (me->p_ship.s_maxdamage - me->p_damage),
                     me->p_ship.s_maxdamage, me->p_ship.s_maxdamage, DB_5DIGITS,
@@ -833,7 +833,7 @@
             color = W_Yellow;
         else
             color = W_Red;
-        if (me->p_ship.s_type != ATT)
+        if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
             db_bar ("Wt", 109 * W_Textwidth / 3, 3 + W_Textheight + SPACING,
                     me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
                     me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
@@ -849,7 +849,7 @@
             color = W_Yellow;
         else
             color = W_Red;
-        if (me->p_ship.s_type != ATT)
+        if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
             db_bar ("Et", 109 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING),
                     me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
                     me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);
@@ -938,7 +938,7 @@
             color = W_Yellow;
         else
             color = W_White;
-        if (me->p_ship.s_type == ATT)
+        if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO))
             db_bar ("Sh", 15 * W_Textwidth, 3 + W_Textheight + SPACING,
                     me->p_ship.s_maxshield - me->p_shield, me->p_ship.s_maxshield,
                     me->p_ship.s_maxshield, DB_5DIGITS, color);
@@ -958,7 +958,7 @@
             color = W_Red;
         else
             color = W_Yellow;
-        if (me->p_ship.s_type == ATT)
+        if ((paradise && me->p_ship.s_type == ATT) || (!paradise && me->p_ship.s_type == ATT_BRONCO))
             db_bar ("Da", 15 * W_Textwidth, 3 + 2 * (W_Textheight + SPACING),
                     me->p_damage, me->p_ship.s_maxdamage, me->p_ship.s_maxdamage,
                     DB_5DIGITS, color);
@@ -1005,7 +1005,7 @@
             color = W_White;
         else
             color = W_Yellow;
-        if (me->p_ship.s_type != ATT)
+        if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
             db_bar ("Wt", 109 * W_Textwidth / 3, 3 + W_Textheight + SPACING,
                     me->p_wtemp / 10, me->p_ship.s_maxwpntemp / 10,
                     me->p_ship.s_maxwpntemp / 10, DB_3DIGITS, color);
@@ -1022,7 +1022,7 @@
             color = W_Yellow;
         else
             color = W_Red;
-        if (me->p_ship.s_type != ATT)
+        if ((paradise && me->p_ship.s_type != ATT) || (!paradise && me->p_ship.s_type != ATT_BRONCO))
             db_bar ("Et", 109 * W_Textwidth / 3, 3 + 2 * (W_Textheight + SPACING),
                     me->p_etemp / 10, me->p_ship.s_maxegntemp / 10,
                     me->p_ship.s_maxegntemp / 10, DB_3DIGITS, color);

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- newwin.c	18 Apr 2008 03:42:37 -0000	1.74
+++ newwin.c	19 Apr 2008 16:23:00 -0000	1.75
@@ -1586,7 +1586,7 @@
              int *s_type)
 {
     struct shiplist *shipscan;
-    int typeok = 0, i = 0;
+    int typeok = 0, ship_found = 0, i = 0;
     time_t startTime;
     W_Event event;
     int lastplayercount[4];
@@ -1748,7 +1748,7 @@
         if (!W_EventsPending ())
             continue;
         W_NextEvent (&event);
-        typeok = 0;
+        typeok = 1;
         switch ((int) event.type)
         {
         case W_EV_KEY:
@@ -1756,31 +1756,38 @@
             while (shipscan) {
                 if (shipscan->ship->s_letter == event.key) {
                     *s_type = shipscan->ship->s_type;
-                    typeok = 1;
+                    ship_found = 1;
                     break;
                 }
                 shipscan = shipscan->next;
             }
+            /* Tried to find ship key but couldn't? */
+            if (ship_found == 0)
+                typeok = 0;
+            /* Failing to find ship via key, check spacebar */
             if (event.key == ' ')
             {
                 switch (me->p_team)
                 {
-                case FED:
-                    *team = 0;
-                    break;
-                case ROM:
-                    *team = 1;
-                    break;
-                case KLI:
-                    *team = 2;
-                    break;
-                case ORI:
-                    *team = 3;
-                    break;
-                default:
-                    break;
+                    case FED:
+                        *team = 0;
+                        typeok = 1;
+                        break;
+                    case ROM:
+                        *team = 1;
+                        typeok = 1;
+                        break;
+                    case KLI:
+                        *team = 2;
+                        typeok = 1;
+                        break;
+                    case ORI:
+                        *team = 3;
+                        typeok = 1;
+                        break;
+                    default:
+                        break;
                 }
-                break;
             }
             if (event.Window == w)
             {
@@ -2293,15 +2300,15 @@
     if (strncmp("BLK: ", line, 5) == 0) {
         /* See if it's a refit string.*/
         if (strncmp(&line[5], "REFIT", 5) == 0) {
-    	    strncpy(blk_refitstring, &line[10], 79);
-    	    blk_refitstring[79] = '\0';
+            strncpy(blk_refitstring, &line[10], 79);
+            blk_refitstring[79] = '\0';
         }
         /* Check to see if it's a borgish feature being enabled. */
         else if (strncmp(&line[5], "BORGISH ", 8) == 0) {
-    	    if (strncmp(&line[13], "FRCLOAK", 7) == 0)
-    	        blk_friendlycloak = 1;
+            if (strncmp(&line[13], "FRCLOAK", 7) == 0)
+                blk_friendlycloak = 1;
         }
-	return;
+        return;
     }
     if ( strncmp("\t@@b", line, 4) == 0) // Between pages
 	return;

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- input.c	18 Apr 2008 03:42:37 -0000	1.45
+++ input.c	19 Apr 2008 16:23:00 -0000	1.46
@@ -451,7 +451,7 @@
     unsigned char *str;
 
     if ((str = (unsigned char *) stringDefault ("keymap")) != NULL)
-    	keymapAdd(str, default_keymap);
+    	keymapAdd(str, (char*) default_keymap);
 
     /* See if we can get macroKey to work. What a hack -SAC */
     if ((str = (unsigned char *) stringDefault ("macroKey")) != NULL)
@@ -477,7 +477,7 @@
     }
 
     if ((str = (unsigned char *) stringDefault ("ckeymap")) != NULL)
-        ckeymapAdd(str, default_keymap);
+        ckeymapAdd(str, (char*) default_keymap);
 
 #ifdef MOUSE_AS_SHIFT
     if ((str = (unsigned char *) stringDefault ("b1keymap")) != NULL)
@@ -549,7 +549,7 @@
 
     /* note: not stored on server */
     if ((str = (unsigned char *) stringDefault ("buttonmap")) != NULL)
-    	buttonmapAdd(str, default_buttonmap);
+    	buttonmapAdd(str, (char*) default_buttonmap);
     
     /* Build ship specific keymaps */
     for (j = 0; j < nshiptypes; j++)
@@ -681,7 +681,8 @@
 buildShipKeymap(struct ship *shipp)
 {
     char keybuf[40], ckeybuf[40], buttonbuf[40];
-    char *pek;
+    char *keymap_str, *ckeymap_str, *buttonmap_str;
+    int i;
 
 #ifdef MOUSE_AS_SHIFT
     memcpy(shipp->s_keymap, default_keymap, 672);
@@ -694,14 +695,47 @@
     sprintf(ckeybuf, "ckeymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]);
     sprintf(buttonbuf, "buttonmap-%c%c", shipp->s_desig[0], shipp->s_desig[1]);
 
-    if (pek = stringDefault (keybuf))
-        keymapAdd(pek, shipp->s_keymap);
 
-    if (pek = stringDefault (ckeybuf))
-        ckeymapAdd(pek, shipp->s_keymap);
+    keymap_str = stringDefault (keybuf);
+    ckeymap_str = stringDefault (ckeybuf);
+    buttonmap_str = stringDefault (buttonbuf);
+
+    /* If individual ship keymap is found, reset the ship's keymap first before
+       parsing the keymap string */
+    if (keymap_str || ckeymap_str)
+    {
+        for (i = 0; i < 95; i++)
+        {
+            shipp->s_keymap[i] = (unsigned char) (i + 32);
+            shipp->s_keymap[i + 96] = (unsigned char) (i + 32 + 96);
+
+#ifdef MOUSE_AS_SHIFT
+            shipp->s_keymap[i + 192] = (unsigned char) (i + 32);
+            shipp->s_keymap[i + 288] = (unsigned char) (i + 32);
+            shipp->s_keymap[i + 384] = (unsigned char) (i + 32);
+            shipp->s_keymap[i + 480] = (unsigned char) (i + 32);
+            shipp->s_keymap[i + 576] = (unsigned char) (i + 32);
+#endif
+        }
+        shipp->s_keymap[95] = 0;
+    }
+    
+    /* If individual ship buttonmap is found, reset the ship's buttonmap first before
+       parsing the buttonmap string */
+    if (buttonmap_str)
+    {
+        for (i = 1; i < 23; i++)
+            shipp->s_buttonmap[i] = 0;
+    }
+
+    if (keymap_str)
+        keymapAdd(keymap_str, (char*) shipp->s_keymap);
+
+    if (ckeymap_str)
+        ckeymapAdd(ckeymap_str, (char*) shipp->s_keymap);
         
-    if (pek = stringDefault (buttonbuf))
-        buttonmapAdd(pek, shipp->s_buttonmap);
+    if (buttonmap_str)
+        buttonmapAdd(buttonmap_str, (char*) shipp->s_buttonmap);
 }
 
 /******************************************************************************/
@@ -3338,8 +3372,7 @@
 Key114 (void)
 {
     localflags |= PFREFIT;
-    warning
-        ("s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, g=galaxy, o=starbase");
+    warning(blk_refitstring);
 }
 
 /******************************************************************************/

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- cowmain.c	18 Apr 2008 03:42:36 -0000	1.38
+++ cowmain.c	19 Apr 2008 16:22:58 -0000	1.39
@@ -1010,7 +1010,6 @@
     redrawall = 1;
 #endif
 
-    shipchange (s_type);
     enter ();
     calibrate_stats ();
     W_ClearWindow (w);

Index: getname.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getname.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- getname.c	18 Apr 2008 03:42:37 -0000	1.11
+++ getname.c	19 Apr 2008 16:22:59 -0000	1.12
@@ -417,21 +417,21 @@
 
     MZERO (mystats, sizeof (struct stats));
 
-    // Reset the keymap for our player record
+    // Set up the default keymap
     for (j = 0; j < 95; j++)
     {
-        myship->s_keymap[j] = (unsigned char) (j + 32);
-        myship->s_keymap[j + 96] = (unsigned char) (j + 32 + 96);
+        default_keymap[j] = (unsigned char) (j + 32);
+        default_keymap[j + 96] = (unsigned char) (j + 32 + 96);
 
 #ifdef MOUSE_AS_SHIFT
-        myship->s_keymap[j + 192] = (unsigned char) (j + 32);
-        myship->s_keymap[j + 288] = (unsigned char) (j + 32);
-        myship->s_keymap[j + 384] = (unsigned char) (j + 32);
-        myship->s_keymap[j + 480] = (unsigned char) (j + 32);
-        myship->s_keymap[j + 576] = (unsigned char) (j + 32);
+        default_keymap[j + 192] = (unsigned char) (j + 32);
+        default_keymap[j + 288] = (unsigned char) (j + 32);
+        default_keymap[j + 384] = (unsigned char) (j + 32);
+        default_keymap[j + 480] = (unsigned char) (j + 32);
+        default_keymap[j + 576] = (unsigned char) (j + 32);
 #endif
     }
-    myship->s_keymap[95] = 0;
+    default_keymap[95] = 0;
     mystats->st_tticks = 1;
     mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS +
         ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2;

Index: playback.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- playback.c	18 Apr 2008 03:42:37 -0000	1.25
+++ playback.c	19 Apr 2008 16:23:00 -0000	1.26
@@ -222,7 +222,6 @@
 
     me->p_x = me->p_y = 50000;
     myship = getship(CRUISER);
-    shipchange (CRUISER);
     displayme = me;
     packetsme = me;
 
@@ -243,18 +242,18 @@
     mystats->st_tticks = 1;
     for (i = 0; i < 95; i++)
     {
-        myship->s_keymap[i] = (unsigned char) (i + 32);
-        myship->s_keymap[i + 96] = (unsigned char) (i + 32 + 96);
+        default_keymap[i] = (unsigned char) (i + 32);
+        default_keymap[i + 96] = (unsigned char) (i + 32 + 96);
 
 #ifdef MOUSE_AS_SHIFT
-        myship->s_keymap[i + 192] = (unsigned char) (i + 32);
-        myship->s_keymap[i + 288] = (unsigned char) (i + 32);
-        myship->s_keymap[i + 384] = (unsigned char) (i + 32);
-        myship->s_keymap[i + 480] = (unsigned char) (i + 32);
-        myship->s_keymap[i + 576] = (unsigned char) (i + 32);
+        default_keymap[i + 192] = (unsigned char) (i + 32);
+        default_keymap[i + 288] = (unsigned char) (i + 32);
+        default_keymap[i + 384] = (unsigned char) (i + 32);
+        default_keymap[i + 480] = (unsigned char) (i + 32);
+        default_keymap[i + 576] = (unsigned char) (i + 32);
 #endif
     }
-    myship->s_keymap[95] = 0;
+    default_keymap[95] = 0;
     mystats->st_flags = ST_MAPMODE + ST_NAMEMODE + ST_SHOWSHIELDS +
         ST_KEEPPEACE + ST_SHOWLOCAL * 2 + ST_SHOWGLOBAL * 2;
 
@@ -328,7 +327,6 @@
 #endif
 
     myship = getship (myship->s_type);
-    shipchange (myship->s_type);
     enter ();
     calibrate_stats ();
     W_ClearWindow (w);

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- socket.c	18 Apr 2008 03:42:37 -0000	1.43
+++ socket.c	19 Apr 2008 16:23:00 -0000	1.44
@@ -2677,40 +2677,108 @@
 #endif /* defined(BORG) */
 }
 
-/* SP_SHIP_CAP is sent frequenly by bronco servers but only once
-   by a paradise server.  The paradise server packet contains ship
-   data for all ships.  The bronco server packet contains data on
-   only one ship. */
+/* SP_SHIP_CAP packets are sent frequently by bronco servers but only
+  during initial connect by a paradise server. */
 void
 handleShipCap (struct ship_cap_spacket *packet)
 {
-    unsigned short stype;
+    struct shiplist *temp;
 
-    stype = ntohs (packet->s_type);
-    if (!paradise)
-    {
-        shipvals[stype].s_torpspeed = ntohs (packet->s_torpspeed);
-        shipvals[stype].s_maxshield = ntohl (packet->s_maxshield);
-        shipvals[stype].s_maxdamage = ntohl (packet->s_maxdamage);
-        shipvals[stype].s_maxegntemp = ntohl (packet->s_maxegntemp);
-        shipvals[stype].s_maxwpntemp = ntohl (packet->s_maxwpntemp);
-        shipvals[stype].s_maxarmies = ntohs (packet->s_maxarmies);
-        shipvals[stype].s_maxfuel = ntohl (packet->s_maxfuel);
-        shipvals[stype].s_maxspeed = ntohl (packet->s_maxspeed);
-        shipvals[stype].s_width = ntohs (packet->s_width);
-        shipvals[stype].s_height = ntohs (packet->s_height);
-        shipvals[stype].s_phaserdamage = ntohs (packet->s_phaserrange);
-        shipvals[stype].s_letter = packet->s_letter;
-        shipvals[stype].s_desig[1] = packet->s_desig1;
-        shipvals[stype].s_desig[2] = packet->s_desig2;
-        shipvals[stype].s_bitmap = ntohs (packet->s_bitmap);
-        /* strncpy(shipvals[stype].s_name, packet->s_name, 16); */
-        myship = getship (myship->s_type);
+    /*
+       What are we supposed to do?
+    */
 
-        redrawTstats (); /* Redraw dashboard */
-        calibrate_stats (); /* Redefine colored statwin sliders */
-        redrawStats ();  /* Redraw statwin */
+    if (packet->operation) {	/* remove ship from list */
+	temp = shiptypes;
+	if (temp->ship->s_type == (int) ntohs(packet->s_type)) {
+	    shiptypes = temp->next;
+	    shiptypes->prev = NULL;
+	}
+	while (temp->next != NULL) {
+	    if (temp->next->ship->s_type == (int) ntohs(packet->s_type)) {
+		temp = temp->next;
+		temp->prev->next = temp->next;
+		if (temp->next)
+		    temp->next->prev = temp->prev;
+		free(temp->ship);
+		free(temp);
+		return;
+	    } else {
+		temp = temp->next;
+	    }
+	}
+    }
+    /*
+       Since we're adding the ship, we need to find out if we already have
+       that ship, and if so, replace it.
+    */
+
+    temp = shiptypes;
+    while (temp != NULL) {
+	if (temp->ship->s_type == (int) ntohs(packet->s_type)) {
+	    temp->ship->s_type = ntohs(packet->s_type);
+	    temp->ship->s_torpspeed = ntohs(packet->s_torpspeed);
+	    temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange);
+	    if (paradise)	/* paradise compatibility */
+		temp->ship->s_phaserdamage *= PHASEDIST / 100;
+	    temp->ship->s_maxspeed = ntohl(packet->s_maxspeed);
+	    temp->ship->s_width = ntohs (packet->s_width);
+	    temp->ship->s_height = ntohs (packet->s_height);
+	    temp->ship->s_maxfuel = ntohl(packet->s_maxfuel);
+	    temp->ship->s_maxshield = ntohl(packet->s_maxshield);
+	    temp->ship->s_maxdamage = ntohl(packet->s_maxdamage);
+	    temp->ship->s_maxwpntemp = ntohl(packet->s_maxwpntemp);
+	    temp->ship->s_maxegntemp = ntohl(packet->s_maxegntemp);
+	    temp->ship->s_maxarmies = ntohs(packet->s_maxarmies);
+	    //if(F_armies_shipcap == 1)
+  	    //  temp->ship->s_armies = packet->s_armies;
+	    temp->ship->s_letter = packet->s_letter;
+	    temp->ship->s_desig[0] = packet->s_desig1;
+	    temp->ship->s_desig[1] = packet->s_desig2;
+	    temp->ship->s_bitmap = ntohs(packet->s_bitmap);
+	    //buildShipKeymap(temp->ship);
+	    myship = getship (myship->s_type);
+            redrawTstats (); /* Redraw dashboard */
+            calibrate_stats (); /* Redefine colored statwin sliders */
+            redrawStats ();  /* Redraw statwin */
+	    return;
+	}
+	temp = temp->next;
     }
+
+    /*
+       Not there, so we need to make a new entry in the list for it.
+    */
+    temp = (struct shiplist *) malloc(sizeof(struct shiplist));
+    temp->next = shiptypes;
+    temp->prev = NULL;
+    if (shiptypes)
+	shiptypes->prev = temp;
+    shiptypes = temp;
+    temp->ship = (struct ship *) malloc(sizeof(struct ship));
+    temp->ship->s_type = ntohs(packet->s_type);
+    temp->ship->s_torpspeed = ntohs(packet->s_torpspeed);
+    temp->ship->s_phaserdamage = ntohs(packet->s_phaserrange);
+    if (paradise)	/* paradise compatibility */
+         temp->ship->s_phaserdamage *= PHASEDIST / 100;
+    temp->ship->s_maxspeed = ntohl(packet->s_maxspeed);
+    temp->ship->s_width = ntohs (packet->s_width);
+    temp->ship->s_height = ntohs (packet->s_height);
+    temp->ship->s_maxfuel = ntohl(packet->s_maxfuel);
+    temp->ship->s_maxshield = ntohl(packet->s_maxshield);
+    temp->ship->s_maxdamage = ntohl(packet->s_maxdamage);
+    temp->ship->s_maxwpntemp = ntohl(packet->s_maxwpntemp);
+    temp->ship->s_maxegntemp = ntohl(packet->s_maxegntemp);
+    temp->ship->s_maxarmies = ntohs(packet->s_maxarmies);
+    temp->ship->s_armies = packet->s_armies;
+    temp->ship->s_letter = packet->s_letter;
+    temp->ship->s_desig[0] = packet->s_desig1;
+    temp->ship->s_desig[1] = packet->s_desig2;
+    temp->ship->s_bitmap = ntohs(packet->s_bitmap);
+    myship = getship (myship->s_type);
+    redrawTstats (); /* Redraw dashboard */
+    calibrate_stats (); /* Redefine colored statwin sliders */
+    redrawStats ();  /* Redraw statwin */
 }
 
 void

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- data.c	18 Apr 2008 03:42:36 -0000	1.108
+++ data.c	19 Apr 2008 16:22:58 -0000	1.109
@@ -305,7 +305,7 @@
 /* MOTD data */
 struct page *currpage = NULL;
 struct page *pmotddata = NULL;
-char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, o=starbase";
+char blk_refitstring[80] = "s=scout, d=destroyer, c=cruiser, b=battleship, a=assault, g=galaxy, o=starbase";
 int blk_friendlycloak = 0;	/* Show color of cloakers who are friendly. */
 
 

Index: helpwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/helpwin.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- helpwin.c	18 Apr 2008 03:42:37 -0000	1.14
+++ helpwin.c	19 Apr 2008 16:22:59 -0000	1.15
@@ -251,6 +251,9 @@
 {
 	int i, message_number = -1;
 	int row, column = 0;
+	int shpn;
+	char newkeys[4];
+	struct ship *shipp;
 
 	/* Close window? */
 	if (data->key == W_MBUTTON
@@ -287,9 +290,20 @@
 
 	if (message_number != -1)
 	{
-		/* And now we will remap the key in that message */
-		myship->s_keymap[(data->key) - 32] = help_message[message_number][0];
-
+		/* First we will place the key and the help message into typical
+		   keymap string form */
+		newkeys[0] = data->key;
+		newkeys[1] = help_message[message_number][0];
+		newkeys[2] = 0;
+		/* And then we will update default, myship, and individual ship
+		   keymaps/buttonmaps with that string */
+		keymapAdd(newkeys, (char*) default_keymap);
+		keymapAdd(newkeys, (char*) myship->s_keymap);
+		for (shpn = 0; shpn < nshiptypes; shpn++)
+		{
+			shipp = getship(shpn);
+			keymapAdd(newkeys, (char*) shipp->s_keymap);
+		}
 		/* Finally we want to update window */
 		fillhelp ();
 	}

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- option.c	18 Apr 2008 03:42:37 -0000	1.54
+++ option.c	19 Apr 2008 16:23:00 -0000	1.55
@@ -1029,110 +1029,24 @@
 void
 optiondone (void)
 {
-    char *str;
+    int shpn;
+    struct ship *shipp;
 
     /* Unmap window */
     W_UnmapWindow (optionWin);
 
-    /* update keymap */
-    for (str = newkeys; *str != '\0'; str += 2)
+    /* update default, myship, and individual ship keymaps/buttonmaps */
+    keymapAdd(newkeys, (char*) default_keymap);
+    buttonmapAdd(newbuttons, (char*) default_buttonmap);
+    keymapAdd(newkeys, (char*) myship->s_keymap);
+    buttonmapAdd(newbuttons, (char*) myship->s_buttonmap);
+    for (shpn = 0; shpn < nshiptypes; shpn++)
     {
-        if ((*str >= 32 && *str < 127) || *str == 'O')
-        {
-            if (*(str + 1) == '\0')
-                break;
-            myship->s_keymap[*str - 32] = *(str + 1);
-        }
-        if (*(str + 1) == '\0')
-            break;
+        shipp = getship(shpn);
+        keymapAdd(newkeys, (char*) shipp->s_keymap);
+        buttonmapAdd(newbuttons, (char*) shipp->s_buttonmap);
     }
     *newkeys = '\0';
-
-    /* update buttonmap */
-    str = newbuttons;
-    while (*str != '\0' && *(str + 1) != '\0')
-    {
-        switch (*str++)
-        {
-        case '1':
-            myship->s_buttonmap[1] = getctrlkey (&str);
-            break;
-        case '2':
-            myship->s_buttonmap[2] = getctrlkey (&str);
-            break;
-        case '3':
-            myship->s_buttonmap[3] = getctrlkey (&str);
-            break;
-        /* XButton 1 */
-        case '4':
-            myship->s_buttonmap[4] = getctrlkey (&str);
-            break;
-        /* XButton 2 */
-        case '5':
-            myship->s_buttonmap[5] = getctrlkey (&str);
-            break;
-        /* Wheel Up */
-        case '6':
-            myship->s_buttonmap[6] = getctrlkey (&str);
-            break;
-        /* Wheel Down */
-        case '7':
-            myship->s_buttonmap[7] = getctrlkey (&str);
-            break;
-
-#ifdef SHIFTED_MOUSE
-        case '8':
-            myship->s_buttonmap[8] = getctrlkey (&str);
-            break;
-        case '9':
-            myship->s_buttonmap[9] = getctrlkey (&str);
-            break;
-        case 'a':
-            myship->s_buttonmap[10] = getctrlkey (&str);
-            break;
-        case 'b':
-            myship->s_buttonmap[11] = getctrlkey (&str);
-            break;
-        case 'c':
-            myship->s_buttonmap[12] = getctrlkey (&str);
-            break;
-        case 'd':
-            myship->s_buttonmap[13] = getctrlkey (&str);
-            break;
-        case 'e':
-            myship->s_buttonmap[14] = getctrlkey (&str);
-            break;
-        case 'f':
-            myship->s_buttonmap[15] = getctrlkey (&str);
-            break;
-        case 'g':
-            myship->s_buttonmap[16] = getctrlkey (&str);
-            break;
-        case 'h':
-            myship->s_buttonmap[17] = getctrlkey (&str);
-            break;
-        case 'i':
-            myship->s_buttonmap[18] = getctrlkey (&str);
-            break;
-        case 'j':
-            myship->s_buttonmap[19] = getctrlkey (&str);
-            break;
-        case 'k':
-            myship->s_buttonmap[20] = getctrlkey (&str);
-            break;
-        case 'l':
-            myship->s_buttonmap[21] = getctrlkey (&str);
-            break;
-        case 'm':
-            myship->s_buttonmap[22] = getctrlkey (&str);
-            break;
-#endif /* SHIFTED_MOUSE */
-            
-        default:
-            LineToConsole ("%c ignored in buttonmap\n", *(str - 1));
-            break;
-        }
-    }
     *newbuttons = '\0';
     
     /* update login */

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- defaults.c	18 Apr 2008 03:42:36 -0000	1.91
+++ defaults.c	19 Apr 2008 16:22:59 -0000	1.92
@@ -1994,24 +1994,6 @@
 	updateWindowsGeometry (war);
 */
 }
-
-/******************************************************************************/
-/***  shipchange()                                                          ***/
-/******************************************************************************/
-void
-shipchange (int type)
-{
-/*    if (type == myshiptype)
-        return;
-    myshiptype = type;
-    myshipdef = &shipdefaults[type];
-    if (shipdefaults[type].rcfile)
-    {
-        initDefaults (shipdefaults[type].rcfile);
-        resetdefaults ();
-    }
-    initkeymap ();*/
-}
  
 /* Generally useful function that searches for a file
    in the current and home directories, also
@@ -3351,7 +3333,7 @@
 
     if (saveBig)
     {
-        fputs ("# Esoteric features such as individual ship rcfiles/keymaps\n", fp);
+        fputs ("# Esoteric features such as individual ship keymaps\n", fp);
         fputs ("# /ckeymaps/buttonmaps (i.e. keymap-ca: <keymap>), observer\n", fp);
         fputs ("# /servertype options (i.e. keymap.bronco: <keymap>), and\n", fp);
         fputs ("# button keymaps (b1keymap through b5keymap)\n", fp);
@@ -3362,14 +3344,6 @@
     	struct ship *shipp;
 
         shipp = getship(j);
-        sprintf(str1, "rcfile-%c%c", shipp->s_desig[0], shipp->s_desig[1]);
-        adefault = stringDefault (str1);
-        if (adefault != NULL)
-        {
-            sprintf (str, "%s: %s\n", str1, adefault);
-            fputs (str, fp);
-        }
-
         sprintf(str1, "keymap-%c%c", shipp->s_desig[0], shipp->s_desig[1]);
         adefault = stringDefault (str1);
         if (adefault != NULL)