Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2319) hot swap sound plugin
Home

[Freeciv-Dev] (PR#2319) hot swap sound plugin

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2319) hot swap sound plugin
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 12 Nov 2002 15:30:01 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, 12 Nov 2002 freeciv@xxxxxxxxxxxxxxxxxxx wrote:
> ---- Log message:
>     Tag: HEAD
>
> Add possibility for callbacks in local options dialog.
>
> Patch by Jason Dorje Short <vze49r5w@xxxxxxxxxxx>

Attached is a follow-up to this which implements hot swap of sound plugins
from within the freeciv client. Just change plugin in the local options
dialog and voila! new sound plugin for you.

  - Per

Index: client/audio.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/audio.c,v
retrieving revision 1.15
diff -u -r1.15 audio.c
--- client/audio.c      7 Nov 2002 16:04:52 -0000       1.15
+++ client/audio.c      12 Nov 2002 23:23:51 -0000
@@ -106,6 +106,16 @@
 }
 
 /**************************************************************************
+  This is merely a wrapper for the below function for use in options.c
+  and the client local options dialog.
+**************************************************************************/
+void audio_select_plugin_callback(struct client_option *option)
+{
+  assert(option->p_string_value && *option->p_string_value);
+  audio_select_plugin(option->p_string_value);
+}
+
+/**************************************************************************
   Choose plugin. Returns TRUE on success, FALSE if not
 **************************************************************************/
 bool audio_select_plugin(const char *const name)
Index: client/audio.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/audio.h,v
retrieving revision 1.4
diff -u -r1.4 audio.h
--- client/audio.h      1 Nov 2002 18:11:42 -0000       1.4
+++ client/audio.h      12 Nov 2002 23:23:51 -0000
@@ -14,6 +14,7 @@
 #define FC__AUDIO_H
 
 #include "shared.h"            /* bool type */
+#include "options.h"
 
 #define MAX_AUDIO_NAME_LEN             20
 #define MAX_AUDIO_DESCR_LEN            200
@@ -42,6 +43,7 @@
 void audio_play_music(const char *const tag, char *const alt_tag);
 
 bool audio_select_plugin(const char *const name);
+void audio_select_plugin_callback(struct client_option *option);
 const char *audio_get_all_plugin_names(void);
 
 #endif                         /* FC__AUDIO_H */
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.69
diff -u -r1.69 options.c
--- client/options.c    12 Nov 2002 23:19:42 -0000      1.69
+++ client/options.c    12 Nov 2002 23:23:51 -0000
@@ -94,7 +94,7 @@
   GEN_STR_OPTION(default_sound_set_name,    N_("Default name of sound set"),
                 get_soundset_list, NULL),
   GEN_STR_OPTION(default_sound_plugin_name, N_("Default sound plugin"),
-                get_soundplugin_list, NULL),
+                get_soundplugin_list, audio_select_plugin_callback),
 
   GEN_BOOL_OPTION(solid_color_behind_units, N_("Solid unit background color")),
   GEN_BOOL_OPTION(sound_bell_at_new_turn,   N_("Sound bell at new turn")),

[Prev in Thread] Current Thread [Next in Thread]