Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Re: Diplomats can't enter allied cities. (PR#486)
Home

[Freeciv-Dev] Re: Diplomats can't enter allied cities. (PR#486)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Diplomats can't enter allied cities. (PR#486)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 20 Aug 2000 19:43:28 +1000 (EST)

On Mon, 31 Jul 2000 Marko Lindqvist <caz@xxxxxxxxx> wrote:

>  When diplomat tries to move into allied city, normal diplomatic actions
> popup appears. There is no option to just move into city. Same probably
> applies to caravans as well.

Caravans did have a similar problem, and the fix was easy (1 line)
which I have just committed to CVS.

Diplomats are significantly harder.  Firstly I note that diplomat and
spy actions against allied cities are explicitly allowed for in the
current code, although only some actions are allowed (Embassy,
Investigate, Steal Tech?)  Diplomat actions against allied units are
not permitted.  (Hereafter "diplomat" means "diplomat or spy"...)

I made one fix to this problem (diplomat_allied_a1.diff attached)
which works ok, but is a bit awkward (see further discussion below).
I then thought of a simpler way to do things (diplomat_allied_b3.diff
attached) though this has somewhat different user-visible effects.
Only one of these two should be applied, but I'm not entirely sure
which...

The third attached patch (menu_diplo_actions.diff) is applicable over
the top of either of the above patches.  It adds a menu item (and
key-presses) (in Xaw and Gtk) to popup a diplomat dialog for a unit
inside an allied city (after one of above patches let it get there!)
This is in addition to getting a dialog when you enter the city - if
you elect to move into the city, this lets you re-consider and do an
action without having to move out and back in (compare Caravans).

One problem with the menu patch is that in the Gtk+ client the
"Orders" menu is getting too long for my screen, and this adds one
more item...

The main complication for fixing the basic problem is that currently
the server interprets trying to move a diplomat into a city as trying
to initiate diplomat actions, and the server tells the client to popup
a dialog instead of moving the unit.  (This is done this way so that
you get a dialog if you use either goto or keys.  (Hmm, how would this
change with client-side gotos?))  The problem is how to tell the
server that you really _do_ want to _move_ the unit into the city?

The first patch (diplomat_allied_a1) adds a DIPLOMAT_MOVE diplomatic
action to do this, and adds a "Continue Moving" button to the diplomat
and spy dialogs.  Adding DIPLOMAT_MOVE seems a bit hackish to me, and
a further complication it that when the server receives the
DIPLOMAT_MOVE request it cannot call the usual function
handle_unit_move_request(), because that would again mis-interpret the
move as an attempt to initiate diplomatic actions!

The idea of the second patch it that because diplomats can enter
allied cities, you can make them work like caravans in that case: the
server lets them move in, and then the client notices that it should
popup a dialog _after_ the unit has moved in.  The second patch is
much simpler and shorter compared to the first.

To handle the case of a diplomat entering a city with its last move,
the second patch allows diplomat actions with zero moves for a unit
inside an allied city (against that city).  That is, could consider
the action to have occured as the unit moved in.  Some differences
remain: if you don't do the action ("Cancel" - no extra "Continue
Movement" button required in this case), the diplomat ends up inside
the city, not just outside.  Also a spy can repeatedly investigate a
city as many times as it likes when it has zero movement left, without
losing any more movement.  These don't seem too unreasonable to me,
but could be seen as anomalous.

(Both patches handle case of diplomat on goto just passing through
the city, without popping up any dialog.)

So, the issue is:
1. First method: somewhat hackish in both protocol & code changes;
2. Second method: cleaner, but has some quirks, and in particular 
   the user sees somewhat different effects when doing diplomatic
   actions against allied cities compared to enemy cities.

-- David

Attachment: diplomat_allied_a1.diff.gz
Description: GNU Zip compressed data

Attachment: diplomat_allied_b3.diff.gz
Description: GNU Zip compressed data

Attachment: menu_diplo_actions.diff.gz
Description: GNU Zip compressed data


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