[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#944483: marked as done (moon-lander: consider remaining fuel when a bonus ship is given)



Your message dated Fri, 28 May 2021 18:33:36 +0000
with message-id <E1lmhIe-000DuX-Mp@fasolo.debian.org>
and subject line Bug#944483: fixed in moon-lander 1:1.0-8
has caused the Debian Bug report #944483,
regarding moon-lander: consider remaining fuel when a bonus ship is given
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
944483: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944483
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: moon-lander
Version: 1:1.0-7
Severity: normal
Tags: patch

Dear Maintainer,

When a player reaches 10000 points, a bonus ship is supposed to be
given. However, if the player is currently at, say, 8000 points and
lands on an 1800 point pad but has 300 fuel left, the score will then be
8000 + 1800 + 300 = 10100, which is greater than 10000 but no bonus ship
will be given.

This is because the new score is calculated considering the remaining
fuel (a feature added by Debian in 20_fix-score.patch), but the bonus
ship does not consider the remaining fuel. Please see the following
patch for a simple fix:
Description: Fix bonus ship calculation to account for remaining fuel.
Author: Asher Gordon <AsDaGo@posteo.net>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- moon-lander-1.0.orig/moon_lander.c
+++ moon-lander-1.0/moon_lander.c
@@ -1686,7 +1686,7 @@ void gameloop(Game *game){
 
 	    // Bonus ship every 10000 points
 	    if( (game->score / 10000) < 
-		((game->score + game->current_level.landing_score[count]) / 10000 ) ) {
+		((game->score + game->current_level.landing_score[count] + game->fuel) / 10000 ) ) {
 	      // (MLH) This would be a good place to play a sound
 	      
 	      game->landing_pad = count;
To reproduce this bug, follow these steps:

Compile for easier debugging (you'll be using this value for CFLAGS
again, so put it in the environment):

  $ export CFLAGS="$(sdl-config --cflags) -O0 -ggdb3"
  $ make clean all
  [...]

Now run it under GDB (or your favorite front-end):

  $ gdb moon-lander
  [...]
  (gdb) run
  [...]

Go to the moon-lander window, and start a new game with <RET> and pause
it immediately after it starts with P. Now go back to GDB, and type
^C. Then go up until you reach the bottom most frame in moon-lander (not
libSDL).

  ^C
  Thread 1 "moon-lander" received signal SIGINT, Interrupt.
  0x00007ffff7f0dd97 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
  (gdb) up
  #1  0x00007ffff7f02470 in ?? ()
     from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
  (gdb) 
  #2  0x00007ffff7f16b46 in SDL_LowerBlit ()
     from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
  (gdb) 
  #3  0x00007ffff7f18812 in SDL_Flip ()
     from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
  (gdb) 
  #4  0x000055555555a928 in gameloop (game=0x7fffffffdc00)
      at moon_lander.c:1733
  1733	      SDL_Flip(game->screen);

Now set the fuel to some huge value so that your new score will be
greater than 10000 because of the fuel left:

  (gdb) call game->fuel = 15000
  $1 = 15000
  (gdb) cont
  Continuing.

Go back to the moon-lander window, unpause the game (with P again), and
land on a pad (you can cheat with GDB if you're really bad at this
game). Your new score should be greater than 10000, but you will not get
a bonus ship.

This can happen in real life (i.e. without GDB) and you won't get a
bonus ship until 20000 points (and even then you might not). If you
repeat the steps above with my patch applied (and don't forget to
recompile--that's why you exported CFLAGS), you will find that it will
give you a bonus ship.

Thanks,
Asher

-- 
If at first you don't succeed, redefine success.


-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 5.2.0-3-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages moon-lander depends on:
ii  libc6             2.29-2
ii  libsdl-image1.2   1.2.12-12
ii  libsdl-mixer1.2   1.2.12-16
ii  libsdl1.2debian   1.2.15+dfsg2-5
ii  moon-lander-data  1:1.0-7

moon-lander recommends no packages.

moon-lander suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: moon-lander
Source-Version: 1:1.0-8
Done: Imre Jonk <imre@imrejonk.nl>

We believe that the bug you reported is fixed in the latest version of
moon-lander, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 944483@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Imre Jonk <imre@imrejonk.nl> (supplier of updated moon-lander package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 27 Mar 2021 09:38:46 +0100
Source: moon-lander
Architecture: source
Version: 1:1.0-8
Distribution: unstable
Urgency: medium
Maintainer: Debian QA Group <packages@qa.debian.org>
Changed-By: Imre Jonk <imre@imrejonk.nl>
Closes: 944483
Changes:
 moon-lander (1:1.0-8) unstable; urgency=medium
 .
   * QA upload.
   * Fix bug in bonus ship calculation. Patch provided by Asher Gordon.
     Closes: #944483.
   * Remove extraneous 'foo' patch from d/patches.
   * Make d/copyright DEP-5 compliant.
   * Include "missing" source for moon-lander.bin.
   * Bump debhelper version to >= 12.
   * Add desktop file keywords.
Checksums-Sha1:
 db52ad718a73b917e5447c29dcd0887eb62fbfae 1819 moon-lander_1.0-8.dsc
 edb89903ae2830ade94b266e184249ccafbad964 8048 moon-lander_1.0-8.debian.tar.xz
 189b10b14cb9c946a374f20cfd74a2f0a44d5cfc 5577 moon-lander_1.0-8_source.buildinfo
Checksums-Sha256:
 4f93736af9b486464d29d1fe4d6745f1a661e33bfbb9ac69a0cc7b1ba0bc3535 1819 moon-lander_1.0-8.dsc
 50460ddb4fb68d8318f8d45cbca494ed99098a935604364a8d49b215b00d0f29 8048 moon-lander_1.0-8.debian.tar.xz
 6ed0286fa0c469d6dc064332241bba587b6b3faa0cbbcc9cddac93067e631ada 5577 moon-lander_1.0-8_source.buildinfo
Files:
 b1bc4ce4ac2c6e5758ea5c4c45e240ff 1819 games optional moon-lander_1.0-8.dsc
 15f84e9c9297850e6675e0c8db4850d7 8048 games optional moon-lander_1.0-8.debian.tar.xz
 86891157c6101884cd394cd384542f21 5577 games optional moon-lander_1.0-8_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE/d0M/zhkJ3YwohhskWT6HRe9XTYFAmCxM04ACgkQkWT6HRe9
XTYRiRAAmr817sUPcM8nhG8f72QspNclgSCJYj9VhHfcEQcrIk3nV40QU2RsYm2f
cZ92Y5wFyOnAmH+MSy1wgYwdM5AAArywYAp7BUEuUzOhWqAKzVFUCVlIFYUj/FXT
MQCYUxN/JNHqQn6NybQ3p4FWv5vo+PmKTx1vHOaPlmyKiFhpIxjf8PYU9yeRUqZ1
TA1qR7hfOqScO//8dwqocJW9EtmKFIkWPb1ZW3h5t6QdJK87fHDzJbFPWW17+PVN
XTYUEJxUR3TpwWLCbU6a/O4QW2mEa/qTuN2e1McUVHb7suyi/g1nHa8kYPxiZsYb
HHOVpys5vuuC1gV5M1qXnexoJbxxHGp0lPtn1J2JuU/Scs88YaRIIDDan39+73Bm
DuKju8jo3V/t0bZAMhDypO7nh9oH9Qfc42P93wdQI7C4FR9+jbLj3khJ+wxLbmqP
HLpGpg5OE5assMf5aYkuefOw6Tnfsa2huQaofg0Mkoy3c+dTCfIPlbG+/9VLY+gD
lV6JMdTbzBrhXMB56eELLe6AW/k0uTqWSTA0I5s5Qp6jV5b4AkLamm63fisB+gfD
yY9HYBhDz9fa+ThIYnYpyti41xcGKHkK8whvDe4zZ5RuVc8OwavyzVccSpohozxf
dLCrVGZ55F1GKUfuex5nOyg+GfC3+UHzIfOWksrvN1F3XeqfDmk=
=puez
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: