tags 515203 + patch
thanks
I've been asked to look at a couple of RC bugs as part of the NM process, and
I've picked this one as I've played supertux so am at least familiar with the
package from the outside, and I know C++.
Firstly the upstream code doesn't build with the current version of g++ - the
GCC developers have cleaned up a lot of implicitly included headers and this
code needs updating to explicitly include headers it uses. This is fixed by
the first patch:
update-to-compile-with-current-gcc.patch
On to this bug itself - when run from the menu, options are passed to disable
sound and music, but this won't happen if the user invokes supertux from a
terminal by running supertux. I've addressed this by added a small silent
WAV sample and adding fallback code so supertux will use this if it can't
find the wav or ogg file it was asked to. This approach will also allow
DFSG-free samples to be easily added one-by-one with missing samples continuing
to use the fallback. There's a patch to add the fallback to the upstream code
and a second to modify the debian packaging to generate and install the
fallback wav file:
fallback-to-silent-sample-upstream.patch
fallback-to-silent-sample-debian.patch
With these changes, I successfully built the package in a experimental pbuilder
on amd64 and play tested for an hour or so.
Cheers,
Olly
--- supertux-0.3.0~dfsg.orig/src/object_factory.cpp
+++ supertux-0.3.0~dfsg/src/object_factory.cpp
@@ -19,6 +19,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include config.h
+#include memory
#include sstream
#include stdexcept
--- supertux-0.3.0~dfsg.orig/src/textscroller.hpp
+++ supertux-0.3.0~dfsg/src/textscroller.hpp
@@ -21,6 +21,7 @@
#ifndef __TEXTSCROLLER_H__
#define __TEXTSCROLLER_H__
+#include memory
#include vector
#include string
#include map
--- supertux-0.3.0~dfsg.orig/src/console.cpp
+++ supertux-0.3.0~dfsg/src/console.cpp
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include config.h
+#include algorithm
#include iostream
#include console.hpp
#include video/drawing_context.hpp
@@ -515,7 +516,7 @@
log_warning Command \ command \ not associated with a command receiver. Not dissociated. std::endl;
return;
}
- std::listConsoleCommandReceiver*::iterator j = find(i-second.begin(), i-second.end(), ccr);
+ std::listConsoleCommandReceiver*::iterator j = std::find(i-second.begin(), i-second.end(), ccr);
if (j == i-second.end()) {
log_warning Command \ command \ not associated with given command receiver. Not dissociated. std::endl;
return;
@@ -529,7 +530,7 @@
for (std::mapstd::string, std::listConsoleCommandReceiver* ::iterator i = commands.begin(); i != commands.end(); i++) {
std::listConsoleCommandReceiver* ccrs = i-second;
std::listConsoleCommandReceiver*::iterator j;
-while ((j = find(ccrs.begin(), ccrs.end(), ccr)) != ccrs.end()) {
+while ((j = std::find(ccrs.begin(), ccrs.end(), ccr)) != ccrs.end()) {
ccrs.erase(j);
}
}
--- supertux-0.3.0~dfsg.orig/src/console.hpp
+++ supertux-0.3.0~dfsg/src/console.hpp
@@ -22,6 +22,7 @@
#include list
#include map
+#include memory
#include vector
#include string
#include sstream
--- supertux-0.3.0~dfsg.orig/src/gameconfig.cpp
+++ supertux-0.3.0~dfsg/src/gameconfig.cpp
@@ -21,6 +21,7 @@
#include gameconfig.hpp
#include cstdlib
+#include memory
#include string
#include stdexcept
--- supertux-0.3.0~dfsg.orig/src/statistics.cpp
+++ supertux-0.3.0~dfsg/src/statistics.cpp
@@ -22,6 +22,7 @@
#include assert.h
#include math.h
+#include limits
#include sstream
#include video/drawing_context.hpp
#include gettext.hpp
--- supertux-0.3.0~dfsg.orig/src/sprite/sprite_manager.hpp
+++ supertux-0.3.0~dfsg/src/sprite/sprite_manager.hpp
@@ -21,6 +21,7 @@
#define SUPERTUX_SPRITE_MANAGER_H
#include map
+#include string
class SpriteData;
class Sprite;
--- supertux-0.3.0~dfsg.orig/src/tinygettext/tinygettext.cpp
+++ supertux-0.3.0~dfsg/src/tinygettext/tinygettext.cpp
@@ -19,8 +19,11 @@
#include config.h
+#include string.h
+#include stdlib.h
#include sys/types.h
#include iconv.h
+#include algorithm
#include fstream
#include iostream
#include ctype.h
--- supertux-0.3.0~dfsg.orig/src/audio/sound_file.cpp
+++ supertux-0.3.0~dfsg/src/audio/sound_file.cpp
@@ -24,6 +24,7 @@
#include stdio.h
#include stdint.h
+#include string.h
#include algorithm
#include stdexcept
#include sstream
--- supertux-0.3.0~dfsg.orig/src/lisp/lexer.cpp
+++ supertux-0.3.0~dfsg/src/lisp/lexer.cpp
@@ -19,6 +19,7 @@
#include config.h
+#include string.h
#include sstream
#include stdexcept
#include iostream
--- supertux-0.3.0~dfsg.orig/src/lisp/parser.cpp
+++ supertux-0.3.0~dfsg/src/lisp/parser.cpp
@@ -19,6 +19,7 @@
#include config.h
+#include string.h
#include sstream
#include stdexcept
#include fstream
---