Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] Re: (PR#3602) no_contact cleanup
Home

[Freeciv-Dev] Re: (PR#3602) no_contact cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3602) no_contact cleanup
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 4 Mar 2003 12:16:27 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, 4 Mar 2003, Gregory Berkolaiko wrote:
> Scre-e-e-a-a-am!
>
> Your patch is wrong: what if there are two units from different players on
> the tile?What if there are other players units in the city?
>
> You should use maybe_make_first_contact instead which handles all things
> properly.

Yes, of course. New patch attached. (Note that this was a problem also in
old code.)

  - Per

Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.111
diff -u -r1.111 player.c
--- common/player.c     12 Feb 2003 22:22:33 -0000      1.111
+++ common/player.c     4 Mar 2003 20:15:29 -0000
@@ -518,22 +518,6 @@
 }
 
 /***************************************************************
-  Returns true iff players have no contact status.
-***************************************************************/
-bool pplayers_no_contact(const struct player *pplayer,
-                         const struct player *pplayer2)
-{
-  enum diplstate_type ds = pplayer_get_diplstate(pplayer, pplayer2)->type;
-  if (pplayer == pplayer2) {
-    return FALSE;
-  }
-  if (is_barbarian(pplayer) || is_barbarian(pplayer2)) {
-    return FALSE;
-  }
-  return ds == DS_NO_CONTACT;
-}
-
-/***************************************************************
 returns true iff players can attack each other.
 ***************************************************************/
 bool pplayers_at_war(const struct player *pplayer,
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.95
diff -u -r1.95 player.h
--- common/player.h     23 Feb 2003 12:47:35 -0000      1.95
+++ common/player.h     4 Mar 2003 20:15:29 -0000
@@ -251,8 +251,6 @@
                                                     *pplayer,
                                                     const struct player
                                                     *pplayer2);
-bool pplayers_no_contact(const struct player *pplayer,
-                        const struct player *pplayer2);
 bool pplayers_at_war(const struct player *pplayer,
                    const struct player *pplayer2);
 bool pplayers_allied(const struct player *pplayer,
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.214
diff -u -r1.214 unittools.c
--- server/unittools.c  18 Feb 2003 18:10:15 -0000      1.214
+++ server/unittools.c  4 Mar 2003 20:15:30 -0000
@@ -2254,18 +2254,7 @@
       || is_non_allied_unit_tile(ptile, pplayer)) {
     int srange = unit_type(punit)->vision_range;
     show_area(pplayer, dest_x, dest_y, srange);
-    notify_player_ex(pplayer, dest_x, dest_y, E_UNIT_LOST_ATT,
-                     _("Game: Your %s was killed by enemy units at the "
-                       "paradrop destination."),
-                     unit_type(punit)->name);
-    server_remove_unit(punit);
-    return TRUE;
-  }
-
-  if (ptile->city && pplayers_no_contact(pplayer, city_owner(ptile->city))) {
-    int srange = unit_type(punit)->vision_range;
-    show_area(pplayer, dest_x, dest_y, srange);
-    make_contact(pplayer, city_owner(ptile->city), dest_x, dest_y);
+    maybe_make_first_contact(dest_x, dest_y, pplayer);
     notify_player_ex(pplayer, dest_x, dest_y, E_UNIT_LOST_ATT,
                      _("Game: Your %s was killed by enemy units at the "
                        "paradrop destination."),

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