<URL: http://bugs.freeciv.org/Ticket/Display.html?id=34457 >
Instead of checking if is_ground_unit() or is_heli_unit(), check for
UCF_CAN_OCCUPY. Using same flag for two different things might be bad,
but creating separate flag just for this seemed waste.
- ML
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h 2007-01-23 16:05:15.000000000 +0200
+++ freeciv/common/unittype.h 2007-01-24 18:41:17.000000000 +0200
@@ -28,7 +28,7 @@
enum unit_class_flag_id {
UCF_TERRAIN_SPEED = 0,
UCF_DAMAGE_SLOWS,
- UCF_CAN_OCCUPY,
+ UCF_CAN_OCCUPY, /* Can occupy enemy cities and collect ransom */
UCF_MISSILE,
UCF_ROAD_NATIVE,
UCF_BUILD_ANYWHERE,
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset 2007-01-23 16:05:14.000000000 +0200
+++ freeciv/data/civ1/units.ruleset 2007-01-24 18:43:03.000000000 +0200
@@ -62,6 +62,7 @@
; "TerrainSpeed" = Units use terrain spesific speed
; "DamageSlows" = Damages units are slowed down
; "CanOccupy" = Military units of this class can occupy enemy cities
+; and collect ransom from barbarian leaders
; "Missile" = Unit is destroyed when it attacks
; "RoadNative" = Road tiles are always considered native terrain
; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset 2007-01-23 16:05:15.000000000 +0200
+++ freeciv/data/civ2/units.ruleset 2007-01-24 18:42:22.000000000 +0200
@@ -62,6 +62,7 @@
; "TerrainSpeed" = Units use terrain spesific speed
; "DamageSlows" = Damages units are slowed down
; "CanOccupy" = Military units of this class can occupy enemy cities
+; and collect ransom from barbarian leaders
; "Missile" = Unit is destroyed when it attacks
; "RoadNative" = Road tiles are always considered native terrain
; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset 2007-01-23 16:05:15.000000000 +0200
+++ freeciv/data/default/units.ruleset 2007-01-24 18:42:09.000000000 +0200
@@ -68,6 +68,7 @@
; "TerrainSpeed" = Units use terrain spesific speed
; "DamageSlows" = Damages units are slowed down
; "CanOccupy" = Military units of this class can occupy enemy cities
+; and collect ransom from barbarian leaders
; "Missile" = Unit is destroyed when it attacks
; "RoadNative" = Road tiles are always considered native terrain
; "BuildAnywhere" = Unit can be built even in the middle of non-native terrain
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c 2007-01-22 22:06:23.000000000 +0200
+++ freeciv/server/unittools.c 2007-01-24 18:40:22.000000000 +0200
@@ -1619,7 +1619,9 @@
/* barbarian leader ransom hack */
if( is_barbarian(pplayer) && unit_has_role(punit->type, L_BARBARIAN_LEADER)
&& (unit_list_size(punit->tile->units) == 1)
- && (is_ground_unit(pkiller) || is_heli_unit(pkiller)) ) {
+ && unit_class_flag(get_unit_class(unit_type(pkiller)),
+ UCF_CAN_OCCUPY)) {
+ /* Occupying units can collect ransom if leader is alone in the tile */
ransom = (pplayer->economic.gold >= game.info.ransom_gold)
? game.info.ransom_gold : pplayer->economic.gold;
notify_player(destroyer, pkiller->tile, E_UNIT_WIN_ATT,
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev