--- freeciv-1.7.2.stock/common/unit.h Thu Dec 10 06:53:27 1998 +++ freeciv-1.7.2/common/unit.h Fri Feb 5 20:13:58 1999 @@ -127,6 +127,7 @@ int ord_map, ord_city; /* ord_map and ord_city are the order index of this unit in tile.units and city.units_supported; they are only used for save/reload */ + int moved; }; #define F_CARAVAN (1<<0) --- freeciv-1.7.2.stock/server/unithand.c Thu Dec 10 06:53:30 1998 +++ freeciv-1.7.2/server/unithand.c Fri Feb 5 20:17:04 1999 @@ -544,6 +544,8 @@ wipe_unit(pplayer, plooser); } else { + punit->moved=1; /* We moved */ + if (incity) notify_player_ex(&game.players[pwinner->owner], punit->x, punit->y, E_UNIT_WIN_ATT, "Game: Your attacking %s was successful against %s's %s at %s!", @@ -872,6 +874,9 @@ } } } + + punit->moved=1; + return 1; } return 0; --- freeciv-1.7.2.stock/server/unitfunc.c Fri Dec 18 18:57:47 1998 +++ freeciv-1.7.2/server/unitfunc.c Fri Feb 5 20:19:55 1999 @@ -839,18 +839,26 @@ void unit_restore_hitpoints(struct player *pplayer, struct unit *punit) { struct city *pcity; + + if(punit->moved) + punit->moved=0; + else { - punit->hp+=hp_gain_coord(punit); + punit->hp+=hp_gain_coord(punit); - pcity=city_list_find_id(&pplayer->cities, game.global_wonders[B_UNITED]); + pcity=city_list_find_id(&pplayer->cities, game.global_wonders[B_UNITED]); - if(pcity && !wonder_obsolete(B_UNITED)) - punit->hp+=2; + if(pcity && !wonder_obsolete(B_UNITED)) + punit->hp+=2; - if(punit->hp>get_unit_type(punit->type)->hp) - punit->hp=get_unit_type(punit->type)->hp; - if(punit->hp<0) - punit->hp=0; + if(punit->hp>=get_unit_type(punit->type)->hp) { + punit->hp=get_unit_type(punit->type)->hp; + if(punit->activity==ACTIVITY_SENTRY) + set_unit_activity(punit,ACTIVITY_IDLE); + } + if(punit->hp<0) + punit->hp=0; + } } @@ -1291,6 +1299,8 @@ notify_player_ex(&game.players[punit->owner], punit->x, punit->y, E_NOEVENT, "Game: unit transported succesfully."); connection_do_unbuffer(game.players[punit->owner].conn); + + punit->moved=1; return 1; }