Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Se
Home

[Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Se

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: matusik_s@xxxxx
Subject: [Freeciv-Dev] Re: (PR#7408) unit_list_size(&ptile->units) == 0 Again (Sea barbarians)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Feb 2004 12:21:53 -0800
Reply-to: rt@xxxxxxxxxxx

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

mateusz stefek wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
> 
> 
> Dnia 2004.02.17 09:40, Jason Short napisał(a):
> 
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=7408 >
>>
>>mateusz stefek wrote:
>>
>>
>>>And another problem: What about transported missiles in submarines? 
>>>Suppose that players A and B are allied, but no shared vision.B's loaded 
>>>submarine is two tiles from A transport. 
>>>Players are allied, but without shared vision. It seems that 
>>>can_player_see_unit_at2(A, unit) returns TRUE for the missile and FALSE for 
>>>the submarine.
>>
>>Players know about transported units of allied players, not players with 
>>shared vision.  Of course they must be able to see the tile for it to 
>>work; this is where shared vision comes into play.
>>
>>The same rules _should_ apply to invisible units, but I don't know if 
>>they do.
>>
> 
> The problem is that submarine is invisible because it's invisible, but 
> missile is visible, because it is allied. (There is no shared vision, but 
> player A somehow can see that tile).
> can_player_see_unit_* functions should check if transporter is 
> visible(because it can be partial invisible unit).

So either the submarine should be visible (because it's allied) or the 
missile should be invisible (because it's transported by an invisible unit).

The attached patch implements the latter.

Design board?

jason

Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.134
diff -u -r1.134 player.c
--- common/player.c     2004/02/14 02:36:48     1.134
+++ common/player.c     2004/02/17 20:20:25
@@ -295,6 +295,14 @@
     return FALSE;
   }
 
+  if (punit->transported_by != -1) {
+    struct unit *ptrans = find_unit_by_id(punit->transported_by);
+
+    if (!can_player_see_unit_at2(pplayer, ptrans, x, y)) {
+      return FALSE;
+    }
+  }
+
   return can_player_see_unit_at(pplayer, punit, x, y);
 }
 

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