head 1.3; access; symbols pkgsrc-2026Q1:1.3.0.162 pkgsrc-2026Q1-base:1.3 pkgsrc-2025Q4:1.3.0.160 pkgsrc-2025Q4-base:1.3 pkgsrc-2025Q3:1.3.0.158 pkgsrc-2025Q3-base:1.3 pkgsrc-2025Q2:1.3.0.156 pkgsrc-2025Q2-base:1.3 pkgsrc-2025Q1:1.3.0.154 pkgsrc-2025Q1-base:1.3 pkgsrc-2024Q4:1.3.0.152 pkgsrc-2024Q4-base:1.3 pkgsrc-2024Q3:1.3.0.150 pkgsrc-2024Q3-base:1.3 pkgsrc-2024Q2:1.3.0.148 pkgsrc-2024Q2-base:1.3 pkgsrc-2024Q1:1.3.0.146 pkgsrc-2024Q1-base:1.3 pkgsrc-2023Q4:1.3.0.144 pkgsrc-2023Q4-base:1.3 pkgsrc-2023Q3:1.3.0.142 pkgsrc-2023Q3-base:1.3 pkgsrc-2023Q2:1.3.0.140 pkgsrc-2023Q2-base:1.3 pkgsrc-2023Q1:1.3.0.138 pkgsrc-2023Q1-base:1.3 pkgsrc-2022Q4:1.3.0.136 pkgsrc-2022Q4-base:1.3 pkgsrc-2022Q3:1.3.0.134 pkgsrc-2022Q3-base:1.3 pkgsrc-2022Q2:1.3.0.132 pkgsrc-2022Q2-base:1.3 pkgsrc-2022Q1:1.3.0.130 pkgsrc-2022Q1-base:1.3 pkgsrc-2021Q4:1.3.0.128 pkgsrc-2021Q4-base:1.3 pkgsrc-2021Q3:1.3.0.126 pkgsrc-2021Q3-base:1.3 pkgsrc-2021Q2:1.3.0.124 pkgsrc-2021Q2-base:1.3 pkgsrc-2021Q1:1.3.0.122 pkgsrc-2021Q1-base:1.3 pkgsrc-2020Q4:1.3.0.120 pkgsrc-2020Q4-base:1.3 pkgsrc-2020Q3:1.3.0.118 pkgsrc-2020Q3-base:1.3 pkgsrc-2020Q2:1.3.0.114 pkgsrc-2020Q2-base:1.3 pkgsrc-2020Q1:1.3.0.94 pkgsrc-2020Q1-base:1.3 pkgsrc-2019Q4:1.3.0.116 pkgsrc-2019Q4-base:1.3 pkgsrc-2019Q3:1.3.0.112 pkgsrc-2019Q3-base:1.3 pkgsrc-2019Q2:1.3.0.110 pkgsrc-2019Q2-base:1.3 pkgsrc-2019Q1:1.3.0.108 pkgsrc-2019Q1-base:1.3 pkgsrc-2018Q4:1.3.0.106 pkgsrc-2018Q4-base:1.3 pkgsrc-2018Q3:1.3.0.104 pkgsrc-2018Q3-base:1.3 pkgsrc-2018Q2:1.3.0.102 pkgsrc-2018Q2-base:1.3 pkgsrc-2018Q1:1.3.0.100 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.98 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.96 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.92 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.90 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.88 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.86 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.84 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.3.0.82 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.80 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.78 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.76 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.74 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.72 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.70 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.3.0.68 pkgsrc-2014Q2-base:1.3 pkgsrc-2014Q1:1.3.0.66 pkgsrc-2014Q1-base:1.3 pkgsrc-2013Q4:1.3.0.64 pkgsrc-2013Q4-base:1.3 pkgsrc-2013Q3:1.3.0.62 pkgsrc-2013Q3-base:1.3 pkgsrc-2013Q2:1.3.0.60 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.58 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.56 pkgsrc-2012Q4-base:1.3 pkgsrc-2012Q3:1.3.0.54 pkgsrc-2012Q3-base:1.3 pkgsrc-2012Q2:1.3.0.52 pkgsrc-2012Q2-base:1.3 pkgsrc-2012Q1:1.3.0.50 pkgsrc-2012Q1-base:1.3 pkgsrc-2011Q4:1.3.0.48 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q3:1.3.0.46 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.3.0.44 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.42 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.3.0.40 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.38 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.36 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.34 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.32 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.30 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.28 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.26 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.3.0.24 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.22 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.20 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.18 pkgsrc-2008Q2-base:1.3 cwrapper:1.3.0.16 pkgsrc-2008Q1:1.3.0.14 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.12 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.10 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.8 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.6 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.4 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.2 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.2.0.10 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.8 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.6 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.4 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.2 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.1.0.6 pkgsrc-2005Q1-base:1.1 pkgsrc-2004Q4:1.1.0.4 pkgsrc-2004Q4-base:1.1 pkgsrc-2004Q3:1.1.0.2 pkgsrc-2004Q3-base:1.1; locks; strict; comment @# @; 1.3 date 2006.08.02.19.24.55; author kristerw; state Exp; branches; next 1.2; 1.2 date 2005.06.14.18.50.50; author jmmv; state Exp; branches; next 1.1; 1.1 date 2004.09.08.12.48.32; author sketch; state Exp; branches; next ; desc @@ 1.3 log @Rename the function "trunc" to prevent conflict with the C99 "trunc" function. @ text @$NetBSD$ --- ai.c.orig 1999-06-30 20:25:02.000000000 +0200 +++ 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(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(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)]; @@@@ -83,10 +83,10 @@@@ /* Find coordinates for new position */ switch(dir) { - 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 LEFT: x-=0.5; eqy=trunc(y); eqx=trunc(x); break; - case RIGHT: x+=0.5; eqy=trunc(y); eqx=round(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 @@@@ if(!checkdest(eqx, eqy)) goto tryagain; /* Check for double half-step */ - if(trunc(x)!=round(x) && trunc(y)!=round(y)) goto tryagain; + if(mytrunc(x)!=roundup(x) && mytrunc(y)!=roundup(y)) goto tryagain; /* Passes all checks */ amonst->x = x; @@@@ -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(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(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)]; @@@@ -136,8 +136,8 @@@@ tryagain: /* Come back here to try again */ tries++; if(tries>100) { - if(trunc(amonst->x)==round(amonst->x) && - trunc(amonst->y)==round(amonst->y)) + if(mytrunc(amonst->x)==roundup(amonst->x) && + mytrunc(amonst->y)==roundup(amonst->y)) watchentity(amonst, target); return; } @@@@ -175,7 +175,7 @@@@ if(!checkdest(eqx, eqy)) goto tryagain; /* Be careful of half-steps */ - if(trunc(x)!=round(x) && trunc(y)!=round(y)) goto tryagain; + if(mytrunc(x)!=roundup(x) && mytrunc(y)!=roundup(y)) goto tryagain; /* Done working out new position, assign to character */ amonst->x = x; @@@@ -193,7 +193,6 @@@@ case DOWN: y+=1; break; case LEFT: x-=1; break; case RIGHT: x+=1; break; - default: } icorrectpos(&x, &y); if(!checkdest(x, y) && data[xytotype(x, y)].etype==CHARACTER) { @@@@ -279,22 +278,22 @@@@ printf("I was asked to kill a monster that shouldn't be killed!\n"); if(amonst->health <= 0) { if(data[amonst->type].etype != EFFECT) { - maze[round(amonst->y)][round(amonst->x)] = -2; /* Blank */ - maze[trunc(amonst->y)][trunc(amonst->x)] = -2; /* Blank */ + maze[roundup(amonst->y)][roundup(amonst->x)] = -2; /* Blank */ + maze[mytrunc(amonst->y)][mytrunc(amonst->x)] = -2; /* Blank */ } draw_tilex2(mainwindow, data[amonst->type].tile[amonst->frame], amonst->x*GRIDSIZE, amonst->y*GRIDSIZE, BLACK, amonst->dir); } /* If there was something underneath the effect, redraw it */ - 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); } - if(maze[round(amonst->y)][round(amonst->x)]!=-2) { - bmonst=&monst[maze[round(amonst->y)][round(amonst->x)]]; + if(maze[roundup(amonst->y)][roundup(amonst->x)]!=-2) { + bmonst=&monst[maze[roundup(amonst->y)][roundup(amonst->x)]]; draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], bmonst->x*GRIDSIZE, bmonst->y*GRIDSIZE, bmonst->color, bmonst->dir); @@@@ -353,10 +352,10 @@@@ amonst->atspeed = 10; else amonst->atspeed=4; switch(amonst->dir) { - case LEFT: fx-=1; x=trunc(fx); y=trunc(fy); break; - case RIGHT: fx+=1; x=round(fx); y=trunc(fy); break; - case UP: fy-=1; y=trunc(fy); x=trunc(fx); break; - case DOWN: fy+=1; y=round(fy); x=trunc(fx); break; + case LEFT: fx-=1; x=mytrunc(fx); y=mytrunc(fy); break; + case RIGHT: fx+=1; x=roundup(fx); y=mytrunc(fy); break; + case UP: fy-=1; y=mytrunc(fy); x=mytrunc(fx); break; + case DOWN: fy+=1; y=roundup(fy); x=mytrunc(fx); break; } icorrectpos(&x, &y); if(!checkdest(x, y)) { @@@@ -420,8 +419,8 @@@@ if(!(amonst->x == target->x || amonst->y == target->y)) return 0; /* Halfsteps are banned */ - if(round(amonst->x) != trunc(amonst->x)) return 0; - if(round(amonst->y) != trunc(amonst->y)) return 0; + if(roundup(amonst->x) != mytrunc(amonst->x)) return 0; + if(roundup(amonst->y) != mytrunc(amonst->y)) return 0; /* Force x1, y1 to be smaller pair */ if(x1 > x2) { @ 1.2 log @Remove an empty default clause. Should fix build problem reported in PR pkg/29501, although I haven't been able to reproduce it (different compiler versions, I guess). @ text @d1 1 a1 1 $NetBSD: patch-ae,v 1.1 2004/09/08 12:48:32 sketch Exp $ d4 2 a5 2 +++ ai.c @@@@ -59,12 +59,12 @@@@ void destrand( entity *amonst ) { d10 1 a10 1 + if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) { d16 1 a16 1 + if(trunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) { d20 2 a21 1 @@@@ -84,9 +84,9 @@@@ void destrand( entity *amonst ) { d24 1 a24 1 case UP: y-=0.5; eqy=trunc(y); eqx=trunc(x); break; d26 1 a26 2 + case DOWN: y+=0.5; eqy=roundup(y); eqx=trunc(x); break; case LEFT: x-=0.5; eqy=trunc(y); eqx=trunc(x); break; d28 4 a31 1 + case RIGHT: x+=0.5; eqy=trunc(y); eqx=roundup(x); break; d35 1 a35 1 @@@@ -94,7 +94,7 @@@@ void destrand( entity *amonst ) { d40 1 a40 1 + if(trunc(x)!=roundup(x) && trunc(y)!=roundup(y)) goto tryagain; d44 1 a44 1 @@@@ -111,12 +111,12 @@@@ void desthome( entity *amonst ) { d49 1 a49 1 + if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) { d55 1 a55 1 + if(trunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) { d59 1 a59 1 @@@@ -136,8 +136,8 @@@@ void desthome( entity *amonst ) { d65 2 a66 2 + if(trunc(amonst->x)==roundup(amonst->x) && + trunc(amonst->y)==roundup(amonst->y)) d70 1 a70 1 @@@@ -175,7 +175,7 @@@@ void desthome( entity *amonst ) { d75 1 a75 1 + if(trunc(x)!=roundup(x) && trunc(y)!=roundup(y)) goto tryagain; d79 1 a79 1 @@@@ -193,7 +193,6 @@@@ void deststraight( entity *actmonst ) { d87 1 a87 1 @@@@ -279,7 +278,7 @@@@ void killmonster( entity *amonst ) { d92 1 d94 1 a94 1 maze[trunc(amonst->y)][trunc(amonst->x)] = -2; /* Blank */ d97 9 a105 1 @@@@ -293,8 +292,8 @@@@ void killmonster( entity *amonst ) { d116 2 a117 1 @@@@ -354,9 +353,9 @@@@ void spawnbullet( entity *amonst ) { d120 1 a120 1 case LEFT: fx-=1; x=trunc(fx); y=trunc(fy); break; d122 1 a122 2 + case RIGHT: fx+=1; x=roundup(fx); y=trunc(fy); break; case UP: fy-=1; y=trunc(fy); x=trunc(fx); break; d124 4 a127 1 + case DOWN: fy+=1; y=roundup(fy); x=trunc(fx); break; d131 1 a131 1 @@@@ -420,8 +419,8 @@@@ int clearshot( entity *amonst, entity *t d137 2 a138 2 + if(roundup(amonst->x) != trunc(amonst->x)) return 0; + if(roundup(amonst->y) != trunc(amonst->y)) return 0; @ 1.1 log @Rename round() to roundup() to avoid conflict with round(3) introduced in NetBSD 2.0. @ text @d1 1 a1 1 $NetBSD$ d3 3 a5 3 --- ai.c.orig 1999-06-30 19:25:02.000000000 +0100 +++ ai.c 2004-09-08 13:41:53.000000000 +0100 @@@@ -59,12 +59,12 @@@@ d20 1 a20 1 @@@@ -84,9 +84,9 @@@@ d32 1 a32 1 @@@@ -94,7 +94,7 @@@@ d41 1 a41 1 @@@@ -111,12 +111,12 @@@@ d56 1 a56 1 @@@@ -136,8 +136,8 @@@@ d67 1 a67 1 @@@@ -175,7 +175,7 @@@@ d76 9 a84 1 @@@@ -279,7 +279,7 @@@@ d93 1 a93 1 @@@@ -293,8 +293,8 @@@@ d104 1 a104 1 @@@@ -354,9 +354,9 @@@@ d116 1 a116 1 @@@@ -420,8 +420,8 @@@@ @