Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7524) Re: Freeciv commit: jdorje: Remove player_ca
Home

[Freeciv-Dev] Re: (PR#7524) Re: Freeciv commit: jdorje: Remove player_ca

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7524) Re: Freeciv commit: jdorje: Remove player_can_see_unit and player_can_se...
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Feb 2004 09:22:14 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7524 >

Raimar Falke wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7524 >
> 
> On Tue, Feb 24, 2004 at 04:00:42PM -0800, Raimar Falke wrote:
> 
>>Message:
>>  Remove player_can_see_unit and player_can_see_unit_at_location,
>>  and fold their functionality into can_player_see_unit_at. Add a
>>  new function can_player_see_unit, a simple wrapper for
>>  can_player_see_unit_at. Change existing callers of the removed
>>  functions to use one of the two remaining functions.
> 
> 
> The comment suggests that no semantic is changed. However:
> 
> 
>>-    } else if (!ptptother && !punit->transported_by &&
>>-            player_can_see_unit(game.player_ptr, punit)) {
>>+    } else if (!ptptother && !punit->transported_by) {
> 
> 
> and
> 
> 
>>-  if (player_can_see_unit(game.player_ptr, punit) &&
>>-      (tile_visible_mapcanvas(map_x, map_y) ||
>>-       tile_visible_mapcanvas(dest_x, dest_y))) {
>>+  if (tile_visible_mapcanvas(map_x, map_y)
>>+      || tile_visible_mapcanvas(dest_x, dest_y)) {
> 
> 
> Can you tell me that this was intended?!

This was explained in the ticket but not in the commit log.

Since the client doesn't have the possibility to cheat anymore, the 
client doesn't *have* to check to see if we can see the unit.  If the 
client knows about the unit, the player can see it.

Before the painful changes of the last year or so, all units were sent 
to the client.  Removing the above lines would enable cheating in the 
client.  But this is no longer the case.  At least, it shouldn't be.

>>+/****************************************************************************
>>+  Checks if a unit can be seen by pplayer at (x,y).
>>+  A player can see a unit if he:
>>+  (a) can see the tile AND
>>+  (b) can see the unit at the tile (i.e. unit not invisible at this tile) AND
>>+  (c) the unit is outside a city OR in an allied city AND
> 
>                                     ^^
> 
>>+  (d) the unit isn't in a transporter, or we are allied AND
> 
>                                           ^^
> 
>>+  (e) the unit isn't in a transporter, or we can see the transporter
> 
>                                           ^^
> 
> Are the last two "or"s less important? And yes I know that you just
> moved the text around.

The ordering of the statements just indicate order-of-operation.  That is

  (can see tile)
  && (unit isn't hidden)
  && ((unit outside city) || (unit in allied city))
  && ((unit outside transporter) || (allied))
  && ((unit outside transporter) || (transporter visible))

The last check, BTW, is to prevent missiles inside subs being visible 
unless the sub is visible.

jason




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#7524) Re: Freeciv commit: jdorje: Remove player_can_see_unit and player_can_se..., Jason Short <=