diff -ruN freeciv.orig/common/map.c freeciv/common/map.c --- freeciv.orig/common/map.c Sat Jun 17 20:05:20 2000 +++ freeciv/common/map.c Sun Jun 18 11:27:06 2000 @@ -58,6 +58,16 @@ "Airbase" }; +/* Names of terrain flags. + * (These must correspond to enum terrain_flag in terrain.h.) + */ +static char *terrain_flag_names[] = { + "Land", + "Ocean", + "SweetWater", + NULL +}; + /*************************************************************** Return a (static) string with terrain name; eg: "Hills" @@ -220,6 +230,19 @@ } return NULL; +} + +/*************************************************************** +translates string to terrain flag +***************************************************************/ +enum terrain_flag terrain_flag_from_str (char *s) { + int i; + + for (i=0; terrain_flag_names[i]; i++) + if ( !strcmp (terrain_flag_names[i], s)) + return 1<transform_time = secfile_lookup_int(&file, "%s.transform_time", sec[i]); t->helptext = lookup_helptext(&file, sec[i]); - } + slist = secfile_lookup_str_vec (&file, &nval, "%s.flags", sec[i]); + + for (j=0; jflags |= terrain_flag_from_str (sval); + } + free(slist); + + if (! (t->flags & (TF_OCEAN | TF_LAND))) { + freelog ( LOG_FATAL, "Terrain %s is neither Land or Ocean (%s)", + t->terrain_name, filename); + exit (1); + } + /* We will, of course, support it later */ + if ((t->flags & TF_OCEAN) && (t->flags & TF_LAND)) { + freelog ( LOG_FATAL, "Terrain %s is both Land and Ocean (%s)", + t->terrain_name, filename); + exit (1); + } + } section_file_check_unused(&file, filename); section_file_free(&file);