[Freeciv-Dev] (PR#35708) [Patch] Triremes cannot enter Deep Ocean

2007-02-13 Thread Jason Short

URL: http://bugs.freeciv.org/Ticket/Display.html?id=35708 

 [EMAIL PROTECTED] - Sun Feb 11 13:57:16 2007]:
 
  Untested patch to limit Triremes to Ocean tiles. Applies on top of
 Deep Ocean patch #34265.
  Also, Triremes do not get move bonus from Nuclear Power.

Here is a more complicated spur-of-the-moment patch, it includes the
trireme limitation and 34265, as well as removing all the
trireme-specific code (much of which is already deprecated with the
removal of dangerous tiles).

-jason

Index: version.in
===
--- version.in	(revision 12631)
+++ version.in	(working copy)
@@ -24,4 +24,4 @@
 #   - Avoid adding a new manditory capbility to the development branch for
 # as long as possible.  We want to maintain network compatibility with
 # the stable branch for as long as possible.
-FREECIV_NETWORK_CAPSTRING(+Freeciv.Devel.2007.Jan.21)
+FREECIV_NETWORK_CAPSTRING(+Freeciv.Devel.2007.Feb.12)
Index: doc/README.effects
===
--- doc/README.effects	(revision 12631)
+++ doc/README.effects	(working copy)
@@ -120,9 +120,6 @@
 No_Anarchy
 No period of anarchy between government changes.
 
-No_Sink_Deep
-Triremes no longer sink when on dangerous seas.
-
 Nuke_Proof
 City is nuke proof.
 
Index: server/ruleset.c
===
--- server/ruleset.c	(revision 12631)
+++ server/ruleset.c	(working copy)
@@ -1014,19 +1014,6 @@
 free(def_vblist);
   }
 
-  /* highseas loss pct */
-  def_vblist = secfile_lookup_int_vec(file, vet_levels_default,
-  		  	veteran_system.veteran_highseas_loss_pct);
-  for (i = 0; i  vet_levels_default; i++) {
-game.trireme_loss_chance[i] = def_vblist[i];
-  }
-  for (; i  MAX_VET_LEVELS; i++) {
-game.trireme_loss_chance[i] = 50; /* default */
-  }
-  if (def_vblist) {
-free(def_vblist);
-  }
-  
   /* move bonus */
   def_vblist = secfile_lookup_int_vec(file, vet_levels_default,
   veteran_system.veteran_move_bonus);
@@ -3205,8 +3192,6 @@
 {
   struct packet_ruleset_game misc_p;
 
-  memcpy(misc_p.trireme_loss_chance, game.trireme_loss_chance, 
- sizeof(game.trireme_loss_chance));
   memcpy(misc_p.work_veteran_chance, game.work_veteran_chance, 
  sizeof(game.work_veteran_chance));
   memcpy(misc_p.veteran_chance, game.veteran_chance, 
Index: server/unithand.c
===
--- server/unithand.c	(revision 12631)
+++ server/unithand.c	(working copy)
@@ -951,10 +951,6 @@
 notify_player(unit_owner(punit), src_tile, E_BAD_COMMAND,
 		 _(%s can only move into your own zone of control.),
 		 unit_type(punit)-name);
-  } else if (reason == MR_TRIREME) {
-notify_player(unit_owner(punit), src_tile, E_BAD_COMMAND,
-		 _(%s cannot move that far from the coast line.),
-		 unit_type(punit)-name);
   }
   return FALSE;
 }
