diff -Nur -X no.freeciv freeciv-cvs/common/tech.h freeciv-mod/common/tech.h --- freeciv-cvs/common/tech.h Sun Sep 12 17:52:02 1999 +++ freeciv-mod/common/tech.h Mon Sep 13 17:23:58 1999 @@ -25,10 +25,13 @@ */ #define A_NONE 0 +#define A_FIRST 1 #define A_LAST 89 /* A_NONE is a special tech value, used as a flag in various cases where no tech is required. + + A_FIRST is the first real tech id value A_LAST is a value which is guaranteed to be larger than all actual tech id values. It is used as a flag value; it can diff -Nur -X no.freeciv freeciv-cvs/data/civ1/techs.ruleset freeciv-mod/data/civ1/techs.ruleset --- freeciv-cvs/data/civ1/techs.ruleset Sun Sep 12 17:52:04 1999 +++ freeciv-mod/data/civ1/techs.ruleset Mon Sep 13 18:04:28 1999 @@ -9,7 +9,7 @@ [datafile] description="Civ1-style technology data for Freeciv" -options="1.8.2a" +options="1.8.2a +no_a_none" ; Below: The individual advances, one per section. ; For now, the number of such sections must be kept the same (=89). @@ -29,12 +29,6 @@ ; Special values for req1 and req2 are "None" (first section below) ; and "Never" (never available). If only one tech is required, ; it should be listed as req1. - -[advance_none] ; Don't change this one, and leave it first! -name = "None" -req1 = "None" -req2 = "None" -flags = "" [advance_advanced_flight] name = "Advanced Flight" diff -Nur -X no.freeciv freeciv-cvs/data/civ2/techs.ruleset freeciv-mod/data/civ2/techs.ruleset --- freeciv-cvs/data/civ2/techs.ruleset Sun Sep 12 17:52:05 1999 +++ freeciv-mod/data/civ2/techs.ruleset Mon Sep 13 18:04:51 1999 @@ -9,7 +9,7 @@ [datafile] description="Civ2 technology data for Freeciv (incomplete)" -options="1.8.2a" +options="1.8.2a +no_a_none" ; Below: The individual advances, one per section. ; For now, the number of such sections must be kept the same (=89). @@ -29,12 +29,6 @@ ; Special values for req1 and req2 are "None" (first section below) ; and "Never" (never available). If only one tech is required, ; it should be listed as req1. - -[advance_none] ; Don't change this one, and leave it first! -name = "None" -req1 = "None" -req2 = "None" -flags = "" [advance_advanced_flight] name = "Advanced Flight" diff -Nur -X no.freeciv freeciv-cvs/data/default/techs.ruleset freeciv-mod/data/default/techs.ruleset --- freeciv-cvs/data/default/techs.ruleset Sun Sep 12 17:52:06 1999 +++ freeciv-mod/data/default/techs.ruleset Mon Sep 13 17:19:01 1999 @@ -9,7 +9,7 @@ [datafile] description="Default technology data for Freeciv (as Civ2, minus a few)" -options="1.8.2a" +options="1.8.2a +no_a_none" ; Below: The individual advances, one per section. ; For now, the number of such sections must be kept the same (=89). @@ -43,13 +43,6 @@ ; "Trade_Revenue_Reduce" = When known by the player establishing a trade ; route reduces the initial revenue by cumulative ; factors of 2/3 - - -[advance_none] ; Don't change this one, and leave it first! -name = "None" -req1 = "None" -req2 = "None" -flags = "" [advance_advanced_flight] name = "Advanced Flight" diff -Nur -X no.freeciv freeciv-cvs/server/ruleset.c freeciv-mod/server/ruleset.c --- freeciv-cvs/server/ruleset.c Sun Sep 12 17:52:10 1999 +++ freeciv-mod/server/ruleset.c Mon Sep 13 18:02:22 1999 @@ -341,31 +341,40 @@ char *filename, *datafile_options; char **sec; struct advance *a; - int i, nval; + int num_techs; /* number of techs in the ruleset (means without A_NONE)*/ + int i; filename = openload_ruleset_file(&file, ruleset_subdir, "techs"); - datafile_options = check_ruleset_capabilities(&file, "+1.8.2a", filename); + datafile_options = check_ruleset_capabilities(&file, "+1.8.2a +no_a_none", filename); section_file_lookup(&file,"datafile.description"); /* unused */ /* The names: */ - sec = secfile_get_secnames_prefix(&file, "advance_", &nval); - if(nval != A_LAST) { + sec = secfile_get_secnames_prefix(&file, "advance_", &num_techs); + if(num_techs + A_FIRST != A_LAST) { /* sometime this restriction should be removed */ - freelog(LOG_FATAL, "Bad number of techs %d (%s)", nval, filename); + freelog(LOG_FATAL, "Bad number of techs %d (%s)", num_techs, filename); exit(1); } + /* Initialize dummy tech A_NONE */ + strcpy(advances[A_NONE].name, "None"); + advances[A_NONE].req[0] = A_NONE; + advances[A_NONE].req[1] = A_NONE; + advances[A_NONE].flags = 0; + + a = &advances[A_FIRST]; + /* have to read all names first, so can lookup names for reqs! */ - for( i=0; iname, secfile_lookup_str(&file, "%s.name", sec[i])); + a++; } + + a = &advances[A_FIRST]; - for( i=0; ireq[0] = lookup_tech(&file, sec[i], "req1", 0, filename, a->name); a->req[1] = lookup_tech(&file, sec[i], "req2", 0, filename, a->name); @@ -399,6 +408,8 @@ a->flags |= (1<