Bug#1008574: atanks: Fails to start the game, main menu is working normally

Jesse Smith jessefrgsmith at yahoo.ca
Mon Mar 28 22:39:41 BST 2022


I think this bug may have been fixed in the upstream development code. I
just tried running the game with the provided altered configuration
file. The development branch of Atanks and the provided config runs.
There had been a landscape calculation bug in version 6.6 which has
since been fixed and I suspect that's the issue.

Debian could either package the development branch, patch Atanks 6.6
with the fix (see attached), or wait for the next version which I
suspect will be out mid-2022.

- Jesse
-------------- next part --------------
diff --git a/Changelog b/Changelog
index 4100040..350b8c8 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,12 @@
 NOTE: From now on, new changes appear at the top of this file.
 
+	Fixes:
+	- Avoid divide by zero error during land calculation. Fix provided by Sven.
+	- Assert is often called when attempting to draw virtual object without a
+	  bitmap associated with the object. This has been removed to avoid exiting
+	  the game and a simple error is printed to the terminal instead.
+
+
 ============ Atanks-6.6 released ===================
 
 	Fixes:
diff --git a/Makefile b/Makefile
index 60e7b99..dca297f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 .PHONY: all install clean veryclean user winuser osxuser ubuntu \
 dist tarball zipfile source-dist i686-dist win32-dist
 
-VERSION := 6.6
+VERSION := 6.7
 
 
 DEBUG   ?= NO
@@ -85,7 +85,7 @@ FILENAME := $(TARGET)-$(VERSION)
 # ------------------------------------
 INSTALL := $(shell which install)
 RM      := $(shell which rm) -f
-CXX     ?= g++
+CXX     ?= clang++
 SED     := $(shell which sed)
 WINDRES :=
 
diff --git a/src/environment.cpp b/src/environment.cpp
index 79f34b8..e5edbb9 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -386,9 +386,8 @@ bool ENVIRONMENT::find_data_dir()
 	else {
         // This was not successful, try the current directory if not tried, yet.
 
-        if (strncmp(DATA_DIR, ".", 1) && strncmp(DATA_DIR, "./", 2)) {
+        if ( (strncmp(DATA_DIR, ".", 1) ) && (strncmp(DATA_DIR, "./", 2) ) ) {
 			strncpy(path_buf, "./unicode.dat", PATH_MAX);
-
 			// Try again and reset if unsuccessful
 			if (!access(path_buf, R_OK))
 				strncpy(dataDir, ".", PATH_MAX);
diff --git a/src/land.cpp b/src/land.cpp
index 3b9db0d..78b5533 100644
--- a/src/land.cpp
+++ b/src/land.cpp
@@ -162,7 +162,7 @@ void generate_land (LevelCreator* lcr, int32_t xoffset, int32_t heightx)
 				double maxTop = std::max(depthStrip[0][depth],
 				                         depthStrip[1][depth]);
 				double btdiff = maxTop - minBot;
-				double i      = (y - bot) / btdiff;
+				double i      = (y - bot) / ( (btdiff > 1.0) ? btdiff : 1.0);
 				double a1     = RAD2DEG(atan2(depthStrip[0][depth - 1]
 				                            - depthStrip[1][depth - 1], 1.0))
 				              + 180.;
diff --git a/src/virtobj.cpp b/src/virtobj.cpp
index 4397b9c..db69c92 100644
--- a/src/virtobj.cpp
+++ b/src/virtobj.cpp
@@ -74,8 +74,6 @@ void VIRTUAL_OBJECT::applyPhysics ()
 
 void VIRTUAL_OBJECT::draw ()
 {
-	assert(bitmap && "ERROR: VIRTUAL_OBJECT::draw() called without bitmap!");
-
 	if (!destroy && bitmap) {
 
 		rotate_sprite (global.canvas, bitmap,


More information about the Pkg-games-devel mailing list