Author: cazfi Date: Sat Mar 29 01:07:13 2014 New Revision: 24737 URL: http://svn.gna.org/viewcvs/freeciv?rev=24737&view=rev Log: Fixed loading of savegames where some unit has ACTIVITY_IRIGATE or ACTIVITY_MINE without target.
Reported by Sveinung Kvilhaugsvik <sveinung> See bug #21857 Modified: trunk/server/savegame2.c Modified: trunk/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=24737&r1=24736&r2=24737&view=diff ============================================================================== --- trunk/server/savegame2.c (original) +++ trunk/server/savegame2.c Sat Mar 29 01:07:13 2014 @@ -4836,6 +4836,26 @@ if (extra_id >= 0 && extra_id < loading->extra.size) { pextra = loading->extra.order[extra_id]; set_unit_activity_targeted(punit, activity, pextra); + } else if (activity == ACTIVITY_IRRIGATE) { + struct extra_type *tgt = next_extra_for_tile(unit_tile(punit), + EC_IRRIGATION, + unit_owner(punit), + punit); + if (tgt != NULL) { + set_unit_activity_targeted(punit, ACTIVITY_IRRIGATE, tgt); + } else { + set_unit_activity_targeted(punit, ACTIVITY_IRRIGATE, NULL); + } + } else if (activity == ACTIVITY_MINE) { + struct extra_type *tgt = next_extra_for_tile(unit_tile(punit), + EC_MINE, + unit_owner(punit), + punit); + if (tgt != NULL) { + set_unit_activity_targeted(punit, ACTIVITY_MINE, tgt); + } else { + set_unit_activity_targeted(punit, ACTIVITY_MINE, NULL); + } } else { set_unit_activity(punit, activity); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits