Author: cazfi
Date: Wed Aug 10 20:49:32 2016
New Revision: 33547

URL: http://svn.gna.org/viewcvs/freeciv?rev=33547&view=rev
Log:
Added support for field "for_ruleset" in .tilespec files. If it's set in 
currently loaded tileset,
client forked server will start with that ruleset. 

See patch #7577

Modified:
    trunk/client/connectdlg_common.c
    trunk/client/tilespec.c
    trunk/client/tilespec.h
    trunk/data/alio.tilespec
    trunk/data/amplio.tilespec
    trunk/data/amplio2.tilespec
    trunk/data/cimpletoon.tilespec
    trunk/data/hex2t.tilespec
    trunk/data/hexemplio.tilespec
    trunk/data/isophex.tilespec
    trunk/data/isotrident.tilespec
    trunk/data/toonhex.tilespec
    trunk/data/trident.tilespec

Modified: trunk/client/connectdlg_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/connectdlg_common.c?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/client/connectdlg_common.c    (original)
+++ trunk/client/connectdlg_common.c    Wed Aug 10 20:49:32 2016
@@ -225,6 +225,7 @@
   char savesdir[MAX_LEN_PATH];
   char scensdir[MAX_LEN_PATH];
   char *storage;
+  char *ruleset;
 
 #if !defined(HAVE_USABLE_FORK)
   /* Above also implies that this is FREECIV_MSWINDOWS ->
@@ -232,8 +233,9 @@
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
 
-  char options[512];
+  char options[1024];
   char *depr;
+  char rsparam[256];
 #ifdef FREECIV_DEBUG
   char cmdline1[512];
 #ifndef FREECIV_WEB
@@ -284,10 +286,12 @@
     return FALSE;
   }
 
+  ruleset = tileset_what_ruleset(tileset);
+
 #ifdef HAVE_USABLE_FORK
   {
     int argc = 0;
-    const int max_nargs = 23;
+    const int max_nargs = 25;
     char *argv[max_nargs + 1];
     char port_buf[32];
     char dbg_lvl_buf[32]; /* Do not move this inside the block where it gets 
filled,
@@ -336,6 +340,10 @@
     if (are_deprecation_warnings_enabled()) {
       argv[argc++] = "--warnings";
     }
+    if (ruleset != NULL) {
+      argv[argc++] = "--ruleset";
+      argv[argc++] = ruleset;
+    }
     argv[argc] = NULL;
     fc_assert(argc <= max_nargs);
 
@@ -469,12 +477,17 @@
   } else {
     depr = "";
   }
+  if (ruleset != NULL) {
+    fc_snprintf(rsparam, sizeof(rsparam), " --ruleset %s", ruleset);
+  } else {
+    rsparam[0] = '\0';
+  }
 
   fc_snprintf(options, sizeof(options),
               "-p %d --bind localhost -q 1 -e%s%s%s --saves \"%s\" "
-              "--scenarios \"%s\" -A none %s",
+              "--scenarios \"%s\" -A none %s%s",
               internal_server_port, logcmdline, scriptcmdline, savefilecmdline,
-              savescmdline, scenscmdline, depr);
+              savescmdline, scenscmdline, rsparam, depr);
 #ifdef FREECIV_DEBUG
 #ifdef FREECIV_WEB
   fc_snprintf(cmdline1, sizeof(cmdline1),

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/client/tilespec.c     (original)
+++ trunk/client/tilespec.c     Wed Aug 10 20:49:32 2016
@@ -462,6 +462,8 @@
   char *summary;
   char *description;
 
+  char *for_ruleset;
+
   enum ts_type type;
   int hex_width, hex_height;
   int ts_topo_idx;
@@ -1167,6 +1169,10 @@
   if (t->description != NULL) {
     free(t->description);
     t->description = NULL;
+  }
+  if (t->for_ruleset != NULL) {
+    free(t->for_ruleset);
+    t->for_ruleset = NULL;
   }
 }
 
@@ -1771,6 +1777,13 @@
       free(t->description);
       t->description = NULL;
     }
+  }
+
+  tstr = secfile_lookup_str_default(file, NULL, "tilespec.for_ruleset");
+  if (tstr != NULL) {
+    t->for_ruleset = fc_strdup(tstr);
+  } else {
+    t->for_ruleset = NULL;
   }
 
   sz_strlcpy(t->name, tileset_name);
@@ -6757,6 +6770,14 @@
 }
 
 /****************************************************************************
+  Return what ruleset this tileset is primarily meant for
+****************************************************************************/
+char *tileset_what_ruleset(struct tileset *t)
+{
+  return t->for_ruleset;
+}
+
+/****************************************************************************
   Return tileset topology index
 ****************************************************************************/
 int tileset_topo_index(struct tileset *t)

Modified: trunk/client/tilespec.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.h?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/client/tilespec.h     (original)
+++ trunk/client/tilespec.h     Wed Aug 10 20:49:32 2016
@@ -408,6 +408,7 @@
 const char *tileset_version(struct tileset *t);
 const char *tileset_summary(struct tileset *t);
 const char *tileset_description(struct tileset *t);
+char *tileset_what_ruleset(struct tileset *t);
 int tileset_topo_index(struct tileset *t);
 
 #ifdef __cplusplus

Modified: trunk/data/alio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alio.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/alio.tilespec    (original)
+++ trunk/data/alio.tilespec    Wed Aug 10 20:49:32 2016
@@ -23,6 +23,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+for_ruleset = "alien"
 
 ; Basic tile sizes:
 normal_tile_width  = 126

Modified: trunk/data/amplio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/amplio.tilespec  (original)
+++ trunk/data/amplio.tilespec  Wed Aug 10 20:49:32 2016
@@ -17,6 +17,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 96

Modified: trunk/data/amplio2.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio2.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/amplio2.tilespec (original)
+++ trunk/data/amplio2.tilespec Wed Aug 10 20:49:32 2016
@@ -17,6 +17,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 96

Modified: trunk/data/cimpletoon.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/cimpletoon.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/cimpletoon.tilespec      (original)
+++ trunk/data/cimpletoon.tilespec      Wed Aug 10 20:49:32 2016
@@ -21,6 +21,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 96

Modified: trunk/data/hex2t.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hex2t.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/hex2t.tilespec   (original)
+++ trunk/data/hex2t.tilespec   Wed Aug 10 20:49:32 2016
@@ -17,6 +17,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 40

Modified: trunk/data/hexemplio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hexemplio.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/hexemplio.tilespec       (original)
+++ trunk/data/hexemplio.tilespec       Wed Aug 10 20:49:32 2016
@@ -19,6 +19,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 126

Modified: trunk/data/isophex.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/isophex.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/isophex.tilespec (original)
+++ trunk/data/isophex.tilespec Wed Aug 10 20:49:32 2016
@@ -17,6 +17,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 64

Modified: trunk/data/isotrident.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/isotrident.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/isotrident.tilespec      (original)
+++ trunk/data/isotrident.tilespec      Wed Aug 10 20:49:32 2016
@@ -17,6 +17,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 64

Modified: trunk/data/toonhex.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/toonhex.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/toonhex.tilespec (original)
+++ trunk/data/toonhex.tilespec Wed Aug 10 20:49:32 2016
@@ -20,6 +20,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 126

Modified: trunk/data/trident.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/trident.tilespec?rev=33547&r1=33546&r2=33547&view=diff
==============================================================================
--- trunk/data/trident.tilespec (original)
+++ trunk/data/trident.tilespec Wed Aug 10 20:49:32 2016
@@ -16,6 +16,9 @@
 
 ; TODO: add more overall information fields on tiles, 
 ; eg, authors, colors, etc.
+
+; What is the primary ruleset this tileset is meant for.
+;for_ruleset = ""
 
 ; Basic tile sizes:
 normal_tile_width  = 30


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

Reply via email to