Halftone magic tool wasn't loading...

... due to a problem with its sound effect file.
This commit is contained in:
Bill Kendrick 2021-02-20 15:14:31 -08:00
parent 5208b8ac6d
commit d588e5d214
4 changed files with 15 additions and 5 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2021.February.15 (0.9.26) 2021.February.21 (0.9.26)
* New Features * New Features
------------ ------------
* [WIP] Larger UI buttons * [WIP] Larger UI buttons
@ -70,6 +70,11 @@ $Id$
* Galician translation * Galician translation
Miguel Bouzada <mbouzada@gmail.com> Miguel Bouzada <mbouzada@gmail.com>
* Bug Fixes:
----------
* Halftone magic tool wasn't loading due to a problem
with its sound effect file.
2020.December.27 (0.9.25) 2020.December.27 (0.9.25)
* New Features * New Features
------------ ------------

BIN
magic/sounds/halftone.ogg Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
/* halftone.c /* halftone.c
Last modified: 2011.07.17 Last modified: 2021.02.20
*/ */
@ -24,7 +24,7 @@ enum
const char *snd_filenames[NUM_TOOLS] = { const char *snd_filenames[NUM_TOOLS] = {
"halftone.wav", "halftone.ogg",
}; };
const char *icon_filenames[NUM_TOOLS] = { const char *icon_filenames[NUM_TOOLS] = {
@ -84,12 +84,14 @@ int halftone_init(magic_api * api)
snprintf(fname, sizeof(fname), "%s/sounds/magic/%s", api->data_directory, snd_filenames[i]); snprintf(fname, sizeof(fname), "%s/sounds/magic/%s", api->data_directory, snd_filenames[i]);
snd_effect[i] = Mix_LoadWAV(fname); snd_effect[i] = Mix_LoadWAV(fname);
/*
if (snd_effect[i] == NULL) if (snd_effect[i] == NULL)
{ {
SDL_FreeSurface(canvas_backup); SDL_FreeSurface(canvas_backup);
SDL_FreeSurface(square); SDL_FreeSurface(square);
return (0); return (0);
} }
*/
} }
@ -146,8 +148,11 @@ void halftone_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{ {
int i; int i;
for (i = 0; i < NUM_TOOLS; i++) for (i = 0; i < NUM_TOOLS; i++) {
Mix_FreeChunk(snd_effect[i]); if (snd_effect[i] != NULL) {
Mix_FreeChunk(snd_effect[i]);
}
}
SDL_FreeSurface(canvas_backup); SDL_FreeSurface(canvas_backup);
SDL_FreeSurface(square); SDL_FreeSurface(square);