Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2223) cma: server knowledge of island != client kn
Home

[Freeciv-Dev] Re: (PR#2223) cma: server knowledge of island != client kn

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: nightmare@xxxxxxxxxx, rf13@xxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2223) cma: server knowledge of island != client knowledge
From: "Mike Kaufman via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 9 Jan 2003 09:15:06 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Thu, Jan 09, 2003 at 06:48:18AM -0800, Raimar Falke via RT wrote:
> 
> The question how does the server tells this the client. We have (in
> increasing amount of information send/leaked):
>  - server informs the clients that the cities of the traderoute are on
>  the same/different island.
>  - server informs the clients that the tile where the two cities
>  exists are on the same island
>  - server sends information about missing tiles to the client so that
>  the client can calculate this (cities on same island) by itself.

a combination of the last two I believe. Using an idea that Davide had, any
city getting a trade route from another city should get to know the
location and name of the other city. I suggest that if B creates a route
with A, then the server reveals (fogged) B's tile (with a dumb city).

In this case, lets say B appeared off in the black somewhere, A's owner
obviously thinks that A and B are on different continents. The solutions is
to B's owner's knowledge. somewhere in handle_unit_establish_trade():

 int conta_home, conta_dest, contb_home, contb_dest;

 playera = city_owner(pcity_dest);
 playerb = city_owner(pcity_homecity);
 
 /* playera gets to see the other city on the trade route */
 unfog_area(playera, pcity_homecity->x, pcity_homecity->y, 0);
 fog_area(playera, pcity_homecity->x, pcity_homecity->y, 0);

 conta_home = map_get_continent(pcity_homecity->x, pcity_homecity->y,
                                playera);
 conta_dest = map_get_continent(pcity_dest->x, pcity_dest->y,
                                playera);

 contb_home = map_get_continent(pcity_homecity->x, pcity_homecity->y,
                                playerb);
 contb_dest = map_get_continent(pcity_dest->x, pcity_dest->y,
                                playerb);
 
 /* if either know that the cities are on the same 
  * continent, then both will know */
 if (conta_home == conta_dest) {
   map_set_continent(pcity_dest->x, pcity_dest->y,
                     playerb, contb_home);
   update_continents(pcity_dest->x, pcity_dest->y,
                     playerb);
 } else if (contb_home == contb_dest) {
   map_set_continent(pcity_homecity->x, pcity_homecity->y,
                     playera, conta_dest);
   update_continents(pcity_homecity->x, pcity_homecity->y,
                     playera);
 }

I think that should do it.

-mike



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