<URL: http://bugs.freeciv.org/Ticket/Display.html?id=38378 >
If there is no barbarian nation defined, game will assert later. Atatched patch adds sanity checking to ruleset load. This is for S2_1. Trunk will need different patch, as there land and sea barbarians use separate nations. - ML
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c --- freeciv/server/ruleset.c 2007-03-05 19:13:46.000000000 +0200 +++ freeciv/server/ruleset.c 2007-03-18 16:38:48.000000000 +0200 @@ -2004,6 +2004,7 @@ char **leaders, **sec, **civilwar_nations, **groups, **conflicts; char* name; const char *filename = secfile_filename(file); + int barbarians = 0; (void) check_ruleset_capabilities(file, "+1.9", filename); @@ -2106,6 +2107,17 @@ pl->is_barbarian = secfile_lookup_bool_default(file, FALSE, "%s.is_barbarian", sec[i]); + if (pl->is_barbarian) { + if (pl->is_playable) { + /* We can't allow players to use barbarian nations, barbarians + * may run out of nations */ + freelog(LOG_ERROR, "Nation %s marked both barbarian and playable.", + pl->name); + exit(EXIT_FAILURE); + } + barbarians++; + } + /* Flags */ sz_strlcpy(pl->flag_graphic_str, @@ -2244,6 +2256,12 @@ free(sec); section_file_check_unused(file, filename); section_file_free(file); + + if (barbarians < 1) { + freelog(LOG_FATAL, + "No barbarian nation in rulesets, at least one required!"); + exit(EXIT_FAILURE); + } } /**************************************************************************
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev