diff -u -r freecivold/ai/advmilitary.c freeciv/ai/advmilitary.c --- freecivold/ai/advmilitary.c Mon Jan 3 12:50:19 2000 +++ freeciv/ai/advmilitary.c Wed Feb 23 01:45:15 2000 @@ -743,7 +743,7 @@ n = pdef->type; m = get_virtual_defense_power(v, n, x, y); if (pdef->veteran) m += m / 2; - if (pdef->activity == ACTIVITY_FORTIFY) m += m / 2; + if (pdef->activity == ACTIVITY_FORTIFIED) m += m / 2; /* attempting to recreate the rounding errors in get_total_defense_power -- Syela */ m *= (myunit->id ? pdef->hp : unit_types[n].hp) * unit_types[n].firepower; diff -u -r freecivold/ai/aiunit.c freeciv/ai/aiunit.c --- freecivold/ai/aiunit.c Tue Feb 15 12:52:51 2000 +++ freeciv/ai/aiunit.c Wed Feb 23 01:46:19 2000 @@ -1011,7 +1011,7 @@ do_unit_goto(pplayer,punit,GOTO_MOVE_ANY); } } else { - handle_unit_activity_request(pplayer, punit, ACTIVITY_FORTIFY); + handle_unit_activity_request(pplayer, punit, ACTIVITY_FORTIFYING); } } @@ -1640,7 +1640,7 @@ punit->ai.ferryboat)) handle_unit_activity_request(pplayer, punit, ACTIVITY_SENTRY); else - handle_unit_activity_request(pplayer, punit, ACTIVITY_FORTIFY); + handle_unit_activity_request(pplayer, punit, ACTIVITY_FORTIFYING); } /* better than doing nothing */ } } diff -u -r freecivold/client/control.c freeciv/client/control.c --- freecivold/client/control.c Mon Jan 3 12:50:21 2000 +++ freeciv/client/control.c Wed Feb 23 01:48:11 2000 @@ -951,8 +951,8 @@ void key_unit_fortify(void) { if(get_unit_in_focus()) - if(can_unit_do_activity(punit_focus, ACTIVITY_FORTIFY)) - request_new_unit_activity(punit_focus, ACTIVITY_FORTIFY); + if(can_unit_do_activity(punit_focus, ACTIVITY_FORTIFYING)) + request_new_unit_activity(punit_focus, ACTIVITY_FORTIFYING); } /************************************************************************** diff -u -r freecivold/client/gui-gtk/menu.c freeciv/client/gui-gtk/menu.c --- freecivold/client/gui-gtk/menu.c Wed Feb 23 02:10:37 2000 +++ freeciv/client/gui-gtk/menu.c Wed Feb 23 02:10:19 2000 @@ -278,7 +278,7 @@ break; case MENU_ORDER_FORTIFY: if(get_unit_in_focus()) - request_new_unit_activity(get_unit_in_focus(), ACTIVITY_FORTIFY); + request_new_unit_activity(get_unit_in_focus(), ACTIVITY_FORTIFYING); break; case MENU_ORDER_SENTRY: if(get_unit_in_focus()) @@ -873,7 +873,7 @@ can_unit_do_activity(punit, ACTIVITY_POLLUTION) || can_unit_paradropped(punit)); menus_set_sensitive("
/Orders/Fortify", - can_unit_do_activity(punit, ACTIVITY_FORTIFY)); + can_unit_do_activity(punit, ACTIVITY_FORTIFYING)); menus_set_sensitive("
/Orders/Sentry", can_unit_do_activity(punit, ACTIVITY_SENTRY)); menus_set_sensitive("
/Orders/Pillage", diff -u -r freecivold/client/gui-mui/gui_main.c freeciv/client/gui-mui/gui_main.c --- freecivold/client/gui-mui/gui_main.c Wed Feb 23 02:10:37 2000 +++ freeciv/client/gui-mui/gui_main.c Wed Feb 23 02:10:19 2000 @@ -1163,7 +1163,7 @@ menu_entry_sensitive(MENU_ORDER_POLLUTION, can_unit_do_activity(punit, ACTIVITY_POLLUTION)); } - menu_entry_sensitive(MENU_ORDER_FORTIFY, can_unit_do_activity(punit, ACTIVITY_FORTIFY)); + menu_entry_sensitive(MENU_ORDER_FORTIFY, can_unit_do_activity(punit, ACTIVITY_FORTIFYING)); menu_entry_sensitive(MENU_ORDER_AIRBASE, can_unit_do_activity(punit, ACTIVITY_AIRBASE)); menu_entry_sensitive(MENU_ORDER_SENTRY, can_unit_do_activity(punit, ACTIVITY_SENTRY)); menu_entry_sensitive(MENU_ORDER_PILLAGE, can_unit_do_activity(punit, ACTIVITY_PILLAGE)); diff -u -r freecivold/client/gui-mui/mapclass.c freeciv/client/gui-mui/mapclass.c --- freecivold/client/gui-mui/mapclass.c Wed Feb 23 02:10:32 2000 +++ freeciv/client/gui-mui/mapclass.c Wed Feb 23 02:10:10 2000 @@ -1789,7 +1789,7 @@ Map_InsertCommand(&list, "Build Airbase", PACK_USERDATA(punit, MENU_ORDER_AIRBASE)); if (can_unit_do_activity(punit, ACTIVITY_POLLUTION)) Map_InsertCommand(&list, "Clean Pollution", PACK_USERDATA(punit, MENU_ORDER_POLLUTION)); - if (can_unit_do_activity(punit, ACTIVITY_FORTIFY)) + if (can_unit_do_activity(punit, ACTIVITY_FORTIFYING)) Map_InsertCommand(&list, "Fortify", PACK_USERDATA(punit, MENU_ORDER_FORTIFY)); if (can_unit_do_activity(punit, ACTIVITY_SENTRY)) Map_InsertCommand(&list, "Sentry", PACK_USERDATA(punit, MENU_ORDER_SENTRY)); diff -u -r freecivold/client/gui-xaw/menu.c freeciv/client/gui-xaw/menu.c --- freecivold/client/gui-xaw/menu.c Sat Feb 19 12:52:34 2000 +++ freeciv/client/gui-xaw/menu.c Wed Feb 23 01:47:46 2000 @@ -303,7 +303,7 @@ can_unit_do_activity(punit, ACTIVITY_POLLUTION) || can_unit_paradropped(punit)); menu_entry_sensitive(MENU_ORDER, MENU_ORDER_FORTIFY, - can_unit_do_activity(punit, ACTIVITY_FORTIFY)); + can_unit_do_activity(punit, ACTIVITY_FORTIFYING)); menu_entry_sensitive(MENU_ORDER, MENU_ORDER_SENTRY, can_unit_do_activity(punit, ACTIVITY_SENTRY)); menu_entry_sensitive(MENU_ORDER, MENU_ORDER_PILLAGE, diff -u -r freecivold/client/tilespec.c freeciv/client/tilespec.c --- freecivold/client/tilespec.c Sun Jan 23 12:50:51 2000 +++ freeciv/client/tilespec.c Wed Feb 23 01:49:36 2000 @@ -849,7 +849,10 @@ case ACTIVITY_EXPLORE: s = sprites.unit.auto_explore; break; - case ACTIVITY_FORTIFY: + case ACTIVITY_FORTIFYING: + s = sprites.unit.fortify; + break; + case ACTIVITY_FORTIFIED:/*someone please make new graphics*/ s = sprites.unit.fortify; break; case ACTIVITY_FORTRESS: diff -u -r freecivold/common/unit.c freeciv/common/unit.c --- freecivold/common/unit.c Thu Jan 20 12:50:55 2000 +++ freeciv/common/unit.c Wed Feb 23 01:56:05 2000 @@ -846,21 +846,22 @@ char *text; switch (activity) { - case ACTIVITY_IDLE: text = _("Idle"); break; - case ACTIVITY_POLLUTION: text = _("Pollution"); break; - case ACTIVITY_ROAD: text = _("Road"); break; - case ACTIVITY_MINE: text = _("Mine"); break; - case ACTIVITY_IRRIGATE: text = _("Irrigation"); break; - case ACTIVITY_FORTIFY: text = _("Fortify"); break; - case ACTIVITY_FORTRESS: text = _("Fortress"); break; - case ACTIVITY_SENTRY: text = _("Sentry"); break; - case ACTIVITY_RAILROAD: text = _("Railroad"); break; - case ACTIVITY_PILLAGE: text = _("Pillage"); break; - case ACTIVITY_GOTO: text = _("Goto"); break; - case ACTIVITY_EXPLORE: text = _("Explore"); break; - case ACTIVITY_TRANSFORM: text = _("Transform"); break; - case ACTIVITY_AIRBASE: text = _("Airbase"); break; - default: text = _("Unknown"); break; + case ACTIVITY_IDLE: text = _("Idle"); break; + case ACTIVITY_POLLUTION: text = _("Pollution"); break; + case ACTIVITY_ROAD: text = _("Road"); break; + case ACTIVITY_MINE: text = _("Mine"); break; + case ACTIVITY_IRRIGATE: text = _("Irrigation"); break; + case ACTIVITY_FORTIFYING: text = _("Fortifying"); break; + case ACTIVITY_FORTIFIED: text = _("Fortified"); break; + case ACTIVITY_FORTRESS: text = _("Fortress"); break; + case ACTIVITY_SENTRY: text = _("Sentry"); break; + case ACTIVITY_RAILROAD: text = _("Railroad"); break; + case ACTIVITY_PILLAGE: text = _("Pillage"); break; + case ACTIVITY_GOTO: text = _("Goto"); break; + case ACTIVITY_EXPLORE: text = _("Explore"); break; + case ACTIVITY_TRANSFORM: text = _("Transform"); break; + case ACTIVITY_AIRBASE: text = _("Airbase"); break; + default: text = _("Unknown"); break; } return text; @@ -932,12 +933,11 @@ switch(activity) { case ACTIVITY_POLLUTION: - return unit_flag(punit->type, F_SETTLERS) && punit->moves_left && - (ptile->special&S_POLLUTION); + return unit_flag(punit->type, F_SETTLERS) && (ptile->special&S_POLLUTION); case ACTIVITY_ROAD: return terrain_control.may_road && - unit_flag(punit->type, F_SETTLERS) && punit->moves_left && + unit_flag(punit->type, F_SETTLERS) && !(ptile->special&S_ROAD) && ptile->terrain!=T_OCEAN && ((ptile->terrain!=T_RIVER && !(ptile->special&S_RIVER)) || player_knows_techs_with_flag(pplayer, TF_BRIDGE)); @@ -946,7 +946,7 @@ /* Don't allow it if someone else is irrigating this tile. * *Do* allow it if they're transforming - the mine may survive */ if (terrain_control.may_mine && - unit_flag(punit->type, F_SETTLERS) && punit->moves_left && + unit_flag(punit->type, F_SETTLERS) && type->mining_result!=T_LAST && !(ptile->special&S_MINE)) { unit_list_iterate(ptile->units, tunit) { if(tunit->activity==ACTIVITY_IRRIGATE) return 0; @@ -959,7 +959,7 @@ /* Don't allow it if someone else is mining this tile. * *Do* allow it if they're transforming - the irrigation may survive */ if (terrain_control.may_irrigate && - unit_flag(punit->type, F_SETTLERS) && punit->moves_left && + unit_flag(punit->type, F_SETTLERS) && (!(ptile->special&S_IRRIGATION) || (!(ptile->special&S_FARMLAND) && player_knows_techs_with_flag(pplayer, TF_FARMLAND))) && @@ -974,17 +974,17 @@ return 1; } else return 0; - case ACTIVITY_FORTIFY: - return is_ground_unit(punit) && punit->moves_left && + case ACTIVITY_FORTIFYING: + return is_ground_unit(punit) && !unit_flag(punit->type, F_SETTLERS); case ACTIVITY_FORTRESS: - return unit_flag(punit->type, F_SETTLERS) && punit->moves_left && + return unit_flag(punit->type, F_SETTLERS) && player_knows_techs_with_flag(pplayer, TF_FORTRESS) && !(ptile->special&S_FORTRESS) && ptile->terrain!=T_OCEAN; case ACTIVITY_AIRBASE: - return unit_flag(punit->type, F_AIRBASE) && punit->moves_left && + return unit_flag(punit->type, F_AIRBASE) && player_knows_techs_with_flag(pplayer, TF_AIRBASE) && !(ptile->special&S_AIRBASE) && ptile->terrain!=T_OCEAN; @@ -994,7 +994,7 @@ case ACTIVITY_RAILROAD: /* if the tile has road, the terrain must be ok.. */ return terrain_control.may_road && - unit_flag(punit->type, F_SETTLERS) && punit->moves_left && + unit_flag(punit->type, F_SETTLERS) && ((ptile->special&S_ROAD) || (punit->connecting && (ptile->terrain!=T_OCEAN && ((ptile->terrain!=T_RIVER && !(ptile->special&S_RIVER)) @@ -1007,7 +1007,7 @@ int pspresent; int psworking; pspresent = get_tile_infrastructure_set(ptile); - if (pspresent && is_ground_unit(punit) && punit->moves_left) { + if (pspresent && is_ground_unit(punit)) { psworking = get_unit_tile_pillage_set(punit->x, punit->y); if (target == S_NO_SPECIAL) return ((pspresent & (~psworking)) != 0); @@ -1148,7 +1148,8 @@ case ACTIVITY_MINE: case ACTIVITY_IRRIGATE: case ACTIVITY_TRANSFORM: - case ACTIVITY_FORTIFY: + case ACTIVITY_FORTIFYING: + case ACTIVITY_FORTIFIED: case ACTIVITY_AIRBASE: case ACTIVITY_FORTRESS: case ACTIVITY_SENTRY: diff -u -r freecivold/common/unit.h freeciv/common/unit.h --- freecivold/common/unit.h Sun Jan 2 12:51:27 2000 +++ freeciv/common/unit.h Wed Feb 23 01:56:53 2000 @@ -52,10 +52,10 @@ enum unit_activity { ACTIVITY_IDLE, ACTIVITY_POLLUTION, ACTIVITY_ROAD, ACTIVITY_MINE, - ACTIVITY_IRRIGATE, ACTIVITY_FORTIFY, ACTIVITY_FORTRESS, ACTIVITY_SENTRY, + ACTIVITY_IRRIGATE, ACTIVITY_FORTIFYING, ACTIVITY_FORTRESS, ACTIVITY_SENTRY, ACTIVITY_RAILROAD, ACTIVITY_PILLAGE, ACTIVITY_GOTO, ACTIVITY_EXPLORE, ACTIVITY_TRANSFORM, ACTIVITY_UNKNOWN, ACTIVITY_AIRBASE, - ACTIVITY_LAST /* leave this one last */ + ACTIVITY_FORTIFIED, ACTIVITY_LAST /* leave this one last */ }; enum unit_move_type { diff -u -r freecivold/server/plrhand.c freeciv/server/plrhand.c --- freecivold/server/plrhand.c Wed Feb 16 12:54:15 2000 +++ freeciv/server/plrhand.c Wed Feb 23 01:40:52 2000 @@ -1337,7 +1337,7 @@ notify_player(pplayer, _("Year: %s"), textyear(game.year)); great_library(pplayer); update_revolution(pplayer); - player_restore_units(pplayer); + player_restore_units(pplayer); /*note: restoring move point moved to update_unit_activities*/ update_city_activities(pplayer); #ifdef CITIES_PROVIDE_RESEARCH if (city_list_size(&pplayer->cities)) /* has to be below the above for got_tech */ diff -u -r freecivold/server/unitfunc.c freeciv/server/unitfunc.c --- freecivold/server/unitfunc.c Sun Feb 6 12:52:49 2000 +++ freeciv/server/unitfunc.c Wed Feb 23 01:54:11 2000 @@ -1227,7 +1227,7 @@ } /*************************************************************************** -Restore unit move points and hitpoints. +Restore unit hitpoints. (movepoint - restoration moved to update_unit_activities) Do Leonardo's Workshop upgrade if applicable. Now be careful not to strand units at sea with the Workshop. --dwp Adjust air units for fuel: air units lose fuel unless in a city, @@ -1283,7 +1283,6 @@ unit_list_iterate(pplayer->units, punit) { unit_restore_hitpoints(pplayer, punit); - unit_restore_movepoints(pplayer, punit); if(punit->hp<=0) { /* This should usually only happen for heli units, @@ -1580,7 +1579,7 @@ if (unit_on_fortress(defender) && !map_get_city(defender->x, defender->y)) defensepower*=2; - if ((defender->activity == ACTIVITY_FORTIFY || + if ((defender->activity == ACTIVITY_FORTIFIED || map_get_city(defender->x, defender->y)) && is_ground_unit(defender)) defensepower*=1.5; @@ -1756,6 +1755,7 @@ progress settlers in their current tasks, and units that is pillaging. also move units that is on a goto. + restore unit move points (information needed for settler tasks) **************************************************************************/ void update_unit_activity(struct player *pplayer, struct unit *punit) { @@ -1765,12 +1765,19 @@ int activity = punit->activity; + /* to allow a settler to begin a task with no moves left without it counting toward the time to finish */ + if (punit->moves_left){ + punit->activity_count += mr/3; + } + + unit_restore_movepoints(pplayer, punit); + if (punit->connecting && !can_unit_do_activity(punit, activity)) { punit->activity_count = 0; do_unit_goto (pplayer, punit, get_activity_move_restriction(activity)); } - punit->activity_count += mr/3; + /* if connecting, automagically build prerequisities first */ if (punit->connecting && activity == ACTIVITY_RAILROAD && !(map_get_tile(punit->x, punit->y)->special & S_ROAD)) { @@ -1891,6 +1898,12 @@ unit_list_iterate_end; } + if (activity==ACTIVITY_FORTIFYING) { + if (punit->activity_count >= 1) { + set_unit_activity(punit,ACTIVITY_FORTIFIED); + } + } if (activity==ACTIVITY_GOTO) { if (!punit->ai.control && (!is_military_unit(punit) || diff -u -r freecivold/server/unithand.c freeciv/server/unithand.c --- freecivold/server/unithand.c Wed Feb 16 12:54:16 2000 +++ freeciv/server/unithand.c Wed Feb 23 01:53:20 2000 @@ -997,7 +997,7 @@ freelog(LOG_DEBUG, "Dragging %s from (%d,%d)->(%d,%d) (Success=%d)", unit_types[bodyguard->type].name, src_x, src_y, dest_x, dest_y, success); - handle_unit_activity_request(pplayer, bodyguard, ACTIVITY_FORTIFY); + handle_unit_activity_request(pplayer, bodyguard, ACTIVITY_FORTIFYING); } } } diff -u -r freecivold/server/unittools.c freeciv/server/unittools.c --- freecivold/server/unittools.c Tue Feb 1 12:51:27 2000 +++ freeciv/server/unittools.c Wed Feb 23 01:52:57 2000 @@ -314,7 +314,7 @@ else if (!is_heli_unit(punit)) hp++; - if(punit->activity==ACTIVITY_FORTIFY) + if(punit->activity==ACTIVITY_FORTIFIED) hp++; return hp;