pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/games/xroads Rename the function "trunc" to prevent co...
details: https://anonhg.NetBSD.org/pkgsrc/rev/439e15d6ee9c
branches: trunk
changeset: 517007:439e15d6ee9c
user: kristerw <kristerw%pkgsrc.org@localhost>
date: Wed Aug 02 19:24:55 2006 +0000
description:
Rename the function "trunc" to prevent conflict with the C99 "trunc" function.
diffstat:
games/xroads/distinfo | 8 +-
games/xroads/patches/patch-ac | 94 ++++++++++++++++++++++++++++--------------
games/xroads/patches/patch-ad | 12 +++--
games/xroads/patches/patch-ae | 79 +++++++++++++++++++++--------------
4 files changed, 120 insertions(+), 73 deletions(-)
diffs (truncated from 403 to 300 lines):
diff -r b3ca95b29c1a -r 439e15d6ee9c games/xroads/distinfo
--- a/games/xroads/distinfo Wed Aug 02 18:39:32 2006 +0000
+++ b/games/xroads/distinfo Wed Aug 02 19:24:55 2006 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.5 2005/06/14 18:50:50 jmmv Exp $
+$NetBSD: distinfo,v 1.6 2006/08/02 19:24:55 kristerw Exp $
SHA1 (xroads-v0.5.tar.gz) = 559f916eda55ba4700c2cea6fcb42d1b1a47fa06
RMD160 (xroads-v0.5.tar.gz) = c0399b391d2113d93c08c25ad6370273791261b7
Size (xroads-v0.5.tar.gz) = 48641 bytes
SHA1 (patch-aa) = 4978b1b718b920871d06acff54895da60642c949
SHA1 (patch-ab) = f22b139e84c4e2d4d9d190d818d0ce6aba816a23
-SHA1 (patch-ac) = f2dea6edd1be400992e77cdbfea14c2485a29a07
-SHA1 (patch-ad) = 1ca73bd1201283f2a292040e9d3af9f10399b005
-SHA1 (patch-ae) = f1b8e462f0b3b4c822ac339f3f4ae990b4d996f9
+SHA1 (patch-ac) = 19c91236e36cced0c26f527fdc99a565dfdb245f
+SHA1 (patch-ad) = eb76c3ee57d8b18f70e7f8bcd41d96d5e1dd4dad
+SHA1 (patch-ae) = 7770ab7e6fec64d836f3ed886e1709dab508d9c5
diff -r b3ca95b29c1a -r 439e15d6ee9c games/xroads/patches/patch-ac
--- a/games/xroads/patches/patch-ac Wed Aug 02 18:39:32 2006 +0000
+++ b/games/xroads/patches/patch-ac Wed Aug 02 19:24:55 2006 +0000
@@ -1,8 +1,15 @@
-$NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $
+$NetBSD: patch-ac,v 1.2 2006/08/02 19:24:55 kristerw Exp $
---- xroads.c.orig 2004-09-08 13:39:59.000000000 +0100
-+++ xroads.c 2004-09-08 13:41:00.000000000 +0100
-@@ -288,7 +288,7 @@
+--- xroads.c.orig 1999-06-30 20:25:02.000000000 +0200
++++ xroads.c 2006-08-02 21:14:27.000000000 +0200
+@@ -282,13 +282,13 @@
+ }
+
+ /*************************************************************************************************/
+-int trunc( float num ) { /* Truncate a float to an int */
++int mytrunc( float num ) { /* Truncate a float to an int */
+ if (num>0) return (int)num;
+ else return (int)(num-0.5);
}
/*************************************************************************************************/
@@ -18,28 +25,33 @@
- || amonst->y==monst[targ].y) && (round(amonst->x) ==
- trunc(amonst->x) && round(amonst->y) == trunc(amonst->y))) {
+ || amonst->y==monst[targ].y) && (roundup(amonst->x) ==
-+ trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y))) {
++ mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y))) {
*/
- if(data[amonst->type].attack1==VACCUUM && (round(amonst->x) ==
- trunc(amonst->x) && round(amonst->y) == trunc(amonst->y)) &&
+ if(data[amonst->type].attack1==VACCUUM && (roundup(amonst->x) ==
-+ trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y)) &&
++ mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y)) &&
clearshot(amonst, &monst[targ])) {
watchentity(amonst, &monst[targ]);
vacattack(amonst, &monst[targ]);
-@@ -423,9 +423,9 @@
+@@ -423,19 +423,19 @@
else amonst->frame++;
if(data[amonst->type].etype!=EFFECT) {
- maze[round(oldy)][round(oldx)]=-2; /* Blank out old space */
-+ maze[roundup(oldy)][roundup(oldx)]=-2; /* Blank out old space */
- maze[trunc(oldy)][trunc(oldx)]=-2;
+- maze[trunc(oldy)][trunc(oldx)]=-2;
- maze[round(amonst->y)][round(amonst->x)]=number;
+- maze[trunc(amonst->y)][trunc(amonst->x)]=number;
++ maze[roundup(oldy)][roundup(oldx)]=-2; /* Blank out old space */
++ maze[mytrunc(oldy)][mytrunc(oldx)]=-2;
+ maze[roundup(amonst->y)][roundup(amonst->x)]=number;
- maze[trunc(amonst->y)][trunc(amonst->x)]=number;
++ maze[mytrunc(amonst->y)][mytrunc(amonst->x)]=number;
}
/* If there was something underneath the effect, redraw it */
-@@ -434,8 +434,8 @@
+- if(maze[trunc(amonst->y)][trunc(amonst->x)]!=-2) {
+- bmonst=&monst[maze[trunc(amonst->y)][trunc(amonst->x)]];
++ if(maze[mytrunc(amonst->y)][mytrunc(amonst->x)]!=-2) {
++ bmonst=&monst[maze[mytrunc(amonst->y)][mytrunc(amonst->x)]];
draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], (bmonst->x)*GRIDSIZE,
(bmonst->y)*GRIDSIZE, bmonst->color, bmonst->dir);
}
@@ -55,40 +67,51 @@
/* Only one half-step at a time */
- if(round(newx)!=trunc(newx) && round(newy)!=trunc(newy)) {
-+ if(roundup(newx)!=trunc(newx) && roundup(newy)!=trunc(newy)) {
++ if(roundup(newx)!=mytrunc(newx) && roundup(newy)!=mytrunc(newy)) {
#ifdef DEBUG
printf("Damn, in two half-steps at a time...\n");
#endif
-@@ -574,17 +574,17 @@
+@@ -574,30 +574,30 @@
/* If we're in a half-step, eqx and eqy are the space we're moving
into */
- if(round(newx)!=trunc(newx)) {
-+ if(roundup(newx)!=trunc(newx)) {
- eqy = trunc(newy);
+- eqy = trunc(newy);
++ if(roundup(newx)!=mytrunc(newx)) {
++ eqy = mytrunc(newy);
if(newx > player->x)
- eqx = round(newx);
+ eqx = roundup(newx);
else if(newx < player->x)
- eqx = trunc(newx);
+- eqx = trunc(newx);
++ eqx = mytrunc(newx);
}
- else if(round(newy)!=trunc(newy)) {
-+ else if(roundup(newy)!=trunc(newy)) {
- eqx = trunc(newx);
+- eqx = trunc(newx);
++ else if(roundup(newy)!=mytrunc(newy)) {
++ eqx = mytrunc(newx);
if(newy > player->y)
- eqy = round(newy);
+ eqy = roundup(newy);
else if(newy < player->y)
- eqy = trunc(newy);
+- eqy = trunc(newy);
++ eqy = mytrunc(newy);
}
-@@ -595,9 +595,9 @@
+ else {
+- eqx = trunc(newx);
+- eqy = trunc(newy);
++ eqx = mytrunc(newx);
++ eqy = mytrunc(newy);
+ }
/*
switch(player->dir) {
- case LEFT: eqx = trunc(newx); break;
+- case LEFT: eqx = trunc(newx); break;
- case RIGHT: eqx = round(newx); break;
+- case UP: eqy = trunc(newy); break;
+- case DOWN: eqy = round(newy); break;
++ case LEFT: eqx = mytrunc(newx); break;
+ case RIGHT: eqx = roundup(newx); break;
- case UP: eqy = trunc(newy); break;
-- case DOWN: eqy = round(newy); break;
++ case UP: eqy = mytrunc(newy); break;
+ case DOWN: eqy = roundup(newy); break;
default:
}
@@ -99,43 +122,50 @@
printf("@ %d, %d : %d\n", eqx, eqy, maze[eqy][eqx]);
- printf("newx: %0.2f: round %d, trunc %d\n", newx, round(newx), trunc(newx));
- printf("newy: %0.2f: round %d, trunc %d\n", newy, round(newy), trunc(newy));
-+ printf("newx: %0.2f: round %d, trunc %d\n", newx, roundup(newx), trunc(newx));
-+ printf("newy: %0.2f: round %d, trunc %d\n", newy, roundup(newy), trunc(newy));
++ printf("newx: %0.2f: round %d, trunc %d\n", newx, roundup(newx), mytrunc(newx));
++ printf("newy: %0.2f: round %d, trunc %d\n", newy, roundup(newy), mytrunc(newy));
printf("Checkdest: %d\n", checkdest(eqx, eqy));
printf("-----\n");
}
-@@ -647,7 +647,7 @@
+@@ -646,8 +646,8 @@
+ else if(!okay) {
#ifdef DEBUG
printf("something in the way. (%d or %d)\n",
- maze[trunc(newy)][trunc(newx)],
+- maze[trunc(newy)][trunc(newx)],
- maze[round(newy)][round(newy)]);
++ maze[mytrunc(newy)][mytrunc(newx)],
+ maze[roundup(newy)][roundup(newy)]);
#endif
newx=player->x;
newy=player->y;
-@@ -658,14 +658,14 @@
+@@ -658,15 +658,15 @@
#endif
/* Destination has been set, now all we have to do is move there */
- maze[round(player->y)][round(player->x)]=-2;
+- maze[trunc(player->y)][trunc(player->x)]=-2;
+ maze[roundup(player->y)][roundup(player->x)]=-2;
- maze[trunc(player->y)][trunc(player->x)]=-2;
++ maze[mytrunc(player->y)][mytrunc(player->x)]=-2;
draw_tilex2(mainwindow, blank, player->x*GRIDSIZE, player->y*GRIDSIZE,
BLACK, RIGHT);
/* Draw player */
player->x=newx; player->y=newy;
- maze[round(player->y)][round(player->x)]=player->ind;
+- maze[trunc(player->y)][trunc(player->x)]=player->ind;
+ maze[roundup(player->y)][roundup(player->x)]=player->ind;
- maze[trunc(player->y)][trunc(player->x)]=player->ind;
++ maze[mytrunc(player->y)][mytrunc(player->x)]=player->ind;
draw_tilex2(mainwindow, data[datapos].tile[player->frame],
player->x*GRIDSIZE, player->y*GRIDSIZE,
-@@ -1279,7 +1279,7 @@
+ player->color, player->dir);
+@@ -1279,8 +1279,8 @@
player[i]->health = 0;
if(player[i]->attr & ACTIVE) {
player[i]->attr ^= ACTIVE;
- maze[round(player[i]->y)][round(player[i]->x)] = -2;
+- maze[trunc(player[i]->y)][trunc(player[i]->x)] = -2;
+ maze[roundup(player[i]->y)][roundup(player[i]->x)] = -2;
- maze[trunc(player[i]->y)][trunc(player[i]->x)] = -2;
++ maze[mytrunc(player[i]->y)][mytrunc(player[i]->x)] = -2;
draw_tilex2(mainwindow, blank, player[i]->x*GRIDSIZE,
player[i]->y*GRIDSIZE, BLACK, RIGHT);
+ #ifdef XPLOSIONS
diff -r b3ca95b29c1a -r 439e15d6ee9c games/xroads/patches/patch-ad
--- a/games/xroads/patches/patch-ad Wed Aug 02 18:39:32 2006 +0000
+++ b/games/xroads/patches/patch-ad Wed Aug 02 19:24:55 2006 +0000
@@ -1,12 +1,14 @@
-$NetBSD: patch-ad,v 1.1 2004/09/08 12:48:32 sketch Exp $
+$NetBSD: patch-ad,v 1.2 2006/08/02 19:24:55 kristerw Exp $
---- xroads.h.orig 1999-06-30 19:25:02.000000000 +0100
-+++ xroads.h 2004-09-08 13:39:46.000000000 +0100
-@@ -33,7 +33,7 @@
+--- xroads.h.orig 1999-06-30 20:25:02.000000000 +0200
++++ xroads.h 2006-08-02 21:12:52.000000000 +0200
+@@ -32,8 +32,8 @@
+ int xytotype( int, int );
void killme( char * );
void xconnect( int, char *[] );
- int trunc( float );
+-int trunc( float );
-int round( float );
++int mytrunc( float );
+int roundup( float );
#ifdef SIGHANDLE
void sigcatch( int );
diff -r b3ca95b29c1a -r 439e15d6ee9c games/xroads/patches/patch-ae
--- a/games/xroads/patches/patch-ae Wed Aug 02 18:39:32 2006 +0000
+++ b/games/xroads/patches/patch-ae Wed Aug 02 19:24:55 2006 +0000
@@ -1,79 +1,82 @@
-$NetBSD: patch-ae,v 1.2 2005/06/14 18:50:50 jmmv Exp $
+$NetBSD: patch-ae,v 1.3 2006/08/02 19:24:55 kristerw Exp $
--- ai.c.orig 1999-06-30 20:25:02.000000000 +0200
-+++ ai.c
-@@ -59,12 +59,12 @@ void destrand( entity *amonst ) {
++++ ai.c 2006-08-02 21:15:07.000000000 +0200
+@@ -59,12 +59,12 @@
int tries=0;
/* If in a halfstep, finish it */
- if(trunc(amonst->x)!=round(amonst->x)) switch(amonst->dir) {
-+ if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) {
++ if(mytrunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) {
case LEFT: amonst->x-=0.5; return;
case RIGHT: amonst->x+=0.5; return;
default: amonst->dir = directions[(int)rnd(2) + 2];
}
- if(trunc(amonst->y)!=round(amonst->y)) switch(amonst->dir) {
-+ if(trunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) {
++ if(mytrunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) {
case UP: amonst->y-=0.5; return;
case DOWN: amonst->y+=0.5; return;
default: amonst->dir = directions[(int)rnd(2)];
-@@ -84,9 +84,9 @@ void destrand( entity *amonst ) {
+@@ -83,10 +83,10 @@
+
/* Find coordinates for new position */
switch(dir) {
- case UP: y-=0.5; eqy=trunc(y); eqx=trunc(x); break;
+- case UP: y-=0.5; eqy=trunc(y); eqx=trunc(x); break;
- case DOWN: y+=0.5; eqy=round(y); eqx=trunc(x); break;
-+ case DOWN: y+=0.5; eqy=roundup(y); eqx=trunc(x); break;
- case LEFT: x-=0.5; eqy=trunc(y); eqx=trunc(x); break;
+- case LEFT: x-=0.5; eqy=trunc(y); eqx=trunc(x); break;
- case RIGHT: x+=0.5; eqy=trunc(y); eqx=round(x); break;
-+ case RIGHT: x+=0.5; eqy=trunc(y); eqx=roundup(x); break;
++ case UP: y-=0.5; eqy=mytrunc(y); eqx=mytrunc(x); break;
++ case DOWN: y+=0.5; eqy=roundup(y); eqx=mytrunc(x); break;
++ case LEFT: x-=0.5; eqy=mytrunc(y); eqx=mytrunc(x); break;
++ case RIGHT: x+=0.5; eqy=mytrunc(y); eqx=roundup(x); break;
default: printf("Error: Not a direction\n"); return;
}
-@@ -94,7 +94,7 @@ void destrand( entity *amonst ) {
+@@ -94,7 +94,7 @@
if(!checkdest(eqx, eqy)) goto tryagain;
/* Check for double half-step */
- if(trunc(x)!=round(x) && trunc(y)!=round(y)) goto tryagain;
-+ if(trunc(x)!=roundup(x) && trunc(y)!=roundup(y)) goto tryagain;
++ if(mytrunc(x)!=roundup(x) && mytrunc(y)!=roundup(y)) goto tryagain;
/* Passes all checks */
amonst->x = x;
-@@ -111,12 +111,12 @@ void desthome( entity *amonst ) {
+@@ -111,12 +111,12 @@
float dx, dy, dz;
/* If in a halfstep, finish it */
- if(trunc(amonst->x)!=round(amonst->x)) switch(amonst->dir) {
-+ if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) {
++ if(mytrunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) {
case LEFT: amonst->x-=0.5; return;
case RIGHT: amonst->x+=0.5; return;
default: amonst->dir = directions[(int)rnd(2) + 2];
}
Home |
Main Index |
Thread Index |
Old Index