Author: sveinung
Date: Mon Jan 25 16:43:39 2016
New Revision: 31591

URL: http://svn.gna.org/viewcvs/freeciv?rev=31591&view=rev
Log:
Document that unupgradeable units don't upgrade.

A unit type without a unit type to upgrade to can never do "Upgrade Unit".
The unit type a unit type upgrades to is currently specified in the
obsolete_by unit type field.

Document that the "Upgrade Unit" action requires the obsolete_by field in
the ruleset comments. This informs the ruleset authors.

Make "Upgrade Unit"'s hard actor unit type requirements aware that an
upgrade target unit type is needed. This informs the auto generated help and
other areas of Freeciv that reason about actions.

See patch #6847

Modified:
    trunk/common/actions.c
    trunk/data/alien/units.ruleset
    trunk/data/civ2civ3/units.ruleset
    trunk/data/classic/units.ruleset
    trunk/data/experimental/units.ruleset
    trunk/data/multiplayer/units.ruleset
    trunk/data/sandbox/units.ruleset
    trunk/data/stub/units.ruleset

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Mon Jan 25 16:43:39 2016
@@ -978,6 +978,13 @@
     }
   }
 
+  if (wanted_action == ACTION_UPGRADE_UNIT) {
+    if (actor_unittype->obsoleted_by == U_NOT_OBSOLETED) {
+      /* Reason: Nothing to upgrade to. */
+      return FALSE;
+    }
+  }
+
   return TRUE;
 }
 

Modified: trunk/data/alien/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/alien/units.ruleset      (original)
+++ trunk/data/alien/units.ruleset      Mon Jan 25 16:43:39 2016
@@ -344,6 +344,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/civ2civ3/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/civ2civ3/units.ruleset   (original)
+++ trunk/data/civ2civ3/units.ruleset   Mon Jan 25 16:43:39 2016
@@ -384,6 +384,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/classic/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/classic/units.ruleset    (original)
+++ trunk/data/classic/units.ruleset    Mon Jan 25 16:43:39 2016
@@ -358,6 +358,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/experimental/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/experimental/units.ruleset       (original)
+++ trunk/data/experimental/units.ruleset       Mon Jan 25 16:43:39 2016
@@ -372,6 +372,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/multiplayer/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/multiplayer/units.ruleset        (original)
+++ trunk/data/multiplayer/units.ruleset        Mon Jan 25 16:43:39 2016
@@ -357,6 +357,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/sandbox/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/sandbox/units.ruleset    (original)
+++ trunk/data/sandbox/units.ruleset    Mon Jan 25 16:43:39 2016
@@ -385,6 +385,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;

Modified: trunk/data/stub/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/units.ruleset?rev=31591&r1=31590&r2=31591&view=diff
==============================================================================
--- trunk/data/stub/units.ruleset       (original)
+++ trunk/data/stub/units.ruleset       Mon Jan 25 16:43:39 2016
@@ -276,6 +276,8 @@
 ;   bombard_rate = the number of shots fired at enemy units when attacking
 ;  "Join City"
 ;   pop_cost = the number of population added to the target city
+;  "Upgrade Unit"
+;   obsolete_by = the unit type upgraded to.
 ;
 ; ** Roles **
 ;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to