[Freeciv-Dev] (PR#14182) Unusual nations in scenarious
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#14182) Unusual nations in scenarious |
From: |
"Mateusz Stefek" <mstefek@xxxxxxxxx> |
Date: |
Tue, 4 Oct 2005 01:30:49 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14182 >
We need a way to write a scenario which uses unusual nations without
having to write a new ruleset.
For example, it should be possible to write cold-war scenario with DDR,
CCCP, Yugoslavia and Czechosloviakia. Of course, we don't want these
nations to be choosen in the default game settings.
The attached patch is relatively simple. Having it commited, we can add
some untypical nations to the list in nation.ruleset, but it will be
chooseable in default game if it is also added to the
list.available_nations list.
--
mateusz
? civscore.log
? client/diff.diff
Index: common/nation.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.h,v
retrieving revision 1.58
diff -u -r1.58 nation.h
--- common/nation.h 3 Oct 2005 02:50:44 -0000 1.58
+++ common/nation.h 4 Oct 2005 08:22:44 -0000
@@ -104,7 +104,7 @@
int num_conflicts;
struct nation_type **conflicts_with;
- /* Unavailable nations aren't allowed in the scenario. */
+ /* Unavailable nations aren't allowed to be chosen in the scenario. */
bool is_available;
struct player *player; /* Who's using the nation, or NULL. */
Index: data/default/nations.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/nations.ruleset,v
retrieving revision 1.84
diff -u -r1.84 nations.ruleset
--- data/default/nations.ruleset 3 Oct 2005 02:50:46 -0000 1.84
+++ data/default/nations.ruleset 4 Oct 2005 08:22:44 -0000
@@ -161,3 +161,114 @@
*include "nation/tunisian.ruleset"
*include "nation/uyghur.ruleset"
*include "nation/barbarian.ruleset"
+
+[list]
+available_nations =
+"roman",
+"babylonian",
+"german",
+"egyptian",
+"american",
+"greek",
+"indian",
+"russian",
+"zulu",
+"french",
+"aztec",
+"chinese",
+"english",
+"mongol",
+"turk",
+"spanish",
+"persian",
+"arab",
+"carthaginian",
+"inca",
+"viking",
+"polish",
+"hungarian",
+"danish",
+"dutch",
+"swedish",
+"swiss",
+"japanese",
+"portuguese",
+"finnish",
+"sioux",
+"czech",
+"australian",
+"welsh",
+"korean",
+"scottish",
+"israeli",
+"argentine",
+"canadian",
+"ukrainian",
+"lithuanian",
+"kenyan",
+"dunedain",
+"vietnamese",
+"thai",
+"mordor",
+"bavarian",
+"brazilian",
+"irish",
+"iroquois",
+"cornish",
+"italian",
+"filipino",
+"estonian",
+"latvian",
+"boer",
+"silesian",
+"singaporean",
+"chilean",
+"catalan",
+"croatian",
+"slovakian",
+"slovenian",
+"serbian",
+"ethiopian",
+"afghani",
+"icelandic",
+"assyrian",
+"austrian",
+"belgian",
+"colombian",
+"elves",
+"galician",
+"hobbit",
+"indonesian",
+"kampuchean",
+"malaysian",
+"martian",
+"mexican",
+"new zealand",
+"nigerian",
+"quebecois",
+"sumerian",
+"taiwanese",
+"phoenician",
+"bosnia & herzegovina",
+"byzantine",
+"venezuela",
+"romanian",
+"bulgarian",
+"inuit",
+"british",
+"australian aboriginal",
+"algerian",
+"cuban",
+"iraqi",
+"lankese",
+"libyan",
+"manchu",
+"maori",
+"ryukyuan",
+"sami",
+"sudanese",
+"tibetan",
+"tunisian",
+"uyghur",
+"barbarian"
+
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.286
diff -u -r1.286 ruleset.c
--- server/ruleset.c 3 Oct 2005 02:50:47 -0000 1.286
+++ server/ruleset.c 4 Oct 2005 08:22:46 -0000
@@ -2043,6 +2043,7 @@
int dim, i, j, k, nval, numgroups;
char temp_name[MAX_LEN_NAME];
char **leaders, **sec, **civilwar_nations, **groups, **conflicts;
+ char **chooseable;
char* name;
const char *filename = secfile_filename(file);
@@ -2275,6 +2276,30 @@
memcpy(pl->parent_nations, parents, count * sizeof(parents[0]));
pl->parent_nations[count] = NO_NATION_SELECTED;
} nations_iterate_end;
+
+ /* chooseable nations */
+ chooseable =
+ secfile_lookup_str_vec(file, &dim, "list.available_nations");
+ if (dim != 0) {
+ nations_iterate(n1) {
+ n1->is_available = FALSE;
+ } nations_iterate_end;
+
+ for (i = 0; i < dim; i++) {
+ struct nation_type* nt = find_nation_by_name(chooseable[i]);
+ if (nt != NO_NATION_SELECTED) {
+ nt->is_available = TRUE;
+ } else {
+ freelog(LOG_ERROR, "Unknown nation %s on the list of available
nations",
+ chooseable[i]);
+ }
+ }
+ } else {
+ nations_iterate(n1) {
+ n1->is_available = TRUE;
+ } nations_iterate_end;
+ }
+ free(chooseable);
free(sec);
section_file_check_unused(file, filename);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#14182) Unusual nations in scenarious,
Mateusz Stefek <=
|
|