static void LoadCustomSound(SoundInfo **snd_info, char *basename)
{
char *filename = getCustomSoundFilename(basename);
+ ListNode *node;
if (filename == NULL) /* (should never happen) */
{
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;
}
+#if 1
+ printf("[decrementing reference counter of sound '%s']\n", filename_old);
+#endif
+
if (--(*snd_info)->num_references <= 0)
{
#if 1
}
}
+ /* 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;
while (node)
{
- printf("['%s']\n", node->key);
+ printf("['%s' (%d)]\n", node->key,
+ ((SoundInfo *)node->content)->num_references);
node = node->next;
}