Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8754) effects patch
Home

[Freeciv-Dev] (PR#8754) effects patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8754) effects patch
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Wed, 19 May 2004 15:57:43 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8754 >

> [vasc - Wed May 19 21:54:05 2004]:
> 
> > [per@xxxxxxxxxxx - Mon May 17 13:35:39 2004]:
> > 
> > The patch uses city_affected_by_wonder() heavily, but this function is
> > still all hardcoded. I assume the intention is to reuse the equiv_range
> > here instead of the hardcoding, and generalizing this function using the
> > game.global_wonders array and equiv_range info should be pretty
easy. This
> > redefines equiv_range slightly, which should be documented at least,
but I
> > fail to see any sanity in equiv_range _not_ being equal to the wonder's
> > effective range. That is, since the eff patch cannot by design have
> > differently ranged effects in one wonder anyway.
> 
> Yes, that is more or less the idea. But a wonder can have differently
> ranged effects. As long as they do not have the same target type. The
> target type is defined by the use of the get_*_bonus functions.

Here is the patch for using equiv_range in city_affected_by_wonder.

diff -Nurd -X diff_ignore fc/common/city.c freeciv/common/city.c
--- fc/common/city.c    2004-05-19 23:49:13.536725376 +0100
+++ freeciv/common/city.c       2004-05-20 00:00:06.439469072 +0100
@@ -1080,47 +1080,18 @@
    * Otherwise the player who owns the city needs to have it to
    * get the effect.
    */
-  if (id==B_MANHATTEN) 
-    return (game.global_wonders[id] != 0);
-  
   tmp = player_find_city_by_id(city_owner(pcity), game.global_wonders[id]);
   if (!tmp)
     return FALSE;
-  switch (id) {
-  case B_ASMITHS:
-  case B_APOLLO:
-  case B_CURE:
-  case B_GREAT:
-  case B_WALL:
-  case B_HANGING:
-  case B_ORACLE:
-  case B_UNITED:
-  case B_WOMENS:
-  case B_DARWIN:
-  case B_LIGHTHOUSE:
-  case B_MAGELLAN:
-  case B_MICHELANGELO:
-  case B_SETI:
-  case B_PYRAMIDS:
-  case B_LIBERTY:
-  case B_SUNTZU:
-    return TRUE;
-  case B_ISAAC:
-  case B_COPERNICUS:
-  case B_SHAKESPEARE:
-  case B_COLLOSSUS:
-  case B_RICHARDS:
-    return FALSE;
-  case B_HOOVER:
-  case B_BACH:
-    if (improvement_variant(id)==1) {
+
+  switch (get_improvement_type(id)->equiv_range) {
+    case IR_PLAYER:
+      return TRUE;
+    case IR_ISLAND:
       return (map_get_continent(tmp->x, tmp->y) ==
              map_get_continent(pcity->x, pcity->y));
-    } else {
-      return TRUE;
-    }
-  default:
-    return FALSE;
+    default:
+      return FALSE;
   }
 }
 
diff -Nurd -X diff_ignore fc/data/default/buildings.ruleset 
freeciv/data/default/buildings.ruleset
--- fc/data/default/buildings.ruleset   2004-05-19 23:49:05.244985912 +0100
+++ freeciv/data/default/buildings.ruleset      2004-05-19 23:59:49.044113568 
+0100
@@ -1734,7 +1734,7 @@
 graphic_alt    = "-"
 ;terr_gate     =
 ;spec_gate     =
-equiv_range    = "Player"
+equiv_range    = "Island"
 ;equiv_dupl    =
 ;equiv_repl    =
 obsolete_by    = "None"
@@ -1800,7 +1800,7 @@
 graphic_alt    = "-"
 ;terr_gate     =
 ;spec_gate     =
-equiv_range    = "Player"
+equiv_range    = "Island"
 ;equiv_dupl    =
 ;equiv_repl    =
 obsolete_by    = "None"

[Prev in Thread] Current Thread [Next in Thread]