Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] (PR#6408) Remove unused parameter to wipe_unit_safe*
Home

[Freeciv-Dev] (PR#6408) Remove unused parameter to wipe_unit_safe*

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6408) Remove unused parameter to wipe_unit_safe*
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 6 Oct 2003 06:49:41 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Backport of an older patch. This removes the now unused (and always ugly)
iterator parameter to wipe_unit_safe() and wipe_unit_spec_safe(). It has
been unnecessary since Jason rewrote the latter function.

  - Per

Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.256
diff -u -r1.256 unittools.c
--- server/unittools.c  29 Sep 2003 21:47:58 -0000      1.256
+++ server/unittools.c  6 Oct 2003 13:46:49 -0000
@@ -432,7 +432,7 @@
       gamelog(GAMELOG_UNITF, _("%s lose a %s (out of hp)"),
              get_nation_name_plural(pplayer->nation),
              unit_name(punit->type));
-      wipe_unit_safe(punit, &myiter);
+      wipe_unit(punit);
       continue; /* Continue iterating... */
     }
 
@@ -444,7 +444,7 @@
                       unit_name(punit->type));
       gamelog(GAMELOG_UNITTRI, _("%s Trireme lost at sea"),
              get_nation_name_plural(pplayer->nation));
-      wipe_unit_safe(punit, &myiter);
+      wipe_unit(punit);
       continue; /* Continue iterating... */
     }
 
@@ -500,7 +500,7 @@
       gamelog(GAMELOG_UNITF, _("%s lose a %s (fuel)"),
              get_nation_name_plural(pplayer->nation),
              unit_name(punit->type));
-      wipe_unit_safe(punit, &myiter);
+      wipe_unit(punit);
     } 
   } unit_list_iterate_end;
 }
@@ -976,7 +976,7 @@
                         _("Game: Disbanded your %s due to changing"
                           " land to sea at (%d, %d)."),
                         unit_name(punit2->type), punit2->x, punit2->y);
-       wipe_unit_spec_safe(punit2, NULL, FALSE);
+       wipe_unit_spec_safe(punit2, FALSE);
        goto START;
       }
     } unit_list_iterate_end;
@@ -1038,7 +1038,7 @@
                         _("Game: Disbanded your %s due to changing"
                           " sea to land at (%d, %d)."),
                         unit_name(punit2->type), punit2->x, punit2->y);
-       wipe_unit_spec_safe(punit2, NULL, FALSE);
+       wipe_unit_spec_safe(punit2, FALSE);
        goto START;
       }
     } unit_list_iterate_end;
@@ -1627,17 +1627,10 @@
 }
 
 /**************************************************************************
-this is a highlevel routine
-Remove the unit, and passengers if it is a carrying any.
-Remove the _minimum_ number, eg there could be another boat on the square.
-Parameter iter, if non-NULL, should be an iterator for a unit list,
-and if it points to a unit which we wipe, we advance it first to
-avoid dangling pointers.
-NOTE: iter should not be an iterator for the map units list, but
-city supported, or player units, is ok.
+  Remove the unit, and passengers if it is a carrying any. Remove the 
+  _minimum_ number, eg there could be another boat on the square.
 **************************************************************************/
-void wipe_unit_spec_safe(struct unit *punit, struct genlist_iterator *iter,
-                        bool wipe_cargo)
+void wipe_unit_spec_safe(struct unit *punit, bool wipe_cargo)
 {
   int x = punit->x;
   int y = punit->y;
@@ -1733,9 +1726,9 @@
 /**************************************************************************
 ...
 **************************************************************************/
-
-void wipe_unit_safe(struct unit *punit, struct genlist_iterator *iter){
-  wipe_unit_spec_safe(punit, iter, TRUE);
+void wipe_unit_safe(struct unit *punit, struct genlist_iterator *iter)
+{
+  wipe_unit_spec_safe(punit, TRUE);
 }
 
 /**************************************************************************
@@ -1743,7 +1736,7 @@
 **************************************************************************/
 void wipe_unit(struct unit *punit)
 {
-  wipe_unit_safe(punit, NULL);
+  wipe_unit_spec_safe(punit, TRUE);
 }
 
 /**************************************************************************
@@ -1833,7 +1826,7 @@
                get_nation_name_plural(unit_owner(punit2)->nation),
                unit_type(punit2)->name,
                get_nation_name_plural(destroyer->nation));
-       wipe_unit_spec_safe(punit2, NULL, FALSE);
+       wipe_unit_spec_safe(punit2, FALSE);
       }
     }
     unit_list_iterate_end;
@@ -2059,7 +2052,7 @@
                       unit_owner(punit)->name,
                       unit_name(punit->type));
     }
-    wipe_unit_spec_safe(punit, NULL, FALSE);
+    wipe_unit_spec_safe(punit, FALSE);
   } unit_list_iterate_end;
 
   if (pcity) {
Index: server/unittools.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.h,v
retrieving revision 1.56
diff -u -r1.56 unittools.h
--- server/unittools.h  22 Sep 2003 16:54:09 -0000      1.56
+++ server/unittools.h  6 Oct 2003 13:46:49 -0000
@@ -59,8 +59,7 @@
                              int moves_left, int hp_left);
 void wipe_unit(struct unit *punit);
 void wipe_unit_safe(struct unit *punit, struct genlist_iterator *iter);
-void wipe_unit_spec_safe(struct unit *punit, struct genlist_iterator *iter,
-                        bool wipe_cargo);
+void wipe_unit_spec_safe(struct unit *punit, bool wipe_cargo);
 void kill_unit(struct unit *pkiller, struct unit *punit);
 
 /* sending to client */

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