Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9357) New unit flag: NoBuild
Home

[Freeciv-Dev] (PR#9357) New unit flag: NoBuild

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9357) New unit flag: NoBuild
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 12 Jul 2004 15:54:15 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9357 >

Barbarian leader has an ugly kludge preventing it from being built - it is
obsoleted by settlers. So when you make a modpack where one nation has no
settlers, you can build barbarian leaders!

Bad.

This patch introduces a new flag, "NoBuild", that prevents this unit from
ever being built.

  - Per

Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.28
diff -u -r1.28 unittype.h
--- common/unittype.h   6 Jul 2004 21:48:48 -0000       1.28
+++ common/unittype.h   12 Jul 2004 22:46:51 -0000
@@ -118,6 +118,7 @@
   F_NO_VETERAN,       /* Cannot increase veteran level */
   F_BOMBARDER,        /* Has the ability to bombard */
   F_CITYBUSTER,       /* Gets double firepower against cities */
+  F_NOBUILD,          /* Unit cannot be built (barb leader etc) */
   F_LAST
 };
 #define F_MAX 64
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.35
diff -u -r1.35 unittype.c
--- common/unittype.c   6 Jul 2004 21:48:48 -0000       1.35
+++ common/unittype.c   12 Jul 2004 22:46:52 -0000
@@ -47,7 +47,7 @@
   "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
-  "CityBuster"
+  "CityBuster", "NoBuild"
 };
 static const char *role_names[] = {
   "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
@@ -475,6 +475,9 @@
     return FALSE;
   if (unit_type_flag(id, F_NUCLEAR) && game.global_wonders[B_MANHATTEN] == 0)
     return FALSE;
+  if (unit_type_flag(id, F_NOBUILD)) {
+    return FALSE;
+  }
   if (unit_type_flag(id, F_FANATIC)
       && !government_has_flag(get_gov_pplayer(p), G_FANATIC_TROOPS))
     return FALSE;
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.58
diff -u -r1.58 units.ruleset
--- data/default/units.ruleset  3 Jul 2004 17:11:35 -0000       1.58
+++ data/default/units.ruleset  12 Jul 2004 22:46:52 -0000
@@ -1822,7 +1822,7 @@
 name          = _("Barbarian Leader")
 move_type     = "Land"
 tech_req      = "None"
-obsolete_by   = "Settlers"    ; Ugly hack, to prevent anyone from building it
+obsolete_by   = "None"
 graphic       = "u.barbarian_leader"
 graphic_alt   = "u.diplomat"
 sound_move    = "m_barbarian_leader"
@@ -1844,7 +1844,7 @@
 uk_food       = 0
 uk_gold       = 0
 flags         = "IgZOC", "NonMil", "Unbribable",
-                "Undisbandable", "SuperSpy", "NoHome"
+                "Undisbandable", "SuperSpy", "NoHome", "NoBuild"
 roles         = "BarbarianLeader"
 helptext      = _("\
 When barbarian leader is killed on a tile without any defending units, \

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9357) New unit flag: NoBuild, Per Inge Mathisen <=