projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a85e6b
)
rnd-20020430-3-src
author
Holger Schemel
<info@artsoft.org>
Tue, 30 Apr 2002 21:10:11 +0000
(23:10 +0200)
committer
Holger Schemel
<info@artsoft.org>
Sat, 30 Aug 2014 08:37:17 +0000
(10:37 +0200)
src/libgame/sound.c
patch
|
blob
|
history
diff --git
a/src/libgame/sound.c
b/src/libgame/sound.c
index 5d0817a33e0ce9558520a9623fd0ae0e4569ce52..4b62e341fbd0e8d7d3029df0d8ab82ec3913b0cd 100644
(file)
--- a/
src/libgame/sound.c
+++ b/
src/libgame/sound.c
@@
-1233,6
+1233,7
@@
static SoundInfo *Load_WAV(char *filename)
static void LoadCustomSound(SoundInfo **snd_info, char *basename)
{
char *filename = getCustomSoundFilename(basename);
static void LoadCustomSound(SoundInfo **snd_info, char *basename)
{
char *filename = getCustomSoundFilename(basename);
+ ListNode *node;
if (filename == NULL) /* (should never happen) */
{
if (filename == NULL) /* (should never happen) */
{
@@
-1251,12
+1252,16
@@
static void LoadCustomSound(SoundInfo **snd_info, char *basename)
and a fallback to the existing sound is done. */
#if 1
and a fallback to the existing sound is done. */
#if 1
- printf("[sound '%s' already exists]\n", filename);
+ printf("[sound '%s' already exists
(same list entry)
]\n", filename);
#endif
return;
}
#endif
return;
}
+#if 1
+ printf("[decrementing reference counter of sound '%s']\n", filename_old);
+#endif
+
if (--(*snd_info)->num_references <= 0)
{
#if 1
if (--(*snd_info)->num_references <= 0)
{
#if 1
@@
-1270,6
+1275,20
@@
static void LoadCustomSound(SoundInfo **snd_info, char *basename)
}
}
}
}
+ /* check if this sound already exists in the list of sounds */
+ node = getNodeFromKey(SoundFileList, filename);
+ if (node)
+ {
+#if 1
+ printf("[sound '%s' already exists (other list entry)]\n", filename);
+#endif
+
+ *snd_info = (SoundInfo *)node->content;
+ (*snd_info)->num_references++;
+
+ return;
+ }
+
*snd_info = Load_WAV(filename);
(*snd_info)->num_references = 1;
*snd_info = Load_WAV(filename);
(*snd_info)->num_references = 1;
@@
-1636,7
+1655,8
@@
void dumpList(ListNode *node_first)
while (node)
{
while (node)
{
- printf("['%s']\n", node->key);
+ printf("['%s' (%d)]\n", node->key,
+ ((SoundInfo *)node->content)->num_references);
node = node->next;
}
node = node->next;
}