Index: include/packets.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/packets.h,v retrieving revision 1.5 diff -u -r1.5 packets.h --- include/packets.h 18 Dec 2006 00:13:05 -0000 1.5 +++ include/packets.h 4 Apr 2007 05:34:41 -0000 @@ -175,6 +175,9 @@ * verification */ #endif +#define CP_PLANET 38 /* synchronizes planet info + * between client and server */ + #define CP_PING_RESPONSE 42 /* client response */ #ifdef SHORT_PACKETS @@ -426,6 +429,15 @@ char pad2; }; +struct planet_cpacket +{ + char type; /* CP_PLANET */ + char pnum; + char owner; + char info; + unsigned char armies; +}; + struct practr_cpacket { char type; /* CP_PRACTR */ Index: include/proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.43 diff -u -r1.43 proto.h --- include/proto.h 1 Apr 2007 10:11:36 -0000 1.43 +++ include/proto.h 4 Apr 2007 05:52:04 -0000 @@ -1096,6 +1096,7 @@ struct mask_spacket; void handleMask (struct mask_spacket *packet); void sendOptionsPacket (void); +void sendPlanetsPacket (int pnum); void pickSocket (int old); struct badversion_spacket; void handleBadVersion (struct badversion_spacket *packet); Index: src/local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.85 diff -u -r1.85 local.c --- src/local.c 4 Apr 2007 04:06:37 -0000 1.85 +++ src/local.c 4 Apr 2007 05:51:08 -0000 @@ -562,6 +562,10 @@ clearcount++; } + /* Synchronize planet info every update for current orbitted planet */ + if ((me->p_flags & PFORBIT) && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no) + sendPlanetsPacket(l->pl_no); + /* Allow army display if player/observer is orbitting a planet, or alternatively if observer is locked onto a planet, or is show_army_count feature packet is on */ if ((showArmy == 1 || showArmy == 3) && (l->pl_info & me->p_team) Index: src/socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.26 diff -u -r1.26 socket.c --- src/socket.c 4 Apr 2007 04:06:38 -0000 1.26 +++ src/socket.c 4 Apr 2007 05:45:59 -0000 @@ -227,6 +227,7 @@ sizeof (struct shield_cpacket), /* CP_SHIELD */ sizeof (struct repair_cpacket), /* CP_REPAIR */ sizeof (struct orbit_cpacket), /* CP_ORBIT */ + sizeof (struct planet_cpacket), /* CP_PLANET */ sizeof (struct planlock_cpacket), /* CP_PLANLOCK */ sizeof (struct playlock_cpacket), /* CP_PLAYLOCK */ sizeof (struct bomb_cpacket), /* CP_BOMB */ @@ -1586,6 +1587,7 @@ case CP_SHIELD: case CP_REPAIR: case CP_ORBIT: + case CP_PLANET: case CP_PLANLOCK: case CP_PLAYLOCK: case CP_BOMB: @@ -2110,6 +2112,22 @@ } void +sendPlanetsPacket (int pnum) +{ + struct planet_cpacket planPacket; + struct planet *pl; + + pl = &planets[pnum]; + + planPacket.type = CP_PLANET; + planPacket.pnum = pl->pl_no; + planPacket.owner = pl->pl_owner; + planPacket.info = pl->pl_info; + planPacket.armies = pl->pl_armies; + sendServerPacket ((struct player_spacket *) &planPacket); +} + +void pickSocket (int old) { int newsocket; @@ -3976,7 +3994,7 @@ LineToConsole("\nC->S CP_REPAIR\t"); if (log_packets > 1) LineToConsole(" state=%d,", - ((struct repair_cpacket *) packet)-> state ); + ((struct repair_cpacket *) packet)->state ); break; case CP_ORBIT : /* orbit planet/starbase */ LineToConsole("\nC->S CP_ORBIT\t"); @@ -3984,6 +4002,12 @@ LineToConsole(" state=%d,", ((struct orbit_cpacket *) packet)->state ); break; + case CP_PLANET : /* planet info */ + LineToConsole("\nC->S CP_PLANET\t"); + if (log_packets > 1) + LineToConsole(" pnum=%d,", + ((struct planet_cpacket *) packet)->pnum ); + break; case CP_PLANLOCK : /* lock on planet */ LineToConsole("\nC->S CP_PLANLOCK\t"); if (log_packets > 1)