Index: common/tech.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v retrieving revision 1.25 diff -u -r1.25 tech.c --- tech.c 2000/09/11 06:40:38 1.25 +++ tech.c 2001/03/08 23:24:35 @@ -28,7 +28,8 @@ static const char *flag_names[] = { "Bonus_Tech","Boat_Fast","Bridge","Railroad","Fortress", - "Population_Pollution_Inc","Trade_Revenue_Reduce","Airbase","Farmland" + "Population_Pollution_Inc","Trade_Revenue_Reduce","Airbase","Farmland", + "Reduce_Trireme_Loss1", "Reduce_Trireme_Loss2" }; /* Note that these strings must correspond with the enums in tech_flag_id, in common/tech.h */ Index: common/tech.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/tech.h,v retrieving revision 1.19 diff -u -r1.19 tech.h --- tech.h 2000/05/31 13:35:15 1.19 +++ tech.h 2001/03/08 23:24:35 @@ -51,6 +51,8 @@ reduces the initial revenue by cumulative factors of 2/3 */ TF_AIRBASE, /* "Airbase" unit types can build Airbases */ TF_FARMLAND, /* "Settler" unit types can build farmland */ + TF_REDUCE_TRIREME_LOSS1, /* Reduces chance of Trireme being lost at sea */ + TF_REDUCE_TRIREME_LOSS2, /* Reduces chance of Trireme being lost at sea */ TF_LAST }; Index: common/unit.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v retrieving revision 1.115 diff -u -r1.115 unit.c --- unit.c 2001/02/20 19:23:33 1.115 +++ unit.c 2001/03/08 23:24:36 @@ -1167,3 +1167,27 @@ return 1; } + +/* + * Triremes have a varying loss percentage. based on tech. + * Seafaring reduces this to 25%, Navigation to 12.5%. The Lighthouse + * wonder reduces this to 0. AJS 20010301 + */ +int trireme_loss_pct(struct player *pplayer, int x, int y) { + int losspct = 50; + + /* + * If we are in a city or next to land, we have no chance of losing + * the ship. To make this really useful for ai planning purposes, we'd + * need to confirm that we can exist/move at the x,y location we are given. + */ + if ((map_get_terrain(x, y) != T_OCEAN) || is_coastline(x, y) || + (player_owns_active_wonder(pplayer, B_LIGHTHOUSE))) + losspct = 0; + else if (player_knows_techs_with_flag(pplayer,TF_REDUCE_TRIREME_LOSS2)) + losspct /= 4; + else if (player_knows_techs_with_flag(pplayer,TF_REDUCE_TRIREME_LOSS1)) + losspct /= 2; + + return losspct; +} Index: common/unit.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v retrieving revision 1.66 diff -u -r1.66 unit.h --- unit.h 2001/02/20 19:23:34 1.66 +++ unit.h 2001/03/08 23:24:36 @@ -182,4 +182,7 @@ int is_my_zoc(struct unit *myunit, int x0, int y0); +int trireme_loss_pct(struct player *pplayer, int x, int y); + + #endif /* FC__UNIT_H */ Index: data/civ2/techs.ruleset =================================================================== RCS file: /home/freeciv/CVS/freeciv/data/civ2/techs.ruleset,v retrieving revision 1.13 diff -u -r1.13 techs.ruleset --- techs.ruleset 2000/08/12 02:46:01 1.13 +++ techs.ruleset 2001/03/08 23:24:36 @@ -385,7 +385,7 @@ name = _("Navigation") req1 = "Seafaring" req2 = "Astronomy" -flags = "" +flags = "Reduce_Trireme_Loss2" [advance_nuclear_fission] name = _("Nuclear Fission") @@ -481,7 +481,7 @@ name = _("Seafaring") req1 = "Pottery" req2 = "Map Making" -flags = "" +flags = "Reduce_Trireme_Loss1" [advance_space_flight] name = _("Space Flight") Index: data/default/techs.ruleset =================================================================== RCS file: /home/freeciv/CVS/freeciv/data/default/techs.ruleset,v retrieving revision 1.12 diff -u -r1.12 techs.ruleset --- techs.ruleset 2000/01/05 17:39:56 1.12 +++ techs.ruleset 2001/03/08 23:24:36 @@ -385,7 +385,7 @@ name = _("Navigation") req1 = "Seafaring" req2 = "Astronomy" -flags = "" +flags = "Reduce_Trireme_Loss2" [advance_nuclear_fission] name = _("Nuclear Fission") @@ -481,7 +481,7 @@ name = _("Seafaring") req1 = "Pottery" req2 = "Map Making" -flags = "" +flags = "Reduce_Trireme_Loss1" [advance_space_flight] name = _("Space Flight") Index: server/unittools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v retrieving revision 1.102 diff -u -r1.102 unittools.c --- unittools.c 2001/03/03 22:51:45 1.102 +++ unittools.c 2001/03/08 23:24:38 @@ -813,7 +813,7 @@ unit_list_unlink_all(&candidates); } - + /*************************************************************************** Restore unit hitpoints. (movepoint - restoration moved to update_unit_activities) Do Leonardo's Workshop upgrade if applicable. @@ -824,12 +824,11 @@ number of units each, equal to their transport_capacity. --dwp (Hitpoint adjustments include Helicopters out of cities, but that is handled within unit_restore_hitpoints().) -Triremes will be wiped with 50% chance if they're not close to +Triremes will be wiped with a variable chance if they're not close to land, and player doesn't have Lighthouse. ****************************************************************************/ void player_restore_units(struct player *pplayer) { - int lighthouse_effect=-1; /* 1=yes, 0=no, -1=not yet calculated */ int done; /* get Leonardo out of the way first: */ @@ -921,14 +920,9 @@ get_nation_name_plural(pplayer->nation), unit_name(punit->type)); wipe_unit_safe(punit, &myiter); - } - } else if (unit_flag(punit->type, F_TRIREME) && (lighthouse_effect!=1) && - !is_coastline(punit->x, punit->y) && - (map_get_terrain(punit->x, punit->y) == T_OCEAN)) { - if (lighthouse_effect == -1) { - lighthouse_effect = player_owns_active_wonder(pplayer, B_LIGHTHOUSE); } - if ((!lighthouse_effect) && (myrand(100) >= 50)) { + } else if (unit_flag(punit->type, F_TRIREME)) { + if ((myrand(100) <= trireme_loss_pct(pplayer, punit->x, punit->y))) { notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST, _("Game: Your %s has been lost on the high seas."), unit_name(punit->type));