[Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=7354 >
Jason Dorje Short wrote:
>
> So in the units.ruleset the transporter unit contains something like
>
> transporter_types = "ground"
>
> ?
I answer with this patch. :-)
TODO:
- Remove flags "Carrier" and "MissileCarrier" completely. Requires
some AI changes.
Currently this requires quite a patch stack. Direct requirements are
#13384 (which requires a lot of patches itself) and #18529.
- ML
diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c 2006-07-11 19:05:45.812500000 +0300
+++ freeciv/client/packhand.c 2006-07-12 12:50:48.750000000 +0300
@@ -2189,6 +2189,7 @@
u->paratroopers_mr_req = p->paratroopers_mr_req;
u->paratroopers_mr_sub = p->paratroopers_mr_sub;
u->bombard_rate = p->bombard_rate;
+ u->cargo = p->cargo;
for (i = 0; i < MAX_VET_LEVELS; i++) {
sz_strlcpy(u->veteran[i].name, p->veteran_name[i]);
diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c 2006-07-12 02:30:22.578125000 +0300
+++ freeciv/common/movement.c 2006-07-12 12:41:50.015625000 +0300
@@ -447,36 +447,7 @@
return FALSE;
}
- if (transported->move_type == LAND_MOVING) {
- if ((unit_type_flag(transporter, F_CARRIER)
- || unit_type_flag(transporter, F_MISSILE_CARRIER))) {
- return FALSE;
- }
- return TRUE;
- }
-
- if (!unit_class_flag(transported, UCF_MISSILE)
- && unit_type_flag(transporter, F_MISSILE_CARRIER)) {
- return FALSE;
- }
-
- if (unit_class_flag(transported, UCF_MISSILE)) {
- if (!unit_type_flag(transporter, F_MISSILE_CARRIER)
- && !unit_type_flag(transporter, F_CARRIER)) {
- return FALSE;
- }
- } else if ((transported->move_type == AIR_MOVING
- || transported->move_type == HELI_MOVING)
- && !unit_type_flag(transporter, F_CARRIER)) {
- return FALSE;
- }
-
- if (transported->move_type == SEA_MOVING) {
- /* No unit can transport sea units at the moment */
- return FALSE;
- }
-
- return TRUE;
+ return BV_ISSET(transporter->cargo, transported->id);
}
/**************************************************************************
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def 2006-07-12 12:39:22.453125000 +0300
+++ freeciv/common/packets.def 2006-07-12 12:49:35.656250000 +0300
@@ -1078,6 +1078,8 @@
UINT8 bombard_rate;
+ BV_UNIT_CLASSES cargo;
+
STRING helptext[MAX_LEN_PACKET];
BV_FLAGS flags;
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h 2006-07-12 12:39:22.484375000 +0300
+++ freeciv/common/unittype.h 2006-07-12 12:40:17.984375000 +0300
@@ -193,6 +193,8 @@
int bombard_rate;
struct unit_class *class;
+
+ bv_unit_classes cargo;
char *helptext;
};
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset 2006-07-11 19:06:05.203125000 +0300
+++ freeciv/data/civ1/units.ruleset 2006-07-12 12:59:17.281250000 +0300
@@ -115,6 +115,7 @@
; fuel = number of turns air units can fly before they crash. For
; barbarians this is used as lifetime instead
; uk_* = upkeep costs, these are used as base values in the game
+; cargo = Unit classes this unit can transport
; flags = special flag strings
; roles = special role strings
; sound_move = optional sound effect when the unit moves
@@ -642,6 +643,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "Trireme"
roles = "Ferryboat"
@@ -670,6 +672,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = ""
roles = "Ferryboat", "BarbarianBoat"
@@ -698,6 +701,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = ""
roles = "Ferryboat"
@@ -842,6 +846,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Air", "Missile"
flags = "Carrier"
roles = ""
helptext = _("\
@@ -875,6 +880,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = ""
roles = "Ferryboat"
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset 2006-07-11 19:06:06.718750000 +0300
+++ freeciv/data/civ2/units.ruleset 2006-07-12 12:57:54.843750000 +0300
@@ -127,6 +127,7 @@
; fuel = number of turns air units can fly before they crash. For
; barbarians this is used as lifetime instead
; uk_* = upkeep costs, these are used as base values in the game
+; cargo = Unit classes this unit can transport
; flags = special flag strings
; roles = special role strings
; sound_move = optional sound effect when the unit moves
@@ -1143,6 +1144,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "Trireme", "BadCityDefender"
roles = "Ferryboat"
@@ -1171,6 +1173,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat", "BarbarianBoat"
@@ -1199,6 +1202,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat", "BarbarianBoat"
@@ -1227,6 +1231,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Hunter"
@@ -1399,6 +1404,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Missile"
flags = "Partial_Invis", "BadCityDefender",
"Missile_Carrier", "No_Land_Attack"
roles = "Hunter"
@@ -1432,6 +1438,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Air", "Missile"
flags = "Carrier"
roles = ""
helptext = _("\
@@ -1465,6 +1472,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat"
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset 2006-07-11 19:06:08.750000000 +0300
+++ freeciv/data/default/units.ruleset 2006-07-12 12:55:37.421875000 +0300
@@ -136,6 +136,7 @@
; barbarians this is used as lifetime instead. If this is zero,
; the unit has unlimited fuel, despite flying.
; uk_* = upkeep costs, these are used as base values in the game
+; cargo = Unit classes this unit can transport
; flags = special flag strings
; roles = special role strings
; sound_move = optional sound effect when the unit moves
@@ -1198,6 +1199,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "Trireme", "BadCityDefender"
roles = "Ferryboat"
@@ -1226,6 +1228,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat", "BarbarianBoat"
@@ -1254,6 +1257,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat", "BarbarianBoat"
@@ -1282,6 +1286,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Hunter"
@@ -1454,6 +1459,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Missile"
flags = "Partial_Invis", "BadCityDefender",
"Missile_Carrier", "No_Land_Attack"
roles = "Hunter"
@@ -1487,6 +1493,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Air", "Missile"
flags = "Carrier", "BadCityDefender"
roles = ""
helptext = _("\
@@ -1520,6 +1527,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
+cargo = "Land"
flags = "BadCityDefender"
roles = "Ferryboat"
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c 2006-07-11 19:08:17.484375000 +0300
+++ freeciv/server/ruleset.c 2006-07-12 12:50:12.687500000 +0300
@@ -1168,6 +1168,21 @@
get_output_identifier(o));
} output_type_iterate_end;
+ slist = secfile_lookup_str_vec(file, &nval, "%s.cargo", sec[i]);
+ BV_CLR_ALL(u->cargo);
+ for (j = 0; j < nval; j++) {
+ struct unit_class *class = unit_class_from_str(slist[j]);
+
+ if (!class) {
+ /* TRANS: message for an obscure ruleset error. */
+ freelog(LOG_FATAL, _("Unit %s has unknown unit class %s as cargo."),
+ u->name, slist[j]);
+ exit(EXIT_FAILURE);
+ }
+
+ BV_SET(u->cargo, class->id);
+ }
+
u->helptext = lookup_helptext(file, sec[i]);
u->paratroopers_range = secfile_lookup_int_default(file,
@@ -2731,6 +2746,7 @@
packet.paratroopers_mr_req = u->paratroopers_mr_req;
packet.paratroopers_mr_sub = u->paratroopers_mr_sub;
packet.bombard_rate = u->bombard_rate;
+ packet.cargo = u->cargo;
for (i = 0; i < MAX_VET_LEVELS; i++) {
sz_strlcpy(packet.veteran_name[i], u->veteran[i].name);
packet.power_fact[i] = u->veteran[i].power_fact;
diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in
--- freeciv/version.in 2006-07-11 19:08:31.906250000 +0300
+++ freeciv/version.in 2006-07-12 12:47:24.718750000 +0300
@@ -24,4 +24,4 @@
# - Avoid adding a new manditory capbility to the development branch for
# as long as possible. We want to maintain network compatibility with
# the stable branch for as long as possible.
-FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2006.Jul.10")
+FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2006.Jul.12")
- [Freeciv-Dev] (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Marko Lindqvist, 2006/07/10
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Jason Dorje Short, 2006/07/10
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset,
Marko Lindqvist <=
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Marko Lindqvist, 2006/07/13
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Jason Dorje Short, 2006/07/13
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Marko Lindqvist, 2006/07/13
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Jason Dorje Short, 2006/07/13
- [Freeciv-Dev] Re: (PR#7354) Re: (PR#7668) transporter types should be in the ruleset, Marko Lindqvist, 2006/07/13
|
|