Update of /cvsroot/netrek/server/Vanilla/robotd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6880/robotd Modified Files: assault.c data.c data.h death.c decide.c defaults.c defs.h disengage.c dmessage.c dodge.c engage.c findslot.c getarmies.c getname.c getship.c input.c main.c master.c newwin.c ogg.c packets.h parse.c pwarfare.c redraw.c reserved.c robot.c rwarfare.c shmem.c socket.c struct.h update_planets.c update_players.c util.c warfare.c Log Message: Index: findslot.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/findslot.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- findslot.c 21 Mar 2005 05:23:45 -0000 1.1 +++ findslot.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -7,6 +7,7 @@ #include "copyright2.h" #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <errno.h> #include <string.h> Index: ogg.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/ogg.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ogg.c 21 Mar 2005 05:23:45 -0000 1.1 +++ ogg.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -44,7 +44,7 @@ _oggdist = e->hispr-2000; else _oggdist = 4000; /* experiment */ -#endif nodef +#endif if((MYFUEL() < 10 || MYDAMAGE() > 50) && e->dist > 7000){ if(DEBUG & DEBUG_OGG) Index: update_planets.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/update_planets.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- update_planets.c 21 Mar 2005 05:23:45 -0000 1.1 +++ update_planets.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -97,7 +97,7 @@ printf("total independents: %d\n", pls->num_indsp); printf("total unknowns: %d\n", pls->num_unknownsp); printf("total war planets: %d\n", pls->num_warteamsp); -#endif nodef +#endif } _plcmp(el1, el2) Index: util.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- util.c 30 Sep 2005 05:57:43 -0000 1.3 +++ util.c 22 Apr 2006 02:16:46 -0000 1.4 @@ -13,12 +13,23 @@ #include "data.h" #include "robot.h" -mprintf(char *format, ...); - #define ADDRLEN 10 struct distress *loaddistress(enum dist_type i); +mprintf(char *format, ...) +{ + va_list ap; + + if(!read_stdin) + return; + + va_start(ap, format); + (void)vprintf(format, ap); + fflush(stdout); + va_end(ap); +} + /* ** Provide the angular distance between two angles. */ @@ -71,7 +82,7 @@ vec.sv_handler = funct; sigvector(sig, &vec, (struct sigvec *) 0); } -#endif hpux +#endif warning(s, o) @@ -431,19 +442,6 @@ } #endif -mprintf(char *format, ...) -{ - va_list ap; - - if(!read_stdin) - return; - - va_start(ap, format); - (void)vprintf(format, ap); - fflush(stdout); - va_end(ap); -} - mfprintf(char *format, ...) { Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/defaults.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- defaults.c 12 Apr 2006 11:57:00 -0000 1.2 +++ defaults.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -4,9 +4,7 @@ */ #include "copyright2.h" #include <stdio.h> -#ifdef __FreeBSD__ #include <string.h> -#endif struct stringlist { char *string; @@ -18,7 +16,6 @@ #ifndef __FreeBSD__ char *getenv(); -char *strdup(); #endif initDefaults(deffile) @@ -66,18 +63,6 @@ fclose(fp); } -#ifndef __FreeBSD__ -char *strdup(str) -char *str; -{ - char *s; - - s=(char *) malloc(strlen(str)+1); - strcpy(s,str); - return(s); -} -#endif - char *getdefault(str) char *str; { Index: data.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/data.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- data.c 21 Mar 2005 10:17:17 -0000 1.2 +++ data.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -102,7 +102,7 @@ int udpClientSend=1; /* UDP: send our packets using UDP? */ int udpClientRecv=1; /* UDP: receive with fat UDP */ int udpSequenceChk=1; /* UDP: check sequence numbers */ -#endif ATM +#endif #ifdef SHORT_PACKETS int recv_short = 0; Index: assault.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/assault.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- assault.c 21 Mar 2005 05:23:44 -0000 1.1 +++ assault.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -143,7 +143,7 @@ #ifdef nodef if(!do_cloak(0)) req_cloak_off(); -#endif nodef +#endif if(e && e->p && isAlive(e->p)){ if(e->dist < 10000) req_cloak_on(); @@ -163,7 +163,7 @@ return; } } -#endif nodef +#endif if(me->p_armies == 0){ req_shields_up(); Index: data.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/data.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- data.h 21 Mar 2005 10:17:17 -0000 1.2 +++ data.h 22 Apr 2006 02:16:46 -0000 1.3 @@ -113,7 +113,7 @@ extern int udpClientSend; /* UDP */ extern int udpClientRecv; /* UDP */ extern int udpSequenceChk; /* UDP */ -#endif ATM +#endif #ifdef SHORT_PACKETS extern int recv_short; Index: shmem.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/shmem.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- shmem.c 21 Mar 2005 05:23:45 -0000 1.1 +++ shmem.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -1,5 +1,6 @@ #include "copyright.h" #include <stdio.h> +#include <strings.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> Index: pwarfare.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/pwarfare.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pwarfare.c 21 Mar 2005 05:23:45 -0000 1.1 +++ pwarfare.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -77,12 +77,12 @@ } } } -#endif nodef +#endif #ifdef nodef if(j->p_flags & PFCLOAK) printf("%s: speed: %d, dir %d\n", j->p_name, j->p_speed, j->p_dir); -#endif nodef +#endif if(e->invisible) return; @@ -250,7 +250,7 @@ else if((me->p_flags & PFPRESS) && (me->p_tractor != j->p_no)){ req_tractor_off(); } -#endif nodef +#endif _special_tr = 1; } @@ -289,7 +289,7 @@ } #ifdef nodef urnd = (8*edist)/7500 + 2; -#endif nodef +#endif if(j->p_flags & PFORBIT){ get_torp_course(j, &tcrs, me->p_x, me->p_y); if(!_state.defend || angdist(tcrs, dcrs) > 32) @@ -364,7 +364,7 @@ req_torp(tcrs); } return; -#endif nodef +#endif if(_state.protect && (j->p_flags & PFORBIT) && !(j->p_flags & PFCLOAK) && (j->p_planet == _state.protect_planet->pl_no) && edist < 9000){ @@ -417,7 +417,7 @@ printf("damage: %d\n", 100-PL_DAMAGE(e) + PL_SHIELD(e)); printf("td: %d\n", SH_TORPDAMAGE(me)); printf("dist: %d\n", e->dist); -#endif nodef +#endif if(_state.defend){ @@ -754,7 +754,7 @@ if(DEBUG & DEBUG_WARFARE){ printf("hitme = %d\n", e->phit_me); } -#endif nodef +#endif if(e->phit_me > 0) e->phit_me --; } Index: robot.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/robot.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- robot.c 21 Mar 2005 10:17:17 -0000 1.2 +++ robot.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -1,4 +1,6 @@ #include <stdio.h> +#include <string.h> +#include <strings.h> #include <limits.h> #include <math.h> #include <sys/time.h> @@ -543,12 +545,12 @@ #ifdef nodef if(_state.torp_danger || _state.recharge_danger) check_me_explode(); -#endif nodef +#endif #ifdef nodef if(me->p_ship.s_type != STARBASE && !starbase(e)) check_pressor(e); -#endif nodef +#endif num_hits = compute_course(mycrs, &newc, myspeed, &speed, &hittime, &lvorbit); handle_disvars(e, &myspeed); @@ -623,7 +625,7 @@ else if(me->p_speed == 0 && num_hits > 1 && _state.det_torps < 4 && MYFUEL() > 25) req_detonate(""); -#endif nodef +#endif #ifdef nodef /* debug */ if(num_hits > 0 && me->p_speed > 6){ @@ -631,7 +633,7 @@ _state.det_damage, 50*num_hits); printf("my damage + detdamage = %d\n", MYDAMAGE() + _state.det_damage); } -#endif nodef +#endif if(_state.det_torps == 0) return; if(!_state.det_const){ @@ -683,7 +685,7 @@ #ifdef nodef if((me->p_flags & PFORBIT) && _state.assault && !_state.planet) pl = _state.assault_planet; -#endif nodef +#endif if(pl && !(me->p_flags & PFORBIT)){ disengage_c(_state.diswhy, _state.planet, "planet but no orbit"); @@ -1421,7 +1423,7 @@ if(RANDOM()%4 < _state.human) return 0; -#endif nodef +#endif if(_udcounter - tfired < _state.human){ if(angdist(c, tfire_dir) > 20+ (RANDOM()%20)) return 0; @@ -1488,7 +1490,7 @@ if(angdist(crs, turned_dir) > 40) return 0; } -#endif nodef +#endif } /* @@ -1576,7 +1578,7 @@ if(angdist(crs, turned_dir) > 40) return 0; } -#endif nodef +#endif if(_udcounter - tfired < 5 || (me->p_ship.s_type != STARBASE && _udcounter - pfired < 11 + (RANDOM()%10))) return 0; Index: disengage.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/disengage.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- disengage.c 21 Mar 2005 05:23:45 -0000 1.1 +++ disengage.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -42,7 +42,7 @@ /* first try at using friends */ #ifdef nodef || (_state.closest_f && _state.closest_f->dist < 7000) -#endif nodef +#endif ) req_cloak_off("disengage: enemy farther than 10000"); @@ -50,7 +50,7 @@ /* last ditch */ if((me->p_ship.s_type != SCOUT) && MYFUEL() < 10) req_cloak_off("disengage: fuel < 10"); -#endif nodef +#endif } @@ -335,7 +335,7 @@ crs = get_pl_course(pl, &speed, &cloak); #ifdef nodef crs = get_wrapcourse(pl->pl_x, pl->pl_y); -#endif nodef +#endif if(_state.recharge_danger || (e && e->dist < 8000) || (e && e ->dist < 10000 && edang(e, 40))){ Index: input.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/input.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- input.c 21 Mar 2005 05:23:45 -0000 1.1 +++ input.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -10,9 +10,9 @@ #include <sys/types.h> #ifdef hpux #include <time.h> -#else hpux +#else #include <sys/time.h> -#endif hpux +#endif #include <signal.h> #include <errno.h> #include "defs.h" @@ -46,7 +46,7 @@ udt.it_value.tv_usec = 100000; setitimer(ITIMER_REAL, &udt, 0); signal(SIGALRM, setflag); -#endif nodef +#endif while (1) { @@ -62,7 +62,7 @@ commSwitchTimeout = 0; if (udpSock >= 0) closeUdpConn(); -#endif ATM +#endif connectToServer(nextSocket); printf("Yea! We've been resurrected!\n"); Index: packets.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/packets.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- packets.h 21 Mar 2005 05:23:45 -0000 1.1 +++ packets.h 22 Apr 2006 02:16:46 -0000 1.2 @@ -143,7 +143,7 @@ struct packet_handler { int size; - int (*handler)(); + int (*handler)(char *bufptr); }; struct mesg_spacket { Index: getname.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/getname.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- getname.c 21 Mar 2005 05:23:45 -0000 1.1 +++ getname.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -7,6 +7,7 @@ #include "copyright2.h" #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> Index: struct.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/struct.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- struct.h 10 Apr 2006 10:56:33 -0000 1.2 +++ struct.h 22 Apr 2006 02:16:46 -0000 1.3 @@ -81,7 +81,7 @@ short s_type; int s_torpspeed; }; -#endif nodef +#endif /* nodef */ struct ship { int s_turns; short s_accs; Index: rwarfare.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/rwarfare.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- rwarfare.c 21 Mar 2005 05:23:45 -0000 1.1 +++ rwarfare.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -40,7 +40,7 @@ #ifdef nodef if(dist > 5000) dist = 5000; -#endif nodef +#endif if(edist < dist){ @@ -221,7 +221,7 @@ _timers.robot_attack ++; return; } -#endif nodef +#endif _timers.robot_attack = 0; mprintf("unknown phase. %d\n", _timers.robot_attack); Index: getship.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/getship.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- getship.c 21 Mar 2005 05:23:45 -0000 1.1 +++ getship.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -295,7 +295,7 @@ shipp->s_height = 20; shipp->s_type = ATT; break; -#endif nodef +#endif default: shipp->s_turns = 170000; shipp->s_accint = 150; @@ -614,7 +614,7 @@ shipp->s_height = 20; shipp->s_type = ATT; break; -#endif nodef +#endif default: shipp->s_turns = 170000; shipp->s_accint = 150; Index: master.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/master.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- master.c 21 Mar 2005 05:23:45 -0000 1.1 +++ master.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -63,7 +63,7 @@ } } - if(connect(ms, &addr, sizeof(addr)) < 0){ + if(connect(ms, (struct sockaddr *) &addr, sizeof(addr)) < 0){ perror("connect"); close(ms); return 0; Index: dodge.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/dodge.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dodge.c 21 Mar 2005 05:23:45 -0000 1.1 +++ dodge.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -174,7 +174,7 @@ continue; else if(tdi < 8) /* torp heading our way */ _state.recharge_danger = 1; -#endif tmpNODEF +#endif /* Experimental */ if(tdi < 8 && tdist < 7000) _state.recharge_danger = 1; @@ -185,7 +185,7 @@ #ifdef nodef tx += rint(_avsdelay * tdx); ty += rint(_avsdelay * tdy); -#endif nodef +#endif tp->tp_dist = tdist; tp->tp_x = tx; @@ -357,7 +357,7 @@ #ifdef nodef !(_state.assault && _state.assault_planet == _state.hplanet) && (_state.planet != _state.hplanet) -#endif nodef +#endif unsigned char deg; int dist = _state.hpldist; @@ -649,7 +649,7 @@ tp->tp_ndir = tp->tp_dir; } } -#endif nodef +#endif for(i=0; i< _state.maxfuse; i++){ @@ -705,7 +705,7 @@ expdist = EXPDIST + (tp->tp_dist*EXPDIST)/_state.seek_const + 500; } -#endif nodef +#endif if(ABS(dx) < expdist && ABS(dy) < expdist) { int torp_d; @@ -907,7 +907,7 @@ if(_state.planet && (&planets[me->p_planet] != _state.planet)){ printf("error in getorbit_ppos: wrong planet.\n"); } -#endif nodef +#endif px = planets[me->p_planet].pl_x; py = planets[me->p_planet].pl_y; @@ -1321,7 +1321,7 @@ mindamage = INT_MAX, #ifdef nodef begin_time = mtime(0), -#endif nodef +#endif speed, crs, chklower=1, damage; int avdir; int plhit = 0; @@ -1360,7 +1360,7 @@ if(DEBUG & DEBUG_HITS){ printf("returning no hits at %d\n", hittime); } -#endif nodef +#endif Xplhit = 0; return 0; } @@ -1369,7 +1369,7 @@ /* experiment */ if(me->p_speed == 0) return nh; -#endif nodef +#endif if(d_speed < 2){ speed = 2; @@ -1405,7 +1405,7 @@ if(DEBUG & DEBUG_HITS){ printf("returning no hits at %d\n", hittime); } -#endif nodef +#endif Xplhit = 0; return 0; } @@ -1461,7 +1461,7 @@ #ifdef nodef /* need more variables */ if(minhittime < 3 && _state.det_torps < 3) /* experiment */ req_detonate(""); -#endif nodef +#endif Xplhit = plhit; return minhits; @@ -1477,7 +1477,7 @@ } return minhits; } -#endif nodef +#endif } /* NOTREACHED */ } Index: defs.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/defs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- defs.h 10 Apr 2006 10:56:33 -0000 1.3 +++ defs.h 22 Apr 2006 02:16:46 -0000 1.4 @@ -227,7 +227,7 @@ /* client version of UDPDIAG */ #define UDPDIAG(x) { if (udpDebug) { printf("UDP: "); printf x; }} #define V_UDPDIAG(x) /*UDPDIAG(x)*/ -#endif ATM +#endif #define RANDOM() rand() #define SRANDOM(x) srand(x) Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/newwin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- newwin.c 21 Mar 2005 05:23:45 -0000 1.1 +++ newwin.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -9,9 +9,9 @@ #include <sys/types.h> #ifdef hpux #include <time.h> -#else hpux +#else #include <sys/time.h> -#endif hpux +#endif #include "defs.h" #include "struct.h" #include "data.h" Index: parse.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/parse.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- parse.c 21 Mar 2005 05:23:45 -0000 1.1 +++ parse.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -77,7 +77,7 @@ #ifdef nodef printf("new info gives dam %d, shield %d, armies %d\n", PL_DAMAGE(p), PL_SHIELD(p), p->armies); -#endif nodef +#endif /* decide on escort */ Index: main.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- main.c 21 Mar 2005 10:17:17 -0000 1.2 +++ main.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -4,6 +4,8 @@ #include "copyright.h" #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> #include <string.h> #include <sys/types.h> #include <signal.h> @@ -255,7 +257,7 @@ argv++; argc--; break; -#endif nodef +#endif case 'q': noargs ++; break; Index: redraw.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/redraw.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- redraw.c 21 Mar 2005 05:23:45 -0000 1.1 +++ redraw.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -152,4 +152,4 @@ } } } -#endif nodef +#endif Index: dmessage.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/dmessage.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dmessage.c 21 Mar 2005 10:17:17 -0000 1.2 +++ dmessage.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -1113,7 +1113,7 @@ udpaction(UDP_UPDATE_ALL); response("Sending udp update-all req"); } -#endif ATM +#endif #ifdef SHORT_PACKETS else if(strncmp(m, "shortp", 6)==0){ if(recv_short) @@ -1752,7 +1752,7 @@ fprintf(stderr, "unknown UDP command\n"); } } -#endif ATM +#endif setlog(dir) Index: engage.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/engage.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- engage.c 21 Mar 2005 05:23:45 -0000 1.1 +++ engage.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -632,7 +632,7 @@ case STARBASE: break; } -#endif nodef +#endif if(e_dist < hispr){ if(DEBUG & DEBUG_ENGAGE){ @@ -773,7 +773,7 @@ /* right edge */ *crs = get_course( /* HERE */ -#endif nodef +#endif } /* based on get_torp_course */ Index: update_players.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/update_players.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- update_players.c 21 Mar 2005 05:23:45 -0000 1.1 +++ update_players.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -1,4 +1,5 @@ #include <stdio.h> +#include <string.h> #include <limits.h> #include <math.h> #include <sys/types.h> @@ -215,7 +216,7 @@ #ifdef nodef if(DEBUG & DEBUG_ENEMY) print_player(p); -#endif nodef +#endif p->p_x = j->p_x; /* last x */ p->p_y = j->p_y; /* last y */ @@ -249,7 +250,7 @@ _state.p_subspeed, _state.p_subdir, _state.sp_subspeed - _state.p_subspeed, _state.sp_subdir - _state.p_subspeed); -#endif nodef +#endif /* update my information */ _state.last_x = me->p_x; @@ -333,7 +334,7 @@ } } } -#endif nodef +#endif if(j->p_flags & PFORBIT){ j->p_planet = planet_from_ppos(j); @@ -347,7 +348,7 @@ printf("%s orbiting %s\n", j->p_name, planets[j->p_planet].pl_name); } -#endif nodef +#endif } else p->pl_armies = 0; @@ -433,7 +434,7 @@ pl->pl_name); printf("%s(%d) has %d armies.\n", j->p_name, j->p_no, p->armies); -#endif nodef +#endif } else{ p->armies += (pa - pl->pl_armies); @@ -444,7 +445,7 @@ pl->pl_name); printf("%s(%d) has %d armies.\n", j->p_name, j->p_no, p->armies); -#endif nodef +#endif } } else{ @@ -459,7 +460,7 @@ pl->pl_name); printf("%s(%d) has %d armies.\n", j->p_name, j->p_no, p->armies); -#endif nodef +#endif } } if(p->armies < 0) p->armies = 0; @@ -1229,7 +1230,7 @@ else if(p->p == me && dist < 6000){ printf("dens: NOT attacking %s\n", en->p_mapchars); } -#endif nodef +#endif } } } @@ -1256,7 +1257,7 @@ } printf("\n"); } -#endif nodef +#endif } calc_attackdiff() @@ -1308,7 +1309,7 @@ #ifdef nodef /* tmp */ printf("att %d, def %d\n", at, df); -#endif nodef +#endif } /* SSS: speed critical */ @@ -1366,7 +1367,7 @@ #ifdef nodef printf("choosing invisible player with hp %s (%d,%d)\n", hp->pl_name, hp->pl_x, hp->pl_y); -#endif nodef +#endif p->invisible = 0; /* xx */ } return p; @@ -1396,7 +1397,7 @@ #ifdef nodef printf("choosing invisible player with hp %s (%d,%d)\n", hp->pl_name, hp->pl_x, hp->pl_y); -#endif nodef +#endif p->invisible = 0; /* xx */ } } Index: death.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/death.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- death.c 21 Mar 2005 05:23:45 -0000 1.1 +++ death.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -9,9 +9,9 @@ #include <sys/types.h> #ifdef hpux #include <time.h> -#else hpux +#else #include <sys/time.h> -#endif hpux +#endif #include "defs.h" #include "struct.h" #include "data.h" @@ -39,7 +39,7 @@ udt.it_value.tv_usec = 0; setitimer(ITIMER_REAL, &udt, 0); signal(SIGALRM, SIG_DFL); -#endif nodef +#endif switch (me->p_whydead) { case KQUIT: Index: decide.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/decide.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- decide.c 21 Mar 2005 10:17:17 -0000 1.2 +++ decide.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -82,7 +82,7 @@ return; else check_refit(); -#endif nodef +#endif return; } @@ -296,7 +296,7 @@ if(MYDAMAGE() > 25 || MYFUEL() < 60) disengage_c(EDAMAGE, NULL); } -#endif nodef +#endif if(MYDAMAGE() > 75) disengage_c(EDAMAGE, NULL, "dam > 75"); @@ -574,7 +574,7 @@ #ifdef nodef /* tmp */ return 0; -#endif nodef +#endif if(pls->total_wextra_armies == 0) return 0; Index: warfare.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/warfare.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- warfare.c 21 Mar 2005 05:23:45 -0000 1.1 +++ warfare.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -40,7 +40,7 @@ dgo = 0; return; } -#endif nodef +#endif if(!isAlive(me)) return; @@ -316,7 +316,7 @@ printf("%s not orbiting anything.\n", j->p_name); */ return -1; -#endif NO_PFORBIT +#endif for(i=0, pl=planets; i < MAXPLANETS; i++, pl++){ if(ABS(pl->pl_x - j->p_x) < 5000 && ABS(pl->pl_y - j->p_y) < 5000) @@ -350,5 +350,5 @@ return 0; } return 1; -#endif nodef +#endif } Index: getarmies.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/getarmies.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- getarmies.c 21 Mar 2005 05:23:45 -0000 1.1 +++ getarmies.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -236,7 +236,7 @@ #ifdef nodef if(k == pl) continue; -#endif nodef +#endif if(k->pl_armies < 5) continue; @@ -244,13 +244,13 @@ p = get_nearest_to_pl_dist(k, &hdist); if(p && (hdist < 6000 || (hdist < 15000 && edang(p, 64)))) continue; -#endif nodef +#endif #ifdef nodef dx = k->pl_x - me->p_x; dy = k->pl_y - me->p_y; pdist = (int)ihypot(dx,dy); -#endif nodef +#endif pdist = k->pl_mydist; if(pdist < mdist){ Index: reserved.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/reserved.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- reserved.c 21 Mar 2005 05:23:45 -0000 1.1 +++ reserved.c 22 Apr 2006 02:16:46 -0000 1.2 @@ -4,6 +4,8 @@ */ #include "copyright2.h" #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> Index: socket.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/socket.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- socket.c 21 Mar 2005 10:17:17 -0000 1.2 +++ socket.c 22 Apr 2006 02:16:46 -0000 1.3 @@ -8,6 +8,8 @@ #include "copyright2.h" #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <math.h> #include <errno.h> #include <sys/types.h> @@ -37,7 +39,7 @@ #define DEBUG_SOCKET(p) printf("%s at %d\n", p, mtime(1)-_read_time); static int _read_time; -#endif DEBUG_SCK +#endif static int rsock_failed; static int debug; @@ -56,11 +58,10 @@ int handleReserved(); int handleScan(), handleUdpReply(), handleSequence(); int handleMasterComm(); -extern int exit(); #ifdef ATM int handleUdpReply(), handleSequence(); int handleScan(); -#endif ATM +#endif /* ATM */ #ifdef PING int handlePing(); /* ping.c */ @@ -98,32 +99,32 @@ #ifdef SCANNERS { sizeof(struct scan_spacket), handleScan }, /* SP_SCAN */ #else - { 0, exit}, + { 0, NULL }, #endif - { sizeof(struct udp_reply_spacket), handleUdpReply }, /* SP_UDP_STAT */ + { sizeof(struct udp_reply_spacket), handleUdpReply }, /* SP_UDP_STAT */ { sizeof(struct sequence_spacket), handleSequence }, /* SP_SEQUENCE */ { sizeof(struct sc_sequence_spacket), handleSequence }, /* SP_SC_SEQUENCE */ -#endif ATM +#endif #ifdef RSA - { sizeof(struct rsa_key_spacket), handleRSAKey }, /* SP_RSA_KEY */ + { sizeof(struct rsa_key_spacket), handleRSAKey }, /* SP_RSA_KEY */ #else - { 0, exit}, /* #31, and exit won't really be called */ + { 0, NULL }, /* #31 */ #endif - { 0, exit}, /* 32 */ - { 0, exit}, /* 33 */ - { 0, exit}, /* 34 */ - { 0, exit}, /* 35 */ - { 0, exit}, /* 36 */ - { 0, exit}, /* 37 */ - { 0, exit}, /* 38 */ - { 0, exit}, /* 39 */ - { 0, exit}, /* 40 */ - { 0, exit}, /* 41 */ - { 0, exit}, /* 42 */ - { 0, exit}, /* 43 */ - { 0, exit}, /* 44 */ + { 0, NULL }, /* 32 */ + { 0, NULL }, /* 33 */ + { 0, NULL }, /* 34 */ + { 0, NULL }, /* 35 */ + { 0, NULL }, /* 36 */ + { 0, NULL }, /* 37 */ + { 0, NULL }, /* 38 */ + { 0, NULL }, /* 39 */ + { 0, NULL }, /* 40 */ + { 0, NULL }, /* 41 */ + { 0, NULL }, /* 42 */ + { 0, NULL }, /* 43 */ + { 0, NULL }, /* 44 */ #ifdef PING - { 0, exit}, /* 45 */ + { 0, NULL }, /* 45 */ { sizeof(struct ping_spacket), handlePing }, /* SP_PING */ #endif { sizeof(struct mastercomm_spacket), handleMasterComm },/* SP_MASTER_COMM */ @@ -173,7 +174,7 @@ #endif sizeof(struct udp_req_cpacket), /* CP_UDP_REQ */ sizeof(struct sequence_cpacket), /* CP_SEQUENCE */ -#endif ATM +#endif #ifdef RSA sizeof(struct rsa_key_cpacket), /* CP_RSA_KEY */ #else @@ -291,7 +292,7 @@ FCHECK_TRACT(PFTRACT, fTractor, CP_TRACTOR); FCHECK_TRACT(PFPRESS, fRepress, CP_REPRESS); } -#endif ATM +#endif /* ATM */ connectToServer(port) int port; @@ -299,7 +300,7 @@ int s; struct sockaddr_in addr; struct sockaddr_in naddr; - int len; + socklen_t addrlen; fd_set readfds; struct timeval timeout; struct hostent *hp; @@ -325,11 +326,11 @@ addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = htons(port); - if (bind(s, &addr, sizeof(addr)) < 0) { + if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { sleep(10); - if (bind(s, &addr, sizeof(addr)) < 0) { + if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { sleep(10); - if (bind(s, &addr, sizeof(addr)) < 0) { + if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { printf("I can't bind to port!\n"); exit(3); } @@ -338,7 +339,7 @@ listen(s,1); - len=sizeof(naddr); + addrlen=sizeof(naddr); tryagain: timeout.tv_sec=240; /* four minutes */ @@ -350,7 +351,7 @@ exit(0); } - sock=accept(s,&naddr,&len); + sock=accept(s,(struct sockaddr *)&naddr,&addrlen); if (sock==-1) { extern int errno; @@ -368,8 +369,8 @@ * caller is, and set "serverName" and "serveraddr" appropriately. * (ATM) */ - len = sizeof(struct sockaddr_in); - if (getpeername(sock, (struct sockaddr *) &addr, &len) < 0) { + addrlen = sizeof(struct sockaddr_in); + if (getpeername(sock, (struct sockaddr *) &addr, &addrlen) < 0) { perror("unable to get peername"); serverName = "nowhere"; } else { @@ -435,10 +436,10 @@ } } - if (connect(ns, &addr, sizeof(addr)) < 0) { + if (connect(ns, (struct sockaddr *) &addr, sizeof(addr)) < 0) { #ifdef nodef printf("rwatch: I cannot connect through port %d\n", port); -#endif nodef +#endif close(ns); return 0; } @@ -501,7 +502,7 @@ printf("SO_SNDBUF: %d\n", optval); printf("optlen: %d\n", optlen); } -#endif nodef +#endif addr.sin_family = AF_INET; @@ -518,9 +519,9 @@ #ifdef ATM serveraddr = addr.sin_addr.s_addr; -#endif ATM +#endif - if (connect(s, &addr, sizeof(addr)) < 0) { + if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { printf("Server not listening!\n"); exit(0); } @@ -547,7 +548,7 @@ #ifdef ATM if(udpSock >= 0) FD_SET(udpSock, &readfds); -#endif ATM +#endif select(32,&readfds,0,0,&timeout); } @@ -654,7 +655,7 @@ addr.sin_addr.s_addr = serveraddr; addr.sin_port = htons(udpServerPort); addr.sin_family = AF_INET; - if (connect(udpSock, &addr, sizeof(addr)) < 0) { + if (connect(udpSock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { perror("connect"); UDPDIAG(("Unable to reconnect\n")); /* and fall through to disconnect */ @@ -776,7 +777,7 @@ if (select(32,&readfds,0,0,&timeout) != 0) { #ifdef DEBUG_SCK _read_time = mtime(1); -#endif DEBUG_SCK +#endif /* Read info from the xtrek server */ if(FD_ISSET(sock, &readfds){ @@ -877,7 +878,7 @@ } return 0; } -#endif ATM +#endif handleTorp(packet) struct torp_spacket *packet; @@ -889,7 +890,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handleTorp"); -#endif DEBUG_SCK +#endif thetorp= &torps[ntohs(packet->tnum)]; @@ -1004,7 +1005,7 @@ torps_time[j->p_no]); torps_time[j->p_no] = mtime(1); } -#endif TORP_TIME +#endif p->fuel -= SH_TORPCOST(j); if(p->fuel < 0) p->fuel = 0; if(j == me){ @@ -1045,11 +1046,11 @@ #ifdef TORP_TIME static int torps_time[MAXPLAYER]; -#endif TORP_TIME +#endif #ifdef DEBUG_SCK DEBUG_SOCKET("handleTorpInfo"); -#endif DEBUG_SCK +#endif thetorp= &torps[ntohs(packet->tnum)]; @@ -1057,7 +1058,7 @@ if(packet->status == TEXPLODE && thetorp->t_status == TFREE){ return; } -#endif ATM +#endif p = &_state.players[thetorp->t_owner]; j = &players[thetorp->t_owner]; @@ -1078,7 +1079,7 @@ torps_time[j->p_no]); torps_time[j->p_no] = mtime(1); } -#endif TORP_TIME +#endif p->fuel -= SH_TORPCOST(j); p->wpntemp += SH_TORPCOST(j)/10 - 10; if(p->fuel < 0) p->fuel = 0; @@ -1114,7 +1115,7 @@ j->p_ntorp--; /* torp damage handled in dodge.c */ } -#endif nodef +#endif } handleStatus(packet) @@ -1122,7 +1123,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleStatus"); -#endif DEBUG_SCK +#endif if(ignoreTMode) { status->tourn=1; } else { @@ -1141,7 +1142,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleSelf"); -#endif DEBUG_SCK +#endif me= &players[packet->pnum]; me_p = &_state.players[packet->pnum]; myship = &(me->p_ship); @@ -1164,7 +1165,7 @@ #ifdef nodef /* tmp */ else me->p_tractor = -1; -#endif nodef +#endif #endif } @@ -1207,7 +1208,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlayer"); -#endif DEBUG_SCK +#endif pl= &players[packet->pnum]; p = &_state.players[packet->pnum]; if(_state.borg_detect){ @@ -1243,7 +1244,7 @@ #ifdef TMP pl->p_updates = ntohl(packet->updates); -#endif TMP +#endif redrawPlayer[packet->pnum]=1; } @@ -1314,13 +1315,13 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleWarning"); -#endif DEBUG_SCK +#endif warning(packet->mesg, 0); #ifdef nodef if(strncmp(packet->mesg, "Phasers", 7) == 0) _state.lastphaserreq = 0; -#endif nodef +#endif } sendShortPacket(type, state) @@ -1373,7 +1374,7 @@ } } } -#endif ATM +#endif } #ifdef ATM @@ -1456,7 +1457,7 @@ packets_sent ++; #endif V_UDPDIAG(("Sent %d on UDP port\n", packet->type)); - if (gwrite(udpSock, packet, size) != size) { + if (gwrite(udpSock, (char *) packet, size) != size) { UDPDIAG(("gwrite on UDP failed. Closing UDP connection\n")); warning("UDP link severed"); /*serverDead=1;*/ @@ -1477,7 +1478,7 @@ } } } -#endif ATM +#endif handlePlanet(packet) struct planet_spacket *packet; @@ -1486,7 +1487,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlanet"); -#endif DEBUG_SCK +#endif plan= &planets[packet->pnum]; @@ -1540,7 +1541,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePhaser"); -#endif DEBUG_SCK +#endif } handleMessage(packet) @@ -1548,7 +1549,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleMessage"); -#endif DEBUG_SCK +#endif if (packet->m_from >= MAXPLAYER) packet->m_from=255; dmessage(packet->mesg, packet->m_flags, packet->m_from, packet->m_recpt); } @@ -1558,7 +1559,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleQueue"); -#endif DEBUG_SCK +#endif queuePos = ntohs(packet->pos); } @@ -1579,7 +1580,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handlePickok"); -#endif DEBUG_SCK +#endif pickOk=packet->state; mprintf("got pickOk = %d\n", pickOk); } @@ -1606,7 +1607,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleLogin"); -#endif DEBUG_SCK +#endif loginAccept=packet->accept; if (packet->accept) { bcopy(packet->keymap, mystats->st_keymap, 96); @@ -1636,7 +1637,7 @@ fTractor = pnum | 0x40; else fTractor = 0; -#endif ATM +#endif } @@ -1656,7 +1657,7 @@ fRepress = pnum | 0x40; else fRepress = 0; -#endif ATM +#endif } @@ -1679,14 +1680,14 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlasmaInfo"); -#endif DEBUG_SCK +#endif thetorp= &plasmatorps[ntohs(packet->pnum)]; #ifdef ATM if(packet->status == PTEXPLODE && thetorp->pt_status == PTFREE){ return; } -#endif ATM +#endif p = &_state.players[thetorp->pt_owner]; j = &players[thetorp->pt_owner]; @@ -1721,7 +1722,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlasma"); -#endif DEBUG_SCK +#endif thetorp= &plasmatorps[ntohs(packet->pnum)]; /* plasmas seek */ @@ -1742,7 +1743,7 @@ unsigned int pflags; #ifdef DEBUG_SCK DEBUG_SOCKET("handleFlags"); -#endif DEBUG_SCK +#endif j = &players[packet->pnum]; redrawPlayer[packet->pnum]=1; @@ -1772,7 +1773,7 @@ #ifdef nodef else players[packet->pnum].p_tractor = -1; -#endif nodef +#endif #endif } @@ -1782,7 +1783,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleKills"); -#endif DEBUG_SCK +#endif players[packet->pnum].p_kills=ntohl(packet->kills)/100.0; updatePlayer[packet->pnum]=1; } @@ -1792,7 +1793,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handlePStatus"); -#endif DEBUG_SCK +#endif if (packet->status==PEXPLODE) { /* printf("%s exploding.\n", players[packet->pnum].p_name); @@ -1808,7 +1809,7 @@ if (packet->status==PDEAD) { mprintf("%s dead.\n", players[packet->pnum].p_name); } -#endif nodef +#endif players[packet->pnum].p_status=packet->status; redrawPlayer[packet->pnum]=1; @@ -1820,10 +1821,10 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleMotd"); -#endif DEBUG_SCK +#endif #ifdef nodef newMotdLine(packet->line); -#endif nodef +#endif } sendMessage(mes, group, indiv) @@ -1844,7 +1845,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleMask"); -#endif DEBUG_SCK +#endif tournMask=packet->mask; } @@ -1879,7 +1880,7 @@ sockPack.version=(char) SOCKVERSION; #ifdef ATM sockPack.udp_version=(char) UDPVERSION; -#endif ATM +#endif sendServerPacket(&sockPack); /* Did we get new socket # sent? */ if (serverDead) return; @@ -1891,7 +1892,7 @@ { #ifdef DEBUG_SCK DEBUG_SOCKET("handleBadVersion"); -#endif DEBUG_SCK +#endif switch(packet->why) { case 0: printf("Sorry, this is an invalid client version.\n"); @@ -1922,7 +1923,7 @@ perror("write"); printUdpInfo(); } -#endif ATM +#endif return(-1); } bytes -= n; @@ -1938,7 +1939,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handleHostile"); -#endif DEBUG_SCK +#endif updatePlayer[packet->pnum]=1; pl= &players[packet->pnum]; pl->p_swar=packet->war; @@ -1953,7 +1954,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlyrLogin"); -#endif DEBUG_SCK +#endif updatePlayer[packet->pnum]=1; pl= &players[packet->pnum]; @@ -1983,7 +1984,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handleStats"); -#endif DEBUG_SCK +#endif updatePlayer[packet->pnum]=1; pl= &players[packet->pnum]; pl->p_stats.st_tkills=ntohl(packet->tkills); @@ -2009,7 +2010,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlyrInfo"); -#endif DEBUG_SCK +#endif updatePlayer[packet->pnum]=1; pl= &players[packet->pnum]; getship(&pl->p_ship, packet->shiptype); @@ -2023,7 +2024,7 @@ calibrate_stats(); redrawTstats(); } -#endif nodef +#endif redrawPlayer[packet->pnum]=1; } @@ -2126,7 +2127,7 @@ #ifdef DEBUG_SCK DEBUG_SOCKET("handlePlanetLoc"); -#endif DEBUG_SCK +#endif pl= &planets[packet->pnum]; pl->pl_x=ntohl(packet->x); pl->pl_y=ntohl(packet->y); @@ -2145,11 +2146,11 @@ /* TMP */ #ifdef nodef testcl(packet, &response); -#endif nodef +#endif #ifdef DEBUG_SCK DEBUG_SOCKET("handleReserved"); -#endif DEBUG_SCK +#endif if(_state.do_reserved) encryptReservedPacket(packet, &response, serverName, me->p_no); sendServerPacket(&response); @@ -2175,7 +2176,7 @@ packet.wtemp = j->p_wtemp; packet.whydead = j->p_whydead; packet.whodead = j->p_whodead; -#endif nodef +#endif /* XXX */ #ifdef VIS_TRACTOR @@ -2195,7 +2196,7 @@ int s; { if(rsock != -1) - gwrite(rsock, p, s); + gwrite(rsock, (char *) p, s); } #ifdef SCANNERS @@ -2414,7 +2415,7 @@ } #ifdef nodef set_udp_opts(udpSock); -#endif nodef +#endif addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = AF_INET; @@ -2433,7 +2434,7 @@ } #endif addr.sin_port = htons(udpLocalPort); - if (bind(udpSock, &addr, sizeof(addr)) >= 0) + if (bind(udpSock, (struct sockaddr *) &addr, sizeof(addr)) >= 0) break; } if (attempts == MAX_PORT_RETRY) { @@ -2489,7 +2490,8 @@ struct timeval to; struct sockaddr_in from; struct sockaddr_in addr; - int fromlen, res; + socklen_t fromlen; + int res; bzero(&from, sizeof(from)); /* don't get garbage if really broken */ @@ -2517,7 +2519,7 @@ } } - if (recvfrom(udpSock, _buf, BUFSIZ, 0, &from, &fromlen) < 0) { + if (recvfrom(udpSock, _buf, BUFSIZ, 0, (struct sockaddr *) &from, &fromlen) < 0) { perror("recvfrom"); UDPDIAG(("recvfrom failed, aborting UDP attempt")); return (-1); @@ -2540,7 +2542,7 @@ } #endif - if (connect(udpSock, &from, sizeof(from)) < 0) { + if (connect(udpSock, (struct sockaddr *) &from, sizeof(from)) < 0) { perror("netrek: unable to connect UDP socket after recvfrom()"); close(udpSock); udpSock = -1; @@ -2568,17 +2570,17 @@ printUdpInfo() { struct sockaddr_in addr; - int len; + socklen_t len; len = sizeof(addr); - if (getsockname(udpSock, &addr, &len) < 0) { + if (getsockname(udpSock, (struct sockaddr *) &addr, &len) < 0) { /* perror("printUdpInfo: getsockname");*/ return; } UDPDIAG(("LOCAL: addr=0x%x, family=%d, port=%d\n", addr.sin_addr.s_addr, addr.sin_family, ntohs(addr.sin_port))); - if (getpeername(udpSock, &addr, &len) < 0) { + if (getpeername(udpSock, (struct sockaddr *) &addr, &len) < 0) { /* perror("printUdpInfo: getpeername");*/ return; } @@ -2649,7 +2651,7 @@ recent_count = recent_dropped = 0; } } -#endif ATM +#endif handleMasterComm(packet)