Date: Thursday April 26, 2001 @ 18:41 Author: cameron Update of /home/netrek/cvsroot/Vanilla/robotd In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv18356/robotd Modified Files: assault.c data.c data.h decide.c disengage.c dmessage.c dodge.c engage.c escort.c getarmies.c getname.c master.c ogg.c parse.c pwarfare.c redraw.c robot.c rwarfare.c ships.c socket.c update_planets.c update_players.c util.c warfare.c Log Message: Fri Apr 27 09:33:55 2001 Benjamin `Quisar' Lerman <quisar at quisar.ambre.net> * robotd: Changed in robotd values.h to limits.h and MAXINT to INT_MAX (more portable). Message-ID: <20010426003724.A2590 at hell.ambre.net> **************************************** Index: Vanilla/robotd/assault.c diff -u Vanilla/robotd/assault.c:1.1 Vanilla/robotd/assault.c:1.2 --- Vanilla/robotd/assault.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/assault.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -375,7 +375,7 @@ int avcrs; Player *ce = _state.closest_e; int ad; - int mcd = MAXINT, cd; + int mcd = INT_MAX, cd; int dam; *cloak = 0; Index: Vanilla/robotd/data.c diff -u Vanilla/robotd/data.c:1.1 Vanilla/robotd/data.c:1.2 --- Vanilla/robotd/data.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/data.c Thu Apr 26 18:41:50 2001 @@ -63,7 +63,7 @@ int _master_sock = -1; int sock= -1; int rsock = -1; -int poll=0; +int pollmode=0; int expltest=0; char rw_host[80]; int xtrekPort=2592; Index: Vanilla/robotd/data.h diff -u Vanilla/robotd/data.h:1.1 Vanilla/robotd/data.h:1.2 --- Vanilla/robotd/data.h:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/data.h Thu Apr 26 18:41:50 2001 @@ -74,7 +74,7 @@ extern int _master_sock; extern int sock; extern int rsock; -extern int poll; +extern int pollmode; extern int expltest; extern char rw_host[]; extern int xtrekPort; Index: Vanilla/robotd/decide.c diff -u Vanilla/robotd/decide.c:1.1 Vanilla/robotd/decide.c:1.2 --- Vanilla/robotd/decide.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/decide.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -227,7 +227,7 @@ decide_bomb() { struct planet *pl = me_p->closest_pl; - int dist = pl?pl->pl_mydist:MAXINT; + int dist = pl?pl->pl_mydist:INT_MAX; if(!pl) return; @@ -468,7 +468,7 @@ register i,j; register Player *p; int plc[MAXPLANETS]; - int min_p = MAXINT-1; + int min_p = INT_MAX-1; struct planet *defp = NULL, *cp; int armycount = 1; @@ -740,7 +740,7 @@ { register Player *p, *op = NULL; register i; - int mindist = MAXINT; + int mindist = INT_MAX; Player *co = _state.current_target; for(i=0, p =_state.players; i< MAXPLAYER; i++,p++){ Index: Vanilla/robotd/disengage.c diff -u Vanilla/robotd/disengage.c:1.1 Vanilla/robotd/disengage.c:1.2 --- Vanilla/robotd/disengage.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/disengage.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -207,7 +207,7 @@ register i,j, c = 0; register Player *p, *sb = NULL; - *dist = MAXINT; + *dist = INT_MAX; if(me->p_ship.s_type == STARBASE) return NULL; Index: Vanilla/robotd/dmessage.c diff -u Vanilla/robotd/dmessage.c:1.3 Vanilla/robotd/dmessage.c:1.4 --- Vanilla/robotd/dmessage.c:1.3 Tue May 23 20:18:21 2000 +++ Vanilla/robotd/dmessage.c Thu Apr 26 18:41:50 2001 @@ -1126,8 +1126,8 @@ exitRobot(0); } else if(strncmp(m, "poll", 4)==0){ - poll = !poll; - sprintf(buf, "poll %s", poll?"on":"off"); + pollmode = !pollmode; + sprintf(buf, "poll %s", pollmode?"on":"off"); response(buf); } else if(strncmp(m, "expltest", 8)==0){ Index: Vanilla/robotd/dodge.c diff -u Vanilla/robotd/dodge.c:1.1 Vanilla/robotd/dodge.c:1.2 --- Vanilla/robotd/dodge.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/dodge.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -428,7 +428,7 @@ register i; int hits; int avdir= -1, hittime, damage; - register mindamage = MAXINT, cavdir; + register mindamage = INT_MAX, cavdir; hits = update_torps(&avdir, d_crs, d_speed, &hittime, &damage, lvorbit); @@ -630,7 +630,7 @@ hits = 0; damage = 0; - minhittime = MAXINT; + minhittime = INT_MAX; _plhit = 0; if(!_state.torp_wobble) @@ -923,7 +923,7 @@ register i; register struct planet *pl; double dx,dy; - register int pdist, mindist = MAXINT; + register int pdist, mindist = INT_MAX; _state.hplanet = NULL; _state.hpldist = GWIDTH; @@ -1317,8 +1317,8 @@ int *lvorbit; { register i, nh; - int hittime, minhits = MAXINT, minhittime = MAXINT, - mindamage = MAXINT, + int hittime, minhits = INT_MAX, minhittime = INT_MAX, + mindamage = INT_MAX, #ifdef nodef begin_time = mtime(0), #endif nodef @@ -1328,7 +1328,7 @@ *crs_r = d_crs; *speed_r = d_speed; - *hittime_r = MAXINT; + *hittime_r = INT_MAX; speed = d_speed; Index: Vanilla/robotd/engage.c diff -u Vanilla/robotd/engage.c:1.1 Vanilla/robotd/engage.c:1.2 --- Vanilla/robotd/engage.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/engage.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -426,7 +426,7 @@ int *rdist; { register int i, dist; - int mdist = MAXINT; + int mdist = INT_MAX; register struct player *j; register Player *e, *ce = NULL; double dx,dy; @@ -452,7 +452,7 @@ int *d; { register int i,dist; - int mdist = MAXINT; + int mdist = INT_MAX; register struct player *j; register Player *e, *ce = NULL; double dx,dy; Index: Vanilla/robotd/escort.c diff -u Vanilla/robotd/escort.c:1.1 Vanilla/robotd/escort.c:1.2 --- Vanilla/robotd/escort.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/escort.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/getarmies.c diff -u Vanilla/robotd/getarmies.c:1.2 Vanilla/robotd/getarmies.c:1.3 --- Vanilla/robotd/getarmies.c:1.2 Sun Mar 5 09:56:48 2000 +++ Vanilla/robotd/getarmies.c Thu Apr 26 18:41:50 2001 @@ -1,6 +1,6 @@ #include <stdio.h> #include <ctype.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -225,7 +225,7 @@ { register i; register struct planet *k, *mp = NULL; - int mdist = MAXINT, pdist, hdist; + int mdist = INT_MAX, pdist, hdist; Player *p, *get_nearest_to_pl_dist(); double dx,dy; unsigned char pcrs; Index: Vanilla/robotd/getname.c diff -u Vanilla/robotd/getname.c:1.1 Vanilla/robotd/getname.c:1.2 --- Vanilla/robotd/getname.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/getname.c Thu Apr 26 18:41:50 2001 @@ -16,7 +16,6 @@ #include "defs.h" #include "struct.h" #include "data.h" -long time(); renter(pseudo, pss, log) char *pseudo, *pss, *log; Index: Vanilla/robotd/master.c diff -u Vanilla/robotd/master.c:1.1 Vanilla/robotd/master.c:1.2 --- Vanilla/robotd/master.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/master.c Thu Apr 26 18:41:50 2001 @@ -12,7 +12,7 @@ #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> -#include <values.h> +#include <limits.h> #include <math.h> #include "defs.h" #include "struct.h" Index: Vanilla/robotd/ogg.c diff -u Vanilla/robotd/ogg.c:1.1 Vanilla/robotd/ogg.c:1.2 --- Vanilla/robotd/ogg.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/ogg.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/parse.c diff -u Vanilla/robotd/parse.c:1.2 Vanilla/robotd/parse.c:1.3 --- Vanilla/robotd/parse.c:1.2 Sun Mar 5 10:09:53 2000 +++ Vanilla/robotd/parse.c Thu Apr 26 18:41:50 2001 @@ -1,7 +1,7 @@ #include <stdio.h> #include <string.h> #include <strings.h> -#include <values.h> +#include <limits.h> #include <ctype.h> #include <math.h> #include <sys/types.h> Index: Vanilla/robotd/pwarfare.c diff -u Vanilla/robotd/pwarfare.c:1.1 Vanilla/robotd/pwarfare.c:1.2 --- Vanilla/robotd/pwarfare.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/pwarfare.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/redraw.c diff -u Vanilla/robotd/redraw.c:1.1 Vanilla/robotd/redraw.c:1.2 --- Vanilla/robotd/redraw.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/redraw.c Thu Apr 26 18:41:50 2001 @@ -25,7 +25,7 @@ _tcheck = 0; keep_reading: ; - if (readFromServer(poll)) { /* should be 0 */ + if (readFromServer(pollmode)) { /* should be 0 */ cr_time = mtime(0); @@ -49,7 +49,7 @@ * We haven't heard from server for 3 secs... Strategy: send a * useless packet to "ping" server. */ - if(!poll){ + if(!pollmode){ int now = time(NULL)-3; mprintf("sending wakeup packet at %s", ctime(&now)); sendWarReq(me->p_hostile); Index: Vanilla/robotd/robot.c diff -u Vanilla/robotd/robot.c:1.1 Vanilla/robotd/robot.c:1.2 --- Vanilla/robotd/robot.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/robot.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -885,7 +885,7 @@ register k; struct planet *pl, *cpl=NULL; Player *p; - int pdist, mindist=MAXINT, ed; + int pdist, mindist=INT_MAX, ed; unsigned char pcrs; int fl, dm, nonhostile; Index: Vanilla/robotd/rwarfare.c diff -u Vanilla/robotd/rwarfare.c:1.1 Vanilla/robotd/rwarfare.c:1.2 --- Vanilla/robotd/rwarfare.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/rwarfare.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/ships.c diff -u Vanilla/robotd/ships.c:1.1 Vanilla/robotd/ships.c:1.2 --- Vanilla/robotd/ships.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/ships.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/socket.c diff -u Vanilla/robotd/socket.c:1.1 Vanilla/robotd/socket.c:1.2 --- Vanilla/robotd/socket.c:1.1 Tue Feb 22 16:49:30 2000 +++ Vanilla/robotd/socket.c Thu Apr 26 18:41:50 2001 @@ -553,9 +553,9 @@ static char _buf[BUFSIZ*2]; #ifdef ATM -readFromServer(poll) +readFromServer(pollmode) - int poll; + int pollmode; { struct timeval timeout; fd_set readfds; @@ -564,7 +564,7 @@ if (serverDead) return(0); if (commMode == COMM_TCP) drop_flag=0; /* just in case */ - if(!poll){ + if(!pollmode){ timeout.tv_sec=3; timeout.tv_usec=0; } Index: Vanilla/robotd/update_planets.c diff -u Vanilla/robotd/update_planets.c:1.1 Vanilla/robotd/update_planets.c:1.2 --- Vanilla/robotd/update_planets.c:1.1 Tue Feb 22 16:49:31 2000 +++ Vanilla/robotd/update_planets.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> Index: Vanilla/robotd/update_players.c diff -u Vanilla/robotd/update_players.c:1.1 Vanilla/robotd/update_players.c:1.2 --- Vanilla/robotd/update_players.c:1.1 Tue Feb 22 16:49:31 2000 +++ Vanilla/robotd/update_players.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> @@ -24,7 +24,7 @@ register struct player *j, *closest = NULL; register Player *p, *ce = NULL, *cf = NULL, *ct = NULL; register i; - int mce = MAXINT, mcf = MAXINT, mct = MAXINT, d; + int mce = INT_MAX, mcf = INT_MAX, mct = INT_MAX, d; int pldist; int predictx, predicty, rx,ry; Player *nt; @@ -1174,7 +1174,7 @@ if(p->p == me) bzero(_state.attacking_newdir, sizeof(_state.attacking_newdir)); for(j=0; j< MAXPLAYER; j++) - p->distances[j] = MAXINT; + p->distances[j] = INT_MAX; } for(i=0, p= _state.players; i < MAXPLAYER; i++, p++){ @@ -1321,7 +1321,7 @@ { register k; register struct planet *pl, *rp = NULL; - register d, mdist = MAXINT; + register d, mdist = INT_MAX; if(opl && (mdist = ihypot((double)(j->p_x - opl->pl_x), (double)(j->p_y - opl->pl_y))) < 3000){ @@ -1329,7 +1329,7 @@ return opl; } - *dist = MAXINT; + *dist = INT_MAX; for(k=0, pl=planets; k < MAXPLANETS; k++, pl++){ Index: Vanilla/robotd/util.c diff -u Vanilla/robotd/util.c:1.2 Vanilla/robotd/util.c:1.3 --- Vanilla/robotd/util.c:1.2 Sun Mar 5 09:56:48 2000 +++ Vanilla/robotd/util.c Thu Apr 26 18:41:50 2001 @@ -418,7 +418,7 @@ return (x2 + y2 - (((x2>y2) ? y2 : x2) >> 1) ); } -#if defined(mips) || defined(linux) +#if ! HAVE_NINT nint(x) double x; Index: Vanilla/robotd/warfare.c diff -u Vanilla/robotd/warfare.c:1.1 Vanilla/robotd/warfare.c:1.2 --- Vanilla/robotd/warfare.c:1.1 Tue Feb 22 16:49:31 2000 +++ Vanilla/robotd/warfare.c Thu Apr 26 18:41:50 2001 @@ -1,5 +1,5 @@ #include <stdio.h> -#include <values.h> +#include <limits.h> #include <math.h> #include <sys/types.h> #include <sys/time.h>