Package: atanks
Version: 1.1.0-3
Severity: serious

atanks fails to build because it contains some ambiguous calls to abs
on doubles (among other problems):

g++ -c player.cc -o player.o -DLINUX -DVERSION=\"1.1.0\" 
-DDATA_DIR=\"/usr/share/games/atanks\"   -O2 -fsigned-char -Wall -Iinclude  -g
player.cc: In member function 'int PLAYER::addTankDamageToMatrix(TANK*, TANK*, 
int)':
player.cc:1012: error: call of overloaded 'abs(double)' is ambiguous
/usr/include/stdlib.h:748: note: candidates are: int abs(int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:169: 
note:                 long long int __gnu_cxx::abs(long long int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:130: 
note:                 long int std::abs(long int)
player.cc:1017: error: call of overloaded 'abs(double)' is ambiguous
/usr/include/stdlib.h:748: note: candidates are: int abs(int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:169: 
note:                 long long int __gnu_cxx::abs(long long int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:130: 
note:                 long int std::abs(long int)
player.cc: In member function 'void PLAYER::calcDamageMatrix(TANK*, int)':
player.cc:1088: error: call of overloaded 'abs(double)' is ambiguous
/usr/include/stdlib.h:748: note: candidates are: int abs(int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:169: 
note:                 long long int __gnu_cxx::abs(long long int)
/usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/cstdlib:130: 
note:                 long int std::abs(long int)
make[2]: *** [player.o] Error 1
make[2]: Leaving directory `/tmp/buildd/atanks-1.1.0/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/buildd/atanks-1.1.0'
make: *** [build-stamp] Error 2

The attached patch fixes these problems.

-- 
Matt
only in patch2:
unchanged:
--- atanks-1.1.0.orig/src/player.cc
+++ atanks-1.1.0/src/player.cc
@@ -1009,12 +1009,12 @@
                if (weapNum >= RIOT_CHARGE && weapNum <= RIOT_BLAST) {
                        // add points only within range and above ctank
                        if (    (cy > ctank->y - (radius / 2)) ||
-                               (abs (ctank->x - cx) > radius))
+                               (fabs (ctank->x - cx) > radius))
                                continue;
                } else if (weapNum >= SML_ROLLER && weapNum <= DTH_ROLLER) {
                        // Only aim rollers above other tanks
                        if (cy > tankY + TANKHEIGHT &&
-                               abs (ctank->x - cx) > radius)
+                               fabs (ctank->x - cx) > radius)
                                continue;
                } else if (weapNum >= SML_LAZER && weapNum <= LRG_LAZER) {
                        // Lazer can only be aimed above horizontal
@@ -1085,7 +1085,7 @@
                        if (itemNum  >= ITEM_VENGEANCE && itemNum <= 
ITEM_FATAL_FURY) {
                                // add sqrt distances for each tank * potential 
damage
                                long int totalEffectiveDamage = 
calcTotalEffectiveDamage (itemNum);
-                               _targetMatrix[(int)ctank->x] += sqrt (abs 
(ctank->x - ltank->x)) * totalEffectiveDamage;
+                               _targetMatrix[(int)ctank->x] += sqrt (fabs 
(ctank->x - ltank->x)) * totalEffectiveDamage;
 
                        }
                }

Attachment: signature.asc
Description: Digital signature

Reply via email to