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

[Freeciv-Dev] (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] (PR#3602) no_contact cleanup
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 3 Mar 2003 18:18:40 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This is a small cleanup of no_contact handling in the paradrop code. After
the cleanup, the pplayer_no_contact function is no longer needed, and is
removed.

I will commit later unless someone screams.

  - 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 02:16:20 -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 02:16:20 -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 02:16:21 -0000
@@ -2254,18 +2254,13 @@
       || 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);
+    if (ptile->city) {
+      make_contact(pplayer, city_owner(ptile->city), dest_x, dest_y);
+    } else {
+      make_contact(pplayer, 
+                   unit_owner(is_non_allied_unit_tile(ptile, pplayer)),
+                   dest_x, dest_y);
+    }
     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]
  • [Freeciv-Dev] (PR#3602) no_contact cleanup, Per I. Mathisen <=