On Tue, 2006-05-30 at 18:07 +0300, Timo Juhani Lindfors wrote: 
> Package: castle-combat
> Version: 0.8.0-2
> Severity: grave
> Justification: renders package unusable
> 
> When two local players play the game it throws

...

>   File "/usr/share/games/castle-combat/scripts/cannon.py", line 21, in 
> __init__
>     sound.cannon.play()
> exceptions.AttributeError: 'module' object has no attribute 'cannon'
> 
> when player #1 tries to fire the cannon. If you can't reproduce this
> please ask for more info.

Thanks for pointing this out.  This problem comes up when you play
castle-combat without any sound device.  The cannon sound is loaded in
sound.py after "if pygame.mixer.get_init():".  This will be false when
there is no sound device and the cannon sounds will not be loaded.  When
the cannon (and wall hit) sounds are played in cannon.py there is no
test to see if the sounds were successfully loaded.

I'm not certain if calling pygame.mixer.get_init() each time a cannon
shot sound is played would cause a notable performance hit and my
knowledge of python is still very limited, so I'll just add an "enabled"
flag to sound.py and check it in cannon.py before the sounds are played.

A patch with the changes I'm applying to the next Debian release of
castle-combat is attached to this message.

John

Attachment: 16-no_sound_device.dpatch
Description: application/shellscript

Reply via email to