Re: [Freeciv-Dev] [PATCH] (PR#39431) Cannot add settlers to city

2007-07-05 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39431 >

Committed S2_0 revision 13057.

Also, another wipe_unit(vunit) removed from server/citytools.c,
already removed from S2_1, but I cannot find the bug report.

Index: server/citytools.c
===
--- server/citytools.c  (revision 13056)
+++ server/citytools.c  (working copy)
@@ -619,7 +619,6 @@
   /* Don't transfer units already owned by new city-owner --wegge */ 
   if (unit_owner(vunit) == pvictim) {
transfer_unit(vunit, pcity, verbose);
-   wipe_unit(vunit);
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 */
Index: server/unithand.c
===
--- server/unithand.c   (revision 13056)
+++ server/unithand.c   (working copy)
@@ -442,11 +442,11 @@
   /* Make the new people something, otherwise city fails the checks */
   pcity->specialists[SP_TAXMAN] += unit_pop_value(punit->type);
   auto_arrange_workers(pcity);
-  wipe_unit(punit);
-  send_city_info(NULL, pcity);
   notify_player_ex(pplayer, pcity->tile, E_NOEVENT,
   _("Game: %s added to aid %s in growing."),
   unit_name, pcity->name);
+  wipe_unit(punit);
+  send_city_info(NULL, pcity);
 }
 
 /**
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] [PATCH] (PR#39431) Cannot add settlers to city

2007-07-04 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39431 >

Committed trunk revision 13054.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] [PATCH] (PR#39431) Cannot add settlers to city

2007-07-04 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39431 >

Excellent work!  That's the second time recently we've seen a problem with
code expecting pointers to be valid after removing a unit (the other in
wipe_unit() itself).  So, I just hand checked all 60 calls to wipe_unit(),
and that seems to be the only one left (in S2_1).

Committed S2_1 revision 13052.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] [PATCH] (PR#39431) Cannot add settlers to city

2007-07-04 Thread Timothy Brownawell

http://bugs.freeciv.org/Ticket/Display.html?id=39431 >

On Wed, 2007-07-04 at 02:47 -0700, William Allen Simpson wrote:
> http://bugs.freeciv.org/Ticket/Display.html?id=39431 >
> 
> Timothy Brownawell wrote:
> > If I try to add a settler to an existing city, the game ends (retuns to
> > the welcome screen) and prints "2: lost connection to server".
> > 
> I am unable to duplicate this S2_1 behavior.  Do you have a savegame?
> 
> My test was simple: start a new default game, build the first city, use
> the second settler to 'b' add to city.

That will trigger the error reliably for me.

...after playing with GDB for a while, I have a patch which fixes this:


$ svn diff
Index: server/unithand.c
===
--- server/unithand.c   (revision 13050)
+++ server/unithand.c   (working copy)
@@ -483,12 +483,12 @@
   /* Make the new people something, otherwise city fails the checks */
   pcity->specialists[DEFAULT_SPECIALIST] +=
unit_pop_value(unit_type(punit));
   auto_arrange_workers(pcity);
-  wipe_unit(punit);
-  send_city_info(NULL, pcity);
   notify_player(pplayer, pcity->tile, E_CITY_BUILD,
   _("%s added to aid %s in growing."),
   unit_name_translation(punit),
   pcity->name);
+  wipe_unit(punit);
+  send_city_info(NULL, pcity);
 }
 
 /**




___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev