diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/ai/aiunit.c workdir/ai/aiunit.c --- freeciv/ai/aiunit.c Sun Jun 4 23:17:24 2000 +++ workdir/ai/aiunit.c Mon Jun 5 23:26:12 2000 @@ -112,11 +112,11 @@ } /************************************************************************** -... do something sensible with the unit... +Explores unknown territory, finds huts. +Returns whether there is any more territory to be explored. **************************************************************************/ - -void ai_manage_explorer(struct player *pplayer, struct unit *punit) -{ /* this is smarter than the old one, but much slower too. -- Syela */ +int ai_manage_explorer(struct player *pplayer, struct unit *punit) +{ int i, j, d, f, x, y, con, dest_x=0, dest_y=0, best, lmt, cur, a, b; int ok, ct = punit->moves_left + 3; struct city *pcity; @@ -162,7 +162,7 @@ punit->goto_dest_y = dest_y; set_unit_activity(punit, ACTIVITY_GOTO); do_unit_goto(pplayer, punit, GOTO_MOVE_ANY); - return; /* maybe have moves left but I want to return anyway. */ + return 1; /* maybe have moves left but I want to return anyway. */ } } @@ -208,11 +208,11 @@ } /* end i */ if (best) { handle_unit_move_request(pplayer, punit, dest_x, dest_y, FALSE); - if(!player_find_unit_by_id(pplayer, id)) return; /* died */ + if(!player_find_unit_by_id(pplayer, id)) return 0; /* died */ } ct--; /* trying to avoid loops */ } - if (!punit->moves_left) return; + if (!punit->moves_left) return 1; /* END PART TWO */ /* BEGIN PART THREE: Go towards unexplored territory */ @@ -247,7 +247,7 @@ punit->goto_dest_y = dest_y; set_unit_activity(punit, ACTIVITY_GOTO); do_unit_goto(pplayer, punit, GOTO_MOVE_ANY); - return; + return 1; } /* END PART THREE */ @@ -268,6 +268,7 @@ } } } + return 0; } /************************************************************************** diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/ai/aiunit.h workdir/ai/aiunit.h --- freeciv/ai/aiunit.h Sun Jun 4 23:17:25 2000 +++ workdir/ai/aiunit.h Mon Jun 5 23:59:55 2000 @@ -28,7 +28,7 @@ int look_for_charge(struct player *pplayer, struct unit *punit, struct unit **aunit, struct city **acity); -void ai_manage_explorer(struct player *pplayer,struct unit *punit); +int ai_manage_explorer(struct player *pplayer,struct unit *punit); void ai_manage_military(struct player *pplayer,struct unit *punit); void ai_military_findjob(struct player *pplayer,struct unit *punit); void ai_military_gohome(struct player *pplayer,struct unit *punit); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/settlers.c workdir/server/settlers.c --- freeciv/server/settlers.c Sun Jun 4 23:18:04 2000 +++ workdir/server/settlers.c Mon Jun 5 22:47:33 2000 @@ -1225,12 +1225,11 @@ punit->ai.ferryboat = 0; } } - } else punit->ai.control=0; + } if (punit->ai.control && punit->moves_left && punit->activity == ACTIVITY_IDLE) { - /* if players can build with 0 moves left, so should the AI */ if (same_pos(gx, gy, punit->x, punit->y)) { if (best_act == ACTIVITY_UNKNOWN) { remove_city_from_minimap(gx, gy); /* yeah, I know. -- Syela */ @@ -1310,11 +1309,11 @@ ptile->assigned = ptile->assigned | i; /* assigned for us only */ } else { ptile = map_get_tile(punit->x, punit->y); - ptile->assigned = 32767; /* assigned for everyone */ + ptile->assigned = 0xFFFFFFFF; /* assigned for everyone */ } } else { ptile = map_get_tile(punit->x, punit->y); - ptile->assigned = ptile->assigned | (32767 ^ i); /* assigned for everyone else */ + ptile->assigned = ptile->assigned | (0xFFFFFFFF ^ i); /* assigned for everyone else */ } unit_list_iterate_end; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unitfunc.c workdir/server/unitfunc.c --- freeciv/server/unitfunc.c Sun Jun 4 23:18:04 2000 +++ workdir/server/unitfunc.c Mon Jun 5 23:58:54 2000 @@ -2020,8 +2020,8 @@ } if (activity == ACTIVITY_EXPLORE) { - ai_manage_explorer(pplayer, punit); - if (player_find_unit_by_id(pplayer, id)) + int more_to_explore = ai_manage_explorer(pplayer, punit); + if (more_to_explore && player_find_unit_by_id(pplayer, id)) handle_unit_activity_request(punit, ACTIVITY_EXPLORE); else return; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unithand.c workdir/server/unithand.c --- freeciv/server/unithand.c Sun Jun 4 23:18:04 2000 +++ workdir/server/unithand.c Mon Jun 5 23:55:37 2000 @@ -1288,9 +1288,9 @@ case ACTIVITY_EXPLORE: if (punit->moves_left > 0) { int id = punit->id; - ai_manage_explorer(unit_owner(punit), punit); + int more_to_explore = ai_manage_explorer(unit_owner(punit), punit); /* ai_manage_explorer sets the activity to idle, so we reset it */ - if ((punit = find_unit_by_id(id))) { + if (more_to_explore && (punit = find_unit_by_id(id))) { set_unit_activity(punit, ACTIVITY_EXPLORE); send_unit_info(0, punit); }