Index: data/amplio/terrain2.spec
===
--- data/amplio/terrain2.spec	(revision 12631)
+++ data/amplio/terrain2.spec	(working copy)
@@ -144,76 +144,113 @@
 tiles = { row, column,tag
 
 ; ocean cell sprites.  See doc/README.graphics
- 0, 0,  t.ocean_cell_u000
- 0, 2,  t.ocean_cell_u100
- 0, 4,  t.ocean_cell_u010
- 0, 6,  t.ocean_cell_u110
- 0, 8,  t.ocean_cell_u001
- 0, 10, t.ocean_cell_u101
- 0, 12, t.ocean_cell_u011
- 0, 14, t.ocean_cell_u111
+ 0, 0,  t.l0.ocean_cell_u000
+ 0, 2,  t.l0.ocean_cell_u100
+ 0, 4,  t.l0.ocean_cell_u010
+ 0, 6,  t.l0.ocean_cell_u110
+ 0, 8,  t.l0.ocean_cell_u001
+ 0, 10, t.l0.ocean_cell_u101
+ 0, 12, t.l0.ocean_cell_u011
+ 0, 14, t.l0.ocean_cell_u111
  
- 1, 0,  t.ocean_cell_d000
- 1, 2,  t.ocean_cell_d100
- 1, 4,  t.ocean_cell_d010
- 1, 6,  t.ocean_cell_d110
- 1, 8,  t.ocean_cell_d001
- 1, 10, t.ocean_cell_d101
- 1, 12, t.ocean_cell_d011
- 1, 14, t.ocean_cell_d111
+ 1, 0,  t.l0.ocean_cell_d000
+ 1, 2,  t.l0.ocean_cell_d100
+ 1, 4,  t.l0.ocean_cell_d010
+ 1, 6,  t.l0.ocean_cell_d110
+ 1, 8,  t.l0.ocean_cell_d001
+ 1, 10, t.l0.ocean_cell_d101
+ 1, 12, t.l0.ocean_cell_d011
+ 1, 14, t.l0.ocean_cell_d111
 
- 2, 0,  t.ocean_cell_l000
- 2, 2,  t.ocean_cell_l100
- 2, 4,  t.ocean_cell_l010
- 2, 6,  t.ocean_cell_l110
- 2, 8,  t.ocean_cell_l001
- 2, 10, t.ocean_cell_l101
- 2, 12, t.ocean_cell_l011
- 2, 14, t.ocean_cell_l111
+ 2, 0,  t.l0.ocean_cell_l000
+ 2, 2,  t.l0.ocean_cell_l100
+ 2, 4,  t.l0.ocean_cell_l010
+ 2, 6,  t.l0.ocean_cell_l110
+ 2, 8,  t.l0.ocean_cell_l001
+ 2, 10, t.l0.ocean_cell_l101
+ 2, 12, t.l0.ocean_cell_l011
+ 2, 14, t.l0.ocean_cell_l111
 
- 2, 1,  t.ocean_cell_r000
- 2, 3,  t.ocean_cell_r100
- 2, 5,  t.ocean_cell_r010
- 2, 7,  t.ocean_cell_r110
- 2, 9,  t.ocean_cell_r001
- 2, 11, t.ocean_cell_r101
- 2, 13, t.ocean_cell_r011
- 2, 15, t.ocean_cell_r111
+ 2, 1,  t.l0.ocean_cell_r000
+ 2, 3,  t.l0.ocean_cell_r100
+ 2, 5,  t.l0.ocean_cell_r010
+ 2, 7,  

Re: [Freeciv-Dev] (PR#35532) function adjust_building_wants_by_effects() works in unexpected ways

2007-02-13 Thread Frank Balbach

URL: http://bugs.freeciv.org/Ticket/Display.html?id=35532 


 On Fri, 9 Feb 2007, Frank Balbach wrote:
   
 I believe the function adjust_building_wants_by_effects() may not always
 work as intendend (but then I might get the intention wrong).
 
 ...
   
 If the developers in charge agree with the above, I would happily
 provide some patches.
 

 Is this only for 2.1? If so, I'd say we should do as little changes as 
 possible, even if it means the AI will not build harbours.

 Could you check how things fare in the SVN trunk (ie the to-be-2.2)?
   

In the SVN trunk, things are similar as described in my first posting 
for 2.1 although adjust_building_wants... is now called 
adjust_improvement_wants... and the variable useful has been renamed 
to active.

I'd like to stress that IMO the AI builds harbours reasonably well (both 
in trunk and in 2.1) and that my proposed changes do not at all effect 
the behavior of the AI (except maybe in very customised rulesets).

My main intention was to make the code behave in a slightly more 
transparent way.  Therefore, it probably suffices to apply the changes 
to SVN trunk only (if at all).

Anyway, I've created some patches:  harboureffect patches aicity.c, 
effruleset patches effects.ruleset.  The patches with 21 apply to 
2.1, the other ones to trunk (revision 12645 in both cases).

Frank


--- effects.ruleset.orig	2007-02-13 11:21:48.0 +0100
+++ effects.ruleset	2007-02-13 11:45:40.0 +0100
@@ -967,7 +967,7 @@
 value	= 1
 reqs	=
 { type, name, range
-  Terrain, Ocean, Local
+  Terrain, Ocean, Adjacent
   Building, Harbour, City
   OutputType, Food, Local
 }
@@ -1138,7 +1138,7 @@
 value	= 1
 reqs	=
 { type, name, range
-  Terrain, Ocean, Local
+  Terrain, Ocean, Adjacent
   Building, Offshore Platform, City
   OutputType, Shield, Local
 }
--- effects.ruleset.orig	2007-02-13 12:02:08.0 +0100
+++ effects.ruleset	2007-02-13 12:01:54.0 +0100
@@ -948,7 +948,7 @@
 value	= 1
 reqs	=
 { type, name, range
-  Terrain, Ocean, Local
+  Terrain, Ocean, Adjacent
   Building, Harbour, City
   OutputType, Food, Local
 }
@@ -1119,7 +1119,7 @@
 value	= 1
 reqs	=
 { type, name, range
-  Terrain, Ocean, Local
+  Terrain, Ocean, Adjacent
   Building, Offshore Platform, City
   OutputType, Shield, Local
 }
--- aicity.c.orig	2007-02-13 11:00:28.0 +0100
+++ aicity.c	2007-02-13 11:48:50.0 +0100
@@ -805,7 +805,7 @@
 struct tech_vector needed_techs;
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
-			   NULL, NULL, NULL, NULL,
+			   pcity-tile, NULL, NULL, NULL,
 			   peffect)) {
   continue;
 }
@@ -820,7 +820,10 @@
 	mypreq = preq;
 continue;
   }
-  if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
+  if (preq-source.type == REQ_OUTPUTTYPE) {
+continue;
+  }
+  if (!is_req_active(pplayer, pcity, pimpr, pcity-tile, NULL, NULL, NULL,
 			 preq)) {
 	active = FALSE;
 	if (preq-source.type == REQ_TECH) {
--- aicity.c.orig	2007-02-13 11:57:52.0 +0100
+++ aicity.c	2007-02-13 12:00:55.0 +0100
@@ -306,7 +306,7 @@
 bool useful;
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
-			   NULL, NULL, NULL, NULL,
+			   ptile, NULL, NULL, NULL,
 			   peffect)) {
   CITY_LOG(LOG_DEBUG, pcity, %s has a disabled effect: %s, 
get_improvement_name(id), effect_type_name(peffect-type));
@@ -323,7 +323,10 @@
 	mypreq = preq;
 continue;
   }
-  if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
+  if (preq-source.type == REQ_OUTPUTTYPE) {
+continue;
+  }
+  if (!is_req_active(pplayer, pcity, pimpr, ptile, NULL, NULL, NULL,
 			 preq)) {
 	useful = FALSE;
 	break;
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev