Author: cazfi
Date: Sun Jan 10 08:40:15 2016
New Revision: 31425

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

See patch #6805

Modified:
    branches/S2_6/client/audio.c
    branches/S2_6/scripts/capabilities

Modified: branches/S2_6/client/audio.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/audio.c?rev=31425&r1=31424&r2=31425&view=diff
==============================================================================
--- branches/S2_6/client/audio.c        (original)
+++ branches/S2_6/client/audio.c        Sun Jan 10 08:40:15 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: branches/S2_6/scripts/capabilities
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/scripts/capabilities?rev=31425&r1=31424&r2=31425&view=diff
==============================================================================
--- branches/S2_6/scripts/capabilities  (original)
+++ branches/S2_6/scripts/capabilities  Sun Jan 10 08:40:15 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