diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/unithand.c freeciv/server/unithand.c --- FreecivCVS/server/unithand.c Sun Apr 16 10:39:08 2000 +++ freeciv/server/unithand.c Thu Apr 20 16:31:15 2000 @@ -1298,11 +1298,13 @@ /************************************************************************** ... **************************************************************************/ -static void handle_unit_activity_dependencies(struct unit *punit, +static void handle_unit_activity_dependencies(struct player *pplayer, + struct unit *punit, enum unit_activity old_activity, int old_target) { - if (punit->activity == ACTIVITY_IDLE) { + switch (punit->activity) { + case ACTIVITY_IDLE: if (old_activity == ACTIVITY_PILLAGE) { int prereq = map_get_infrastructure_prerequisite(old_target); if (prereq) { @@ -1315,6 +1317,23 @@ unit_list_iterate_end; } } + break; + case ACTIVITY_EXPLORE: + if (punit->moves_left > 0) { + int id = punit->id; + enum unit_activity new_activity = punit->activity; + int new_target = punit->activity_target; + ai_manage_explorer(pplayer, punit); + /* ai_manage_explorer sets the activity to idle, so we reset it */ + if ((punit = find_unit_by_id(id))) { + set_unit_activity_targeted(punit, new_activity, new_target); + send_unit_info(pplayer, punit); + } + } + break; + default: + /* do nothing */ + break; } } @@ -1329,7 +1348,7 @@ int old_target = punit->activity_target; set_unit_activity(punit, new_activity); send_unit_info(0, punit); - handle_unit_activity_dependencies(punit, old_activity, old_target); + handle_unit_activity_dependencies(pplayer, punit, old_activity, old_target); } } @@ -1346,7 +1365,7 @@ int old_target = punit->activity_target; set_unit_activity_targeted(punit, new_activity, new_target); send_unit_info(0, punit); - handle_unit_activity_dependencies(punit, old_activity, old_target); + handle_unit_activity_dependencies(pplayer, punit, old_activity, old_target); } }