[Freeciv-Dev] (PR#6649) don't reassign units to an allied city
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
In remove_city() in the server, when a city is disbanded for each of its
supported units, if that unit is in another city, that city is assigned
as its homecity.
Since there's no check for ownership of the city, if your unit happens
to be in an allied city that city (and player) will get ownership of
your unit.
This seems wrong. Of course, as the comment says this code is a hack
already; a more elegant solution would be desirable.
jason
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.237
diff -u -r1.237 citytools.c
--- server/citytools.c 2003/10/13 01:33:31 1.237
+++ server/citytools.c 2003/10/27 16:00:24
@@ -1098,7 +1098,9 @@
unit_list_iterate(pcity->units_supported, punit) {
struct city *new_home_city = map_get_city(punit->x, punit->y);
x = punit->x; y = punit->y;
- if (new_home_city && new_home_city != pcity) {
+ if (new_home_city
+ && new_home_city != pcity
+ && city_owner(new_home_city) == pplayer) {
/* unit is in another city: make that the new homecity,
unless that city is actually the same city (happens if disbanding) */
freelog(LOG_VERBOSE, "Changed homecity of %s in %s",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#6649) don't reassign units to an allied city,
Jason Short <=
|
|