Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Re: shared vision again
Home

[Freeciv-Dev] Re: shared vision again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: shared vision again
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 27 Aug 2000 22:39:26 +1000 (EST)

On Wed, 23 Aug 2000 Thue <thue@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> Now you can in the diplomatic dialog agree to a shared vision clause. As long
> as the clause is in effect all map info will be passed along. one clause only
> gives vision one way.

> The effect is transitive; if p1 gives info to p2 and p2 to p3, p1 in effect
> also gives to p3.

I'm a bit uncomfortable about having it transitive, but OTOH I can't
think of a good way to do it otherwise without getting too complicated.

> +void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data)
> +{

> +  if (!has_capability("shared_vision", aconnection.capability)) {
> +    append_output_window("clause not added as the server does not"
> +                      "have the capability");
> +    return;
> +  }

If I understand this, shouldn't the button be disabled (or omitted)
instead, so the callback is never called and this check is not needed?

>  
> +  players_vision_command=gtk_accelbutton_new(_("_Redraw vision"), accel);

This label should say instead "Withdraw vision" (Xaw client too).

> +static void create_vision_dependensies(void)

Spelling: dependencies

> +void give_shared_vision(struct player *pfrom, struct player *pto)
> +{
> +  int save_vision[MAX_NUM_PLAYERS+MAX_NUM_BARBARIANS];
> +  assert(pfrom != pto);
> +  if (pfrom->gives_shared_vision & (1<<pto->player_no)) {
> +    freelog(LOG_ERROR, "tried to give shared vision you already have 
> given.");
> +    return;
> +  }

For messages like above, I assume you are using these for debugging,
but wording could be more general to detect strange clients in 
general case, eg ("%s tried to give shared vision to %s - already given",
pfrom->name, pto->name).  (Also, could the client trick the server 
into triggering that assert?  Bad if so.  See also some diplomatic 
treaty server-checking patches by Andy Black and Marko Lindqvist?)

> +    freelog(LOG_ERROR, "tried removing shared vision you don't have.");

(Ditto.)

-- David



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