//multiver.h added 4/18/99 - Matt Mueller //We send ver packet several times to make sure it doesn't get dropped. If //they all fail, fall back to sending the old msg based info. Once we have //someones ver, we can use ack'd packets, so theres no need to worry about //sending repeatedly to them. #include #include "vers_id.h" #include "multi.h" #include "network.h" #include "byteswap.h" #include "multiver.h" #include "hudmsg.h" #include "mono.h" #ifdef NETWORK //#define LASTTIMEOUT (F1_0 * 5) #define MULTIVER_RESENDTIME (F1_0 * 2) #define MULTIVER_RESENDNUM 5 struct d1x_ver_item { fix last; fix lastrecv; int numleft; int mode; }d1x_ver_queue[MAX_NUM_NET_PLAYERS]; void multi_do_d1x_ver_set(int src,int shp, int pps){ Net_D1xPlayer[src].shp=shp; if(shp) { if (shp>Network_short_packets) Network_short_packets=shp; hud_message(MSGC_MULTI_INFO, "enabling short packets for %s",Players[src].callsign); } Net_D1xPlayer[src].pps=pps; if (pps!=Network_pps && pps>=2 && pps<=20){ Network_pps=pps; //Network_packet_interval = F1_0 / Network_pps; hud_message(MSGC_MULTI_INFO, "setting pps to %i", Network_pps); } } void multi_do_d1x_ver(char * buf){ int loc=1,pl,mode,shp,pps; pl=buf[loc++]; mode=buf[loc++]; Net_D1xPlayer[pl].iver=swapint(*(u_int32_t*)(buf+loc));loc+=4; shp=buf[loc++]; pps=buf[loc++]; multi_do_d1x_ver_set(pl,shp,pps); sprintf(Net_D1xPlayer[pl].ver,"D1X v%i.%i",Net_D1xPlayer[pl].iver/1000,(Net_D1xPlayer[pl].iver%1000)/10); hud_message(MSGC_MULTI_INFO, "%s is using %s (%i,%i,%i,%i)", Players[pl].callsign,Net_D1xPlayer[pl].ver,Net_D1xPlayer[pl].iver,shp,pps,mode); // if (mode==1 && d1x_ver_queue[pl].lastrecv+LASTTIMEOUT