<URL: http://bugs.freeciv.org/Ticket/Display.html?id=37295 >
On 3/2/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
> On 3/1/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
> >
> > This adds "native_to" list of unit classes to base. Base affects
> > mostly only those units.
>
> - Send info to client too
- Updated against svn
- ML
diff -Nurd -X.diff_ignore freeciv/ai/aiair.c freeciv/ai/aiair.c
--- freeciv/ai/aiair.c 2007-01-24 16:33:25.000000000 +0200
+++ freeciv/ai/aiair.c 2007-03-04 22:56:22.000000000 +0200
@@ -228,7 +228,8 @@
bool found = FALSE;
airbase_iterator
- = refuel_iterate_init(unit_owner(punit), punit->tile,
+ = refuel_iterate_init(unit_owner(punit), unit_type(punit),
+ punit->tile,
punit->tile, TRUE,
punit->moves_left / SINGLE_MOVE,
unit_move_rate(punit) / SINGLE_MOVE,
diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c 2007-03-04 18:03:59.000000000 +0200
+++ freeciv/client/packhand.c 2007-03-04 22:56:22.000000000 +0200
@@ -2479,6 +2479,8 @@
}
assert(pbase->reqs.size == p->reqs_count);
+ pbase->native_to = p->native_to;
+
pbase->flags = p->flags;
}
diff -Nurd -X.diff_ignore freeciv/common/aicore/pf_tools.c freeciv/common/aicore/pf_tools.c
--- freeciv/common/aicore/pf_tools.c 2007-03-02 18:29:07.000000000 +0200
+++ freeciv/common/aicore/pf_tools.c 2007-03-04 22:56:22.000000000 +0200
@@ -546,13 +546,17 @@
enum known_type known,
struct pf_parameter *param)
{
+ struct base_type *pbase;
+
/* FIXME: bombers with fuel remaining should not worry about danger. */
if (is_allied_city_tile(ptile, param->owner)) {
return FALSE;
}
- if (tile_has_base_flag(ptile, BF_REFUEL)) {
+ pbase = tile_get_base(ptile);
+
+ if (pbase && is_native_base_to_class(param->class, pbase)) {
/* All airbases are considered non-dangerous, although non-allied ones
* are inaccessible. */
return FALSE;
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c 2007-03-02 15:10:46.000000000 +0200
+++ freeciv/common/base.c 2007-03-04 22:56:22.000000000 +0200
@@ -24,9 +24,8 @@
static struct base_type base_types[BASE_LAST];
static const char *base_type_flag_names[] = {
- "NoAggressive", "DefenseBonus", "NoStackDeath", "Watchtower",
- "ClaimTerritory", "DiplomatDefense", "Refuel", "NoHPLoss",
- "AttackUnreachable", "ParadropFrom"
+ "NoAggressive", "DefenseBonus", "NoStackDeath",
+ "ClaimTerritory", "DiplomatDefense", "ParadropFrom"
};
/****************************************************************************
@@ -37,6 +36,35 @@
return BV_ISSET(pbase->flags, flag);
}
+/****************************************************************************
+ Is base native to unit class?
+****************************************************************************/
+bool is_native_base_to_class(const struct unit_class *pclass,
+ const struct base_type *pbase)
+{
+ return BV_ISSET(pbase->native_to, pclass->id);
+}
+
+/****************************************************************************
+ Is base native to unit?
+****************************************************************************/
+bool is_native_base(const struct unit_type *punittype,
+ const struct base_type *pbase)
+{
+ return is_native_base_to_class(get_unit_class(punittype), pbase);
+}
+
+/****************************************************************************
+ Base provides base flag for unit? Checks if base provides flag and if
+ base is native to unit.
+****************************************************************************/
+bool base_flag_affects_unit(const struct unit_type *punittype,
+ const struct base_type *pbase,
+ enum base_flag_id flag)
+{
+ return base_flag(pbase, flag) && is_native_base(punittype, pbase);
+}
+
/**************************************************************************
Return the translated name of the base type.
**************************************************************************/
diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h
--- freeciv/common/base.h 2007-03-03 23:02:08.000000000 +0200
+++ freeciv/common/base.h 2007-03-04 22:56:22.000000000 +0200
@@ -26,12 +26,8 @@
* if base is close to city */
BF_DEFENSE_BONUS, /* Base provides defense bonus for units inside */
BF_NO_STACK_DEATH, /* Units inside will not die all at once */
- BF_WATCHTOWER, /* Base can act as watchtower */
BF_CLAIM_TERRITORY, /* Base claims tile ownership */
BF_DIPLOMAT_DEFENSE, /* Base provides bonus for defending diplomat */
- BF_REFUEL, /* Base refuels units */
- BF_NO_HP_LOSS, /* Units do not lose hitpoints when in base */
- BF_ATTACK_UNREACHABLE, /* Unreachable units inside base can be attacked */
BF_PARADROP_FROM, /* Paratroopers can use base for paradrop */
BF_LAST /* This has to be last */
};
@@ -43,10 +39,19 @@
char name_orig[MAX_LEN_NAME];
int id;
struct requirement_vector reqs;
+ bv_unit_classes native_to;
+
bv_base_flags flags;
};
bool base_flag(const struct base_type *pbase, enum base_flag_id flag);
+bool is_native_base(const struct unit_type *punittype,
+ const struct base_type *pbase);
+bool is_native_base_to_class(const struct unit_class *pclass,
+ const struct base_type *pbase);
+bool base_flag_affects_unit(const struct unit_type *punittype,
+ const struct base_type *pbase,
+ enum base_flag_id flag);
const char *base_name(const struct base_type *pbase);
bool can_build_base(const struct unit *punit, const struct base_type *pbase,
diff -Nurd -X.diff_ignore freeciv/common/combat.c freeciv/common/combat.c
--- freeciv/common/combat.c 2007-01-23 16:05:15.000000000 +0200
+++ freeciv/common/combat.c 2007-03-04 22:56:22.000000000 +0200
@@ -96,7 +96,7 @@
/* 2. Only fighters can attack planes, except in city or airbase attacks */
if (!unit_flag(punit, F_ATTACK_ANY)
&& unit_class_flag(get_unit_class(unit_type(pdefender)), UCF_UNREACHABLE)
- && !(pcity || tile_has_base_flag(dest_tile, BF_ATTACK_UNREACHABLE))) {
+ && !(pcity || tile_has_native_base(dest_tile, unit_type(pdefender)))) {
return FALSE;
}
@@ -454,7 +454,7 @@
}
}
- if (tile_has_base_flag(ptile, BF_DEFENSE_BONUS) && !pcity) {
+ if (tile_has_base_flag_for_unit(ptile, def_type, BF_DEFENSE_BONUS) && !pcity) {
defensepower +=
(defensepower * terrain_control.fortress_defense_bonus) / 100;
}
diff -Nurd -X.diff_ignore freeciv/common/movement.c freeciv/common/movement.c
--- freeciv/common/movement.c 2007-03-03 23:18:05.000000000 +0200
+++ freeciv/common/movement.c 2007-03-04 23:00:02.000000000 +0200
@@ -272,13 +272,18 @@
return TRUE;
}
- if (unit_type(punit)->fuel > 0
- && !tile_has_base_flag(punit->tile, BF_REFUEL)) {
+ if (tile_has_native_base(ptile, unit_type(punit))) {
+ /* Unit can always survive at native base */
+ return TRUE;
+ }
+
+ if (unit_type(punit)->fuel > 0) {
+ /* Unit requires fuel and this is not refueling tile */
return FALSE;
}
- if (is_losing_hp(punit)
- && !tile_has_base_flag(punit->tile, BF_NO_HP_LOSS)) {
+ if (is_losing_hp(punit)) {
+ /* Unit is losing HP over time in this tile (no city or native base) */
return FALSE;
}
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def 2007-03-03 23:02:08.000000000 +0200
+++ freeciv/common/packets.def 2007-03-04 22:56:23.000000000 +0200
@@ -1272,6 +1272,7 @@
STRING name[MAX_LEN_NAME];
UINT8 reqs_count;
REQUIREMENT reqs[MAX_NUM_REQS:reqs_count];
+ BV_UNIT_CLASSES native_to;
BV_BASE_FLAGS flags;
end
diff -Nurd -X.diff_ignore freeciv/common/tile.c freeciv/common/tile.c
--- freeciv/common/tile.c 2007-02-28 23:02:38.000000000 +0200
+++ freeciv/common/tile.c 2007-03-04 22:56:23.000000000 +0200
@@ -156,6 +156,45 @@
}
/****************************************************************************
+ Check if tile contains base providing effect for unit
+****************************************************************************/
+bool tile_has_base_flag_for_unit(const struct tile *ptile,
+ const struct unit_type *punittype,
+ enum base_flag_id flag)
+{
+ struct base_type *pbase;
+
+ pbase = tile_get_base(ptile);
+
+ if (pbase != NULL) {
+ /* Some base at tile, check its flags */
+ return base_flag_affects_unit(punittype, pbase, flag);
+ }
+
+ /* No base at tile */
+ return FALSE;
+}
+
+/****************************************************************************
+ Check if tile contains base native for unit
+****************************************************************************/
+bool tile_has_native_base(const struct tile *ptile,
+ const struct unit_type *punittype)
+{
+ struct base_type *pbase;
+
+ pbase = tile_get_base(ptile);
+
+ if (pbase != NULL) {
+ /* Some base at tile, check if it's native */
+ return is_native_base(punittype, pbase);
+ }
+
+ /* No base at tile */
+ return FALSE;
+}
+
+/****************************************************************************
Add the given special or specials to the tile.
Note that this does not erase any existing specials already on the tile
diff -Nurd -X.diff_ignore freeciv/common/tile.h freeciv/common/tile.h
--- freeciv/common/tile.h 2007-02-28 23:02:38.000000000 +0200
+++ freeciv/common/tile.h 2007-03-04 22:56:23.000000000 +0200
@@ -67,6 +67,11 @@
void tile_add_base(struct tile *ptile, const struct base_type *pbase);
void tile_remove_base(struct tile *ptile);
bool tile_has_base_flag(const struct tile *ptile, enum base_flag_id flag);
+bool tile_has_base_flag_for_unit(const struct tile *ptile,
+ const struct unit_type *punittype,
+ enum base_flag_id flag);
+bool tile_has_native_base(const struct tile *ptile,
+ const struct unit_type *punittype);
const struct resource *tile_get_resource(const struct tile *ptile);
void tile_set_resource(struct tile *ptile, const struct resource *presource);
void tile_clear_special(struct tile *ptile, enum tile_special_type spe);
diff -Nurd -X.diff_ignore freeciv/common/unit.c freeciv/common/unit.c
--- freeciv/common/unit.c 2007-03-04 22:55:02.000000000 +0200
+++ freeciv/common/unit.c 2007-03-04 22:56:23.000000000 +0200
@@ -650,6 +650,8 @@
return FALSE;
if (tile_has_base_flag(punit->tile, BF_PARADROP_FROM)) {
+ /* Paradrop has to be possible from non-native base.
+ * Paratroopers are "Land" units, but they can paradrom from Airbase. */
return TRUE;
}
@@ -1207,7 +1209,9 @@
return FALSE;
}
if (is_ground_unit(punit) &&
- tile_has_base_flag(punit->tile, BF_NOT_AGGRESSIVE)) {
+ tile_has_base_flag_for_unit(punit->tile,
+ unit_type(punit),
+ BF_NOT_AGGRESSIVE)) {
return !is_unit_near_a_friendly_city (punit);
}
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset 2007-03-04 22:55:01.000000000 +0200
+++ freeciv/data/civ1/terrain.ruleset 2007-03-04 22:56:23.000000000 +0200
@@ -603,12 +603,8 @@
; - "NoAggressive" = Units inside are not considered aggressive
; - "DefenseBonus" = Units inside gain defense bonus
; - "NoStackDeath" = Units inside do not die all at once when attacked
-; - "Watchtower" = Units inside see further if required tech known
; - "ClaimTerritory" = Base will claim land ownership
; - "DiplomatDefense" = Diplomats inside get bonus to diplomatic defense
-; - "Refuel" = Units can refuel at base
-; - "NoHPLoss" = Units inside avoid HP loss over time
-; - "AttackUnreachable" = Unreachable units inside can be attacked
; - "ParadropFrom" = Paradrop can be initiated from base
[fortress]
@@ -618,7 +614,8 @@
"Tech", "Construction", "Player"
"TerrainClass", "Land", "Local"
}
-flags = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
+native_to = "Land"
+flags = "NoAggressive", "DefenseBonus", "ClaimTerritory",
"NoStackDeath", "DiplomatDefense"
[airbase]
@@ -627,5 +624,5 @@
{ "type", "name", "range"
"Tech", "Never", "Player"
}
-flags = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
- "AttackUnreachable", "ParadropFrom"
+native_to = "Air", "Missile"
+flags = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset 2007-03-04 22:55:02.000000000 +0200
+++ freeciv/data/civ2/terrain.ruleset 2007-03-04 22:56:23.000000000 +0200
@@ -695,12 +695,8 @@
; - "NoAggressive" = Units inside are not considered aggressive
; - "DefenseBonus" = Units inside gain defense bonus
; - "NoStackDeath" = Units inside do not die all at once when attacked
-; - "Watchtower" = Units inside see further if required tech known
; - "ClaimTerritory" = Base will claim land ownership
; - "DiplomatDefense" = Diplomats inside get bonus to diplomatic defense
-; - "Refuel" = Units can refuel at base
-; - "NoHPLoss" = Units inside avoid HP loss over time
-; - "AttackUnreachable" = Unreachable units inside can be attacked
; - "ParadropFrom" = Paradrop can be initiated from base
[fortress]
@@ -710,7 +706,8 @@
"Tech", "Construction", "Player"
"TerrainClass", "Land", "Local"
}
-flags = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
+native_to = "Land"
+flags = "NoAggressive", "DefenseBonus", "ClaimTerritory",
"NoStackDeath", "DiplomatDefense"
[airbase]
@@ -720,5 +717,5 @@
"Tech", "Radio", "Player"
"TerrainClass", "Land", "Local"
}
-flags = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
- "AttackUnreachable", "ParadropFrom"
+native_to = "Air", "Helicopter", "Missile"
+flags = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset
--- freeciv/data/default/terrain.ruleset 2007-03-04 22:55:02.000000000 +0200
+++ freeciv/data/default/terrain.ruleset 2007-03-04 22:56:23.000000000 +0200
@@ -762,12 +762,8 @@
; - "NoAggressive" = Units inside are not considered aggressive
; - "DefenseBonus" = Units inside gain defense bonus
; - "NoStackDeath" = Units inside do not die all at once when attacked
-; - "Watchtower" = Units inside see further if required tech known
; - "ClaimTerritory" = Base will claim land ownership
; - "DiplomatDefense" = Diplomats inside get bonus to diplomatic defense
-; - "Refuel" = Units can refuel at base
-; - "NoHPLoss" = Units inside avoid HP loss over time
-; - "AttackUnreachable" = Unreachable units inside can be attacked
; - "ParadropFrom" = Paradrop can be initiated from base
[fortress]
@@ -777,7 +773,8 @@
"Tech", "Construction", "Player"
"TerrainClass", "Land", "Local"
}
-flags = "NoAggressive", "DefenseBonus", "Watchtower", "ClaimTerritory",
+native_to = "Land"
+flags = "NoAggressive", "DefenseBonus", "ClaimTerritory",
"NoStackDeath", "DiplomatDefense"
[airbase]
@@ -787,5 +784,5 @@
"Tech", "Radio", "Player"
"TerrainClass", "Land", "Local"
}
-flags = "NoStackDeath", "DiplomatDefense", "Refuel", "NoHPLoss",
- "AttackUnreachable", "ParadropFrom"
+native_to = "Air", "Helicopter", "Missile"
+flags = "NoStackDeath", "DiplomatDefense", "ParadropFrom"
diff -Nurd -X.diff_ignore freeciv/server/airgoto.c freeciv/server/airgoto.c
--- freeciv/server/airgoto.c 2007-01-22 17:18:36.000000000 +0200
+++ freeciv/server/airgoto.c 2007-03-04 22:56:23.000000000 +0200
@@ -63,7 +63,8 @@
int moves_per_turn;
} refuels;
-static void make_list_of_refuel_points(struct player *pplayer,
+static void make_list_of_refuel_points(struct player *pplayer,
+ const struct unit_type *punittype,
bool cities_only,
int moves_per_turn, int max_moves);
@@ -147,7 +148,8 @@
matter.
Can probably do some caching...
*************************************************************************/
-static void make_list_of_refuel_points(struct player *pplayer,
+static void make_list_of_refuel_points(struct player *pplayer,
+ const struct unit_type *punittype,
bool cities_only,
int moves_per_turn,
int max_moves)
@@ -162,7 +164,7 @@
&& !is_non_allied_unit_tile(ptile, pplayer) ) {
add_refuel_point(ptile, FUEL_CITY,
MAP_MAX_HEIGHT + MAP_MAX_WIDTH, 0, FALSE);
- } else if (tile_has_base_flag(ptile, BF_REFUEL)
+ } else if (tile_has_native_base(ptile, punittype)
&& !is_non_allied_unit_tile(ptile, pplayer)
&& !cities_only) {
add_refuel_point(ptile, FUEL_AIRBASE,
@@ -197,6 +199,7 @@
* max_fuel -- max fuel
************************************************************************/
struct pqueue *refuel_iterate_init(struct player *pplayer,
+ const struct unit_type *punittype,
struct tile *ptile,
struct tile *dest_tile,
bool cities_only, int moves_left,
@@ -208,7 +211,7 @@
/* List of all refuel points of the player!
* TODO: Should cache the results */
- make_list_of_refuel_points(pplayer, cities_only,
+ make_list_of_refuel_points(pplayer, punittype, cities_only,
moves_per_turn, moves_per_turn * max_fuel);
/* Add the starting point: we keep it for later backtracking */
add_refuel_point(ptile, FUEL_START, 0, moves_left, TRUE);
@@ -364,7 +367,7 @@
unsigned int moves_and_fuel_left
= punit->moves_left / SINGLE_MOVE + fullmoves * (punit->fuel - 1);
struct pqueue *my_list
- = refuel_iterate_init(unit_owner(punit), punit->tile,
+ = refuel_iterate_init(unit_owner(punit), unit_type(punit), punit->tile,
*dest_tile, FALSE,
moves_and_fuel_left, fullmoves, fullfuel);
struct refuel *next_point;
diff -Nurd -X.diff_ignore freeciv/server/airgoto.h freeciv/server/airgoto.h
--- freeciv/server/airgoto.h 2006-08-18 10:51:27.000000000 +0300
+++ freeciv/server/airgoto.h 2007-03-04 22:56:23.000000000 +0200
@@ -22,7 +22,9 @@
struct tile *get_refuel_tile(struct refuel *pRefuel);
unsigned int get_turns_to_refuel(struct refuel *pRefuel);
-struct pqueue *refuel_iterate_init(struct player *pplayer, struct tile *ptile,
+struct pqueue *refuel_iterate_init(struct player *pplayer,
+ const struct unit_type *punittype,
+ struct tile *ptile,
struct tile *dst_tile,
bool cities_only, int moves_left,
int moves_per_turn, int max_moves);
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c 2007-02-28 23:02:37.000000000 +0200
+++ freeciv/server/citytools.c 2007-03-04 22:56:23.000000000 +0200
@@ -927,6 +927,7 @@
struct city *pcity;
int x_itr, y_itr;
struct nation_type *nation = get_nation_by_plr(pplayer);
+ struct base_type *pbase;
freelog(LOG_DEBUG, "Creating city %s", name);
@@ -1008,7 +1009,8 @@
auto_arrange_workers(pcity);
/* Put vision back to normal, if base acted as a watchtower */
- if (tile_has_base_flag(ptile, BF_WATCHTOWER)) {
+ pbase = tile_get_base(ptile);
+ if (pbase) {
tile_remove_base(ptile);
unit_list_refresh_vision(ptile->units);
}
diff -Nurd -X.diff_ignore freeciv/server/diplomats.c freeciv/server/diplomats.c
--- freeciv/server/diplomats.c 2007-01-22 17:18:36.000000000 +0200
+++ freeciv/server/diplomats.c 2007-03-04 22:56:23.000000000 +0200
@@ -1046,7 +1046,8 @@
chance -= chance * get_city_bonus(pdefender_tile->city,
EFT_SPY_RESISTANT) / 100;
} else {
- if (tile_has_base_flag(pdefender_tile, BF_DIPLOMAT_DEFENSE)) {
+ if (tile_has_base_flag_for_unit(pdefender_tile, unit_type(pdefender),
+ BF_DIPLOMAT_DEFENSE)) {
chance -= chance * 25 / 100; /* 25% penalty */
}
}
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c 2007-03-04 16:55:04.000000000 +0200
+++ freeciv/server/ruleset.c 2007-03-04 22:56:23.000000000 +0200
@@ -1804,6 +1804,22 @@
reqs = lookup_req_list(file, section, "reqs");
requirement_vector_copy(&pbase->reqs, reqs);
+ slist = secfile_lookup_str_vec(file, &nval, "%s.native_to", section);
+ BV_CLR_ALL(pbase->native_to);
+ 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, _("Base %s is native to unknown unit class %s"),
+ pbase->name, slist[j]);
+ exit(EXIT_FAILURE);
+ } else {
+ BV_SET(pbase->native_to, class->id);
+ }
+ }
+ free(slist);
+
slist = secfile_lookup_str_vec(file, &nval, "%s.flags", section);
BV_CLR_ALL(pbase->flags);
for (j = 0; j < nval; j++) {
@@ -3067,6 +3083,7 @@
packet.reqs[j++] = *preq;
} requirement_vector_iterate_end;
packet.reqs_count = j;
+ packet.native_to = b->native_to;
packet.flags = b->flags;
diff -Nurd -X.diff_ignore freeciv/server/unithand.c freeciv/server/unithand.c
--- freeciv/server/unithand.c 2007-02-12 15:27:37.000000000 +0200
+++ freeciv/server/unithand.c 2007-03-04 22:56:23.000000000 +0200
@@ -700,7 +700,7 @@
}
if (!is_air_unit(pdefender)
- || (pcity || tile_has_base_flag(ptile, BF_ATTACK_UNREACHABLE))) {
+ || (pcity || tile_has_native_base(ptile, unit_type(pdefender)))) {
see_combat(punit, pdefender);
unit_versus_unit(punit, pdefender, TRUE);
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c 2007-03-04 16:43:43.000000000 +0200
+++ freeciv/server/unittools.c 2007-03-04 22:56:23.000000000 +0200
@@ -478,7 +478,7 @@
/* Bonus recovery HP (traditionally from the United Nations) */
punit->hp += get_unit_bonus(punit, EFT_UNIT_RECOVER);
- if (!pcity && !tile_has_base_flag(punit->tile, BF_NO_HP_LOSS)
+ if (!pcity && !tile_has_native_base(punit->tile, unit_type(punit))
&& punit->transported_by == -1) {
punit->hp -= unit_type(punit)->hp * class->hp_loss_pct / 100;
}
@@ -1207,7 +1207,8 @@
{
return (punit->transported_by != -1 /* Carrier */
|| punit->tile->city /* City */
- || tile_has_base_flag(punit->tile, BF_REFUEL)); /* Airbase */
+ || tile_has_native_base(punit->tile,
+ unit_type(punit))); /* Airbase */
}
/**************************************************************************
@@ -1223,7 +1224,7 @@
if ((is_allied_city_tile(ptile, pplayer)
&& !is_non_allied_unit_tile(ptile, pplayer))
- || ((pbase != NULL && base_flag(pbase, BF_REFUEL))
+ || ((pbase != NULL && is_native_base(type, pbase))
&& !is_non_allied_unit_tile(ptile, pplayer)))
return TRUE;
@@ -2643,10 +2644,14 @@
if (homecity) {
if ((game.info.happyborders > 0 && src_tile->owner != dst_tile->owner)
||
- (tile_has_base_flag(dst_tile, BF_NOT_AGGRESSIVE)
+ (tile_has_base_flag_for_unit(dst_tile,
+ unit_type(punit),
+ BF_NOT_AGGRESSIVE)
&& is_friendly_city_near(unit_owner(punit), dst_tile))
||
- (tile_has_base_flag(src_tile, BF_NOT_AGGRESSIVE)
+ (tile_has_base_flag_for_unit(src_tile,
+ unit_type(punit),
+ BF_NOT_AGGRESSIVE)
&& is_friendly_city_near(unit_owner(punit), src_tile))) {
refresh_homecity = TRUE;
}
@@ -2771,7 +2776,8 @@
} vision_layer_iterate_end;
/* Claim ownership of fortress? */
- if (tile_has_base_flag(pdesttile, BF_CLAIM_TERRITORY)
+ if (tile_has_base_flag_for_unit(pdesttile, unit_type(punit),
+ BF_CLAIM_TERRITORY)
&& (!pdesttile->owner || pplayers_at_war(pdesttile->owner, pplayer))) {
map_claim_ownership(pdesttile, pplayer, pdesttile);
}
diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in
--- freeciv/version.in 2007-03-03 23:02:09.000000000 +0200
+++ freeciv/version.in 2007-03-04 22:56:34.000000000 +0200
@@ -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.2007.Mar.03")
+FREECIV_NETWORK_CAPSTRING("+Freeciv.Devel.2007.Mar.04")
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev