Author: cazfi
Date: Sun Jan 10 08:40:09 2016
New Revision: 31424

URL: http://svn.gna.org/viewcvs/freeciv?rev=31424&view=rev
Log:
Added soundspec and musicspec support to scripts/capabilities

See patch #6805

Modified:
    trunk/client/audio.c
    trunk/scripts/capabilities

Modified: trunk/client/audio.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/audio.c?rev=31424&r1=31423&r2=31424&view=diff
==============================================================================
--- trunk/client/audio.c        (original)
+++ trunk/client/audio.c        Sun Jan 10 08:40:09 2016
@@ -44,6 +44,9 @@
 #define SNDSPEC_SUFFIX         ".soundspec"
 #define MUSICSPEC_SUFFIX        ".musicspec"
 
+#define SOUNDSPEC_CAPSTR "+Freeciv-soundspec-Devel-2014.Mar.13"
+#define MUSICSPEC_CAPSTR "+Freeciv-musicspec-Devel-2014.Mar.13"
+
 /* keep it open throughout */
 static struct section_file *ss_tagfile = NULL;
 static struct section_file *ms_tagfile = NULL;
@@ -261,8 +264,8 @@
 {
   const char *ss_filename;
   const char *ms_filename;
-  char us_ss_capstr[] = "+Freeciv-soundspec-Devel-2014.Mar.13";
-  char us_ms_capstr[] = "+Freeciv-musicspec-Devel-2014.Mar.13";
+  char us_ss_capstr[] = SOUNDSPEC_CAPSTR;
+  char us_ms_capstr[] = MUSICSPEC_CAPSTR;
 
   if (strcmp(preferred_plugin_name, "none") == 0) {
     /* We explicitly choose none plugin, silently skip the code below */

Modified: trunk/scripts/capabilities
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/scripts/capabilities?rev=31424&r1=31423&r2=31424&view=diff
==============================================================================
--- trunk/scripts/capabilities  (original)
+++ trunk/scripts/capabilities  Sun Jan 10 08:40:09 2016
@@ -16,6 +16,8 @@
 # update capability string for
 # - network
 # - tilespec
+# - soundspec
+# - musicspec
 # - spec
 # - ruleset
 
@@ -34,6 +36,10 @@
   echo "                    (\"+Freeciv.Devel.YYYY.MMM.DD\")"
   echo "        tilespec:   tileset capability"
   echo "                    (\"+Freeciv-tilespec-Devel-YYYY.MMM.DD\")"
+  echo "        soundspec:  soundset capability"
+  echo "                    (\"+Freeciv-soundspec-Devel-YYYY.MMM.DD\")"
+  echo "        musicspec:  musicset capability"
+  echo "                    (\"+Freeciv-musicspec-Devel-YYYY.MMM.DD\")"
   echo "        spec:       spec file capability"
   echo "                    (\"+Freeciv-spec-Devel-YYYY.MMM.DD\")"
   echo "        ruleset:    ruleset capability"
@@ -164,6 +170,64 @@
     done
     ;;
 
+  soundspec )
+    careful
+    echo -e "setting soundspec capability: $string\n"
+    file=`find $basedir -name "audio\.c"`
+
+    old=`cat $file \
+         | grep "#define SOUNDSPEC_CAPSTR" \
+         | sed 's/#define SOUNDSPEC_CAPSTR "\(.*\)".*/\1/'`
+
+    echo "* Replacing \"${old}\" with \"${string}\" in:"
+    cat $file \
+        | sed "s/\"$old/\"$string/g" \
+        > $file.$$
+    cmp $file $file.$$ >/dev/null \
+        || (mv $file.$$ $file && echo "  ${file}")
+    rm -f $file.$$
+
+    files=`find $basedir -name "*\.soundspec"`
+    for file in $files; do
+      cat $file \
+          | sed "s/$old/$string/g" \
+          > $file.$$
+
+      cmp $file $file.$$ >/dev/null \
+        || (mv $file.$$ $file && echo "  ${file}")
+      rm -f $file.$$
+    done
+    ;;
+
+  musicspec )
+    careful
+    echo -e "setting musicspec capability: $string\n"
+    file=`find $basedir -name "audio\.c"`
+
+    old=`cat $file \
+         | grep "#define MUSICSPEC_CAPSTR" \
+         | sed 's/#define MUSICSPEC_CAPSTR "\(.*\)".*/\1/'`
+
+    echo "* Replacing \"${old}\" with \"${string}\" in:"
+    cat $file \
+        | sed "s/\"$old/\"$string/g" \
+        > $file.$$
+    cmp $file $file.$$ >/dev/null \
+        || (mv $file.$$ $file && echo "  ${file}")
+    rm -f $file.$$
+
+    files=`find $basedir -name "*\.musicspec"`
+    for file in $files; do
+      cat $file \
+          | sed "s/$old/$string/g" \
+          > $file.$$
+
+      cmp $file $file.$$ >/dev/null \
+        || (mv $file.$$ $file && echo "  ${file}")
+      rm -f $file.$$
+    done
+    ;;
+
   spec )
     echo -e "setting spec capability: $string\n"
     careful


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to