+void deleteNodeFromList(ListNode **node_first, char *key,
+ void (*destructor_function)(void *))
+{
+ if (node_first == NULL || *node_first == NULL)
+ return;
+
+ printf("[CHECKING LIST KEY '%s' == '%s']\n",
+ (*node_first)->key, key);
+
+ if (strcmp((*node_first)->key, key) == 0)
+ {
+ printf("[DELETING LIST ENTRY]\n");
+
+ free((*node_first)->key);
+ if (destructor_function)
+ destructor_function((*node_first)->content);
+ *node_first = (*node_first)->next;
+ }
+ else
+ deleteNodeFromList(&(*node_first)->next, key, destructor_function);
+}
+
+ListNode *getNodeFromKey(ListNode *node_first, char *key)
+{
+ if (node_first == NULL)
+ return NULL;
+
+ if (strcmp(node_first->key, key) == 0)
+ return node_first;
+ else
+ return getNodeFromKey(node_first->next, key);
+}
+
+int getNumNodes(ListNode *node_first)
+{
+ return (node_first ? 1 + getNumNodes(node_first->next) : 0);
+}
+
+void dumpList(ListNode *node_first)
+{
+ ListNode *node = node_first;
+
+ while (node)
+ {
+ printf("['%s' (%d)]\n", node->key,
+ ((SoundInfo *)node->content)->num_references);
+ node = node->next;
+ }
+
+ printf("[%d nodes]\n", getNumNodes(node_first));
+}
+
+static void LoadSoundsInfo()
+{
+ char *filename = getCustomSoundConfigFilename();
+ struct SetupFileList *setup_file_list;
+ int i;
+
+ /* always start with reliable default values */
+ for (i=0; i<num_sounds; i++)
+ sound_effect[i].filename = NULL;
+
+ if (filename == NULL)
+ return;
+
+ if ((setup_file_list = loadSetupFileList(filename)))
+ {
+ for (i=0; i<num_sounds; i++)
+ sound_effect[i].filename =
+ getStringCopy(getTokenValue(setup_file_list, sound_effect[i].text));
+
+ freeSetupFileList(setup_file_list);
+
+#if 1
+ for (i=0; i<num_sounds; i++)
+ {
+ printf("'%s' ", sound_effect[i].text);
+ if (sound_effect[i].filename)
+ printf("-> '%s'\n", sound_effect[i].filename);
+ else
+ printf("-> UNDEFINED [-> '%s']\n", sound_effect[i].default_filename);
+ }
+#endif
+ }
+}
+
+static void ReloadCustomSounds()