Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27091/src Modified Files: data.c feature.c socket.c Log Message: Next iteration on getting generic_32 version b working. Known issue: not getting packets from server with code for version a or earlier. Index: feature.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- feature.c 12 Jul 2008 12:09:37 -0000 1.23 +++ feature.c 13 Jul 2008 03:15:48 -0000 1.24 @@ -76,7 +76,7 @@ {"SELF_8FLAGS2", &F_self_8flags2, 'S', 0, 0, 0}, {"19FLAGS", &F_self_19flags, 'S', 1, 0, 0}, {"SHIP_CAP", &F_ship_cap, 'S', 1, 0, 0}, - {"SP_GENERIC_32", &F_sp_generic_32, 'S', 1, "\002", 0}, + {"SP_GENERIC_32", &F_sp_generic_32, 'S', 1, &A_sp_generic_32, 0}, {"FULL_DIRECTION_RESOLUTION", &F_full_direction_resolution, 'S', 1, 0, 0}, {"FULL_WEAPON_RESOLUTION", &F_full_weapon_resolution, 'S', 1, 0, 0}, {"CHECK_PLANETS", &F_check_planets, 'S', 1, 0, 0}, @@ -133,7 +133,10 @@ else if (!strcmp(f->name, "FULL_WEAPON_RESOLUTION")) value = useFullWeapInfo; else if (!strcmp(f->name, "SP_GENERIC_32")) + { value = useGeneric32; + arg1 = GENERIC_32_VERSION; + } sendFeature (f->name, f->feature_type, value, arg1, arg2); #ifdef DEBUG LineToConsole ("(C->S) %s (%c): %d (%d/%d)\n", f->name, @@ -214,7 +217,7 @@ } if (strcmpi (packet->name, "SP_GENERIC_32") == 0) { - generic_32_version = packet->arg1; + A_sp_generic_32 = packet->arg1; return; } if (features[i].name == 0) Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- socket.c 12 Jul 2008 12:09:37 -0000 1.49 +++ socket.c 13 Jul 2008 03:15:48 -0000 1.50 @@ -2810,28 +2810,12 @@ void handleGeneric32 (struct generic_32_spacket *packet) { - - if (sizeof(struct generic_32_spacket) != GENERIC_32_LENGTH) - { -#ifdef DEBUG - LineToConsole("Generic32 packet length of %d, ignoring packet.\n", sizeof(struct generic_32_spacket)); -#endif - return; - } return; } void handleGeneric32_a (struct generic_32_spacket_a *packet) { - - if (sizeof(struct generic_32_spacket) != GENERIC_32_LENGTH) - { -#ifdef DEBUG - LineToConsole("Generic32 packet length of %d, ignoring packet.\n", sizeof(struct generic_32_spacket)); -#endif - return; - } me->p_repair_time = packet->repair_time; me->pl_orbit = packet->pl_orbit; return; @@ -2840,14 +2824,6 @@ void handleGeneric32_b (struct generic_32_spacket_b *packet) { - - if (sizeof(struct generic_32_spacket) != GENERIC_32_LENGTH) - { -#ifdef DEBUG - LineToConsole("Generic32 packet length of %d, ignoring packet.\n", sizeof(struct generic_32_spacket)); -#endif - return; - } me->p_repair_time = ntohs (packet->repair_time); me->pl_orbit = packet->pl_orbit; context->gameup = ntohs(packet->gameup); @@ -3006,11 +2982,11 @@ handleMotdPic ((struct motd_pic_spacket *) sbuf); else { - if (generic_32_version == 'a') - handleGeneric32_a ((struct generic_32_spacket_a *) sbuf); - else if (generic_32_version == 'b') - handleGeneric32_b ((struct generic_32_spacket_b *) sbuf); - else + if (sbuf[1] == 'a') + handleGeneric32_a ((struct generic_32_spacket_a *) sbuf); + else if (sbuf[1] == 'b') + handleGeneric32_b ((struct generic_32_spacket_b *) sbuf); + else handleGeneric32 ((struct generic_32_spacket *) sbuf); } return; @@ -5113,12 +5089,12 @@ LineToConsole("\nS->C SP_GENERIC_32\t"); if (log_packets > 1) { - if (generic_32_version == 'a') + if (packet[1] == 'a') LineToConsole(" version=%d, repair_time=%d, pl_orbit=%d,", ((struct generic_32_spacket_a *) packet)->version, ((struct generic_32_spacket_a *) packet)->repair_time, ((struct generic_32_spacket_a *) packet)->pl_orbit); - else if (generic_32_version == 'b') + else if (packet[1] == 'b') LineToConsole(" version=%d, repair_time=%d, pl_orbit=%d, gameup=%d, tourn_teams=%d, tourn_age=%d, tourn_age_units=%d, tourn_remain=%d, tourn_remain_units=%d, starbase_remain=%d, team_remain=%d,", ((struct generic_32_spacket_b *) packet)->version, ntohs(((struct generic_32_spacket_b *) packet)->repair_time), Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- data.c 12 Jul 2008 12:09:37 -0000 1.113 +++ data.c 13 Jul 2008 03:15:48 -0000 1.114 @@ -762,6 +762,7 @@ int F_ship_cap = 0; int F_show_all_tractors = 1; int F_sp_generic_32 = 0; +char A_sp_generic_32 = 0; /* last sp_generic_32 version sent by server */ int F_full_direction_resolution = 0; int F_full_weapon_resolution = 0; int F_check_planets = 0; @@ -928,5 +929,4 @@ int fullBitmapRotation = 1; /* draw old bitmap sets to all angles */ int hideConsole = 0; /* show console window or not */ -int generic_32_version = 0; /* what version of generic_32 does server send us */ struct context *context;