+ gettimeofday(&now, NULL);
+
+ diff = ((now.tv_sec - last.tv_sec) * 1000000) +
+ (now.tv_usec - last.tv_usec);
+
+ if (diff < 100000)
+ return;
+
+ last = now;
+
+ if (!UserSoundOn) return;
+ if (!SoundInitialized) return;
+
+ for (i = 0; i < SIM_NSOUNDS; i++) {
+ if (!strcmp(sounds[i].id, id))
+ break;
+ }
+
+ snprintf(filename, sizeof(filename), "%s/sounds/%s", ResourceDir,
+ sounds[i].file);
+
+ snprintf(player, sizeof(player), "%s/sounds/player", ResourceDir);
+
+ pid = fork();
+
+ switch(pid) {
+ case 0:
+ execl(player, player, filename, NULL);
+ exit(1);
+ break;
+ case -1:
+ perror("fork failed");
+ break;
+ default:
+ break;
+ }