[Freeciv-Dev] (PR#5096) Remove a duplicate gameloss unit safety net
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#5096) Remove a duplicate gameloss unit safety net |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Thu, 14 Aug 2003 14:53:37 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
This removes an unnecessary F_GAMELOSS unit safety net, and also
simplifies some code using the new bounce_unit() function.
This also removes a potential bug: It would assert if we have no other
cities left, then lose a ferry or (our last) city containing a F_GAMELOSS
unit.
- Per
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.241
diff -u -r1.241 unittools.c
--- server/unittools.c 14 Aug 2003 19:07:01 -0000 1.241
+++ server/unittools.c 14 Aug 2003 21:48:47 -0000
@@ -1277,23 +1277,11 @@
/**************************************************************************
Disband given unit because of a stack conflict.
**************************************************************************/
-void disband_stack_conflict_unit(struct unit *punit, bool verbose)
+static void disband_stack_conflict_unit(struct unit *punit, bool verbose)
{
freelog(LOG_VERBOSE, "Disbanded %s's %s at (%d, %d)",
unit_owner(punit)->name, unit_name(punit->type),
punit->x, punit->y);
- /* Too cheesy way to kill an enemy player */
- if (unit_flag(punit, F_GAMELOSS)) {
- struct city *toc =
- find_closest_owned_city(unit_owner(punit),
- punit->x, punit->y, FALSE, NULL);
- assert(toc != NULL);
- notify_player_ex(unit_owner(punit), punit->x, punit->y, E_UNIT_WIN,
- _("%s narrowly escaped death and fled to %s"),
- unit_name(punit->type), toc->name);
- teleport_unit_to_city(punit, toc, -1, TRUE);
- return;
- }
/* remove it */
if (verbose) {
notify_player(unit_owner(punit),
@@ -1335,7 +1323,7 @@
/**************************************************************************
Teleport or remove a unit due to stack conflict.
**************************************************************************/
-static void bounce_unit(struct unit *punit, bool verbose)
+void bounce_unit(struct unit *punit, bool verbose)
{
struct player *pplayer = unit_owner(punit);
struct city *pcity = find_closest_owned_city(pplayer, punit->x, punit->y,
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.228
diff -u -r1.228 citytools.c
--- server/citytools.c 1 Aug 2003 19:58:47 -0000 1.228
+++ server/citytools.c 14 Aug 2003 21:48:47 -0000
@@ -641,14 +641,7 @@
unit_list_unlink(units, vunit);
} else if (!pplayers_allied(pplayer, unit_owner(vunit))) {
/* the owner of vunit is allied to pvictim but not to pplayer */
- struct city *vcity = find_closest_owned_city(unit_owner(vunit), x, y,
- is_sailing_unit(vunit),
- NULL);
- if (vcity) {
- (void)teleport_unit_to_city(vunit, vcity, 0, verbose);
- } else {
- disband_stack_conflict_unit(vunit, verbose);
- }
+ bounce_unit(vunit, verbose);
}
} unit_list_iterate_end;
}
- [Freeciv-Dev] (PR#5096) Remove a duplicate gameloss unit safety net,
Per I. Mathisen <=
|
|