Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2003:
[Freeciv-Dev] Re: (PR#4328) Disallow attacking tiles with not-at-war uni

[Freeciv-Dev] Re: (PR#4328) Disallow attacking tiles with not-at-war uni

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4328) Disallow attacking tiles with not-at-war units
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 30 May 2003 17:51:23 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 30 May 2003, Per I. Mathisen wrote:

> This patch
>  1) Moves can_unit_attack_unit_at_tile() from server to common.
>  2) Does some style changes to said function.
>  3) Adds check to said function and handle_unit_move_request() to disallow
> a unit from attacking a tile that contains any unit that we are not at war
> with.
> This patch should cut straight through the gordian knot issue of attacks
> on mixed-ownership stacks.
> Please read, comment and commit as soon as possible.

I don't like this patch for various reasons.

I believe there should be a clean separation between
(a) the question whether a tile can be attacked wrt alliances
(b) the question whether a unit can be attacked wrt capabilities

The first one I propose to call is_only_enemy_tile and make it return TRUE 
only if there is at least one enemy unit/city there and no non-attack 
unit/cites there.

The second is the present can_unit_attack_unit_at_tile which should be 
properly cleaned up and commented.

can_unit_attack_tile should be a wrapper of the two with only one use of 
it remaining in the code (in the other two instances the code should
call can_unit_attack_unit_at_tile directly).


[Prev in Thread] Current Thread [Next in Thread]