Vanilla List Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in ship_cap packet generation..



There are some bugs in the way the server generates ship_cap packets during a
refit.  The new chaos mod server at fedora.miridea.com generates them when you
fit, so I noticed.  It totally screws up the paradise client.  First bug is
that the operation field of the ship_cap packet isn't initialized.  It should
be set to 0 to change or add a ship type.  Second bug is that the s_letter
field should be set to the letter used to select the ship, 'c' or 's' for
example.  It is being set to the ship type number.  Third bug is that the
s_bitmap field isn't being set.  The normal bitmaps are the same as the ship
types.  COW ignores these three fields, but the paradise client doesn't.  I've
attached a patch that fixes them.
Index: interface.c
===================================================================
RCS file: /home/netrek/cvsroot/Vanilla/ntserv/interface.c,v
retrieving revision 1.3
diff -u -r1.3 interface.c
--- interface.c	1999/05/28 13:35:07	1.3
+++ interface.c	1999/08/27 10:11:27
@@ -541,25 +541,27 @@
     /* Notify client of new ship stats, if necessary */
 #ifndef ROBOT
     if ((F_ship_cap)&&(!sent_ship[type])) {
-      sent_ship[type] = 1;
-      ShipFoo.type = SP_SHIP_CAP;
-      ShipFoo.s_type = htons(me->p_ship.s_type);
-      ShipFoo.s_torpspeed = htons(me->p_ship.s_torpspeed);
-      ShipFoo.s_maxfuel = htonl(me->p_ship.s_maxfuel);
-      ShipFoo.s_maxspeed = htonl(me->p_ship.s_maxspeed);
-      ShipFoo.s_maxshield = htonl(me->p_ship.s_maxshield);
-      ShipFoo.s_maxdamage = htonl(me->p_ship.s_maxdamage);
-      ShipFoo.s_maxwpntemp = htonl(me->p_ship.s_maxwpntemp);
-      ShipFoo.s_maxegntemp = htonl(me->p_ship.s_maxegntemp);
-      ShipFoo.s_width = htons(me->p_ship.s_width);
-      ShipFoo.s_height = htons(me->p_ship.s_height);
-      ShipFoo.s_maxarmies = htons(me->p_ship.s_maxarmies);
-      ShipFoo.s_letter = me->p_ship.s_type;
-      ShipFoo.s_desig1 = shiptypes[type][0];
-      ShipFoo.s_desig2 = shiptypes[type][1];
-      ShipFoo.s_phaserrange = htons(me->p_ship.s_phaserdamage);
-      strcpy(ShipFoo.s_name,shipnames[me->p_ship.s_type]);
-      sendClientPacket((CVOID) &ShipFoo);
+	sent_ship[type] = 1;
+	ShipFoo.type = SP_SHIP_CAP;
+	ShipFoo.s_type = htons(me->p_ship.s_type);
+	ShipFoo.operation = 0;
+	ShipFoo.s_torpspeed = htons(me->p_ship.s_torpspeed);
+	ShipFoo.s_maxfuel = htonl(me->p_ship.s_maxfuel);
+	ShipFoo.s_maxspeed = htonl(me->p_ship.s_maxspeed);
+	ShipFoo.s_maxshield = htonl(me->p_ship.s_maxshield);
+	ShipFoo.s_maxdamage = htonl(me->p_ship.s_maxdamage);
+	ShipFoo.s_maxwpntemp = htonl(me->p_ship.s_maxwpntemp);
+	ShipFoo.s_maxegntemp = htonl(me->p_ship.s_maxegntemp);
+	ShipFoo.s_width = htons(me->p_ship.s_width);
+	ShipFoo.s_height = htons(me->p_ship.s_height);
+	ShipFoo.s_maxarmies = htons(me->p_ship.s_maxarmies);
+	ShipFoo.s_letter = "sdcbaog*"[me->p_ship.s_type];
+	ShipFoo.s_desig1 = shiptypes[type][0];
+	ShipFoo.s_desig2 = shiptypes[type][1];
+	ShipFoo.s_phaserrange = htons(me->p_ship.s_phaserdamage);
+	ShipFoo.s_bitmap = htons(me->p_ship.s_type);
+	strcpy(ShipFoo.s_name,shipnames[me->p_ship.s_type]);
+	sendClientPacket((CVOID) &ShipFoo);
     }
 #endif
     if (type != STARBASE && me->p_kills < plkills) {