Complete.Org: Mailing Lists: Archives: freeciv-dev: October 1999:
[Freeciv-Dev] Re: Specials near rivers
Home

[Freeciv-Dev] Re: Specials near rivers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Specials near rivers
From: Jeff Mallatt <jjm@xxxxxxxxxxxx>
Date: Wed, 20 Oct 1999 14:04:07 -0400

At 1999/10/20 12:32 , Jerzy Klek wrote:
>I just noticed a funny thing: when specials are added
>during map generation, map.c:is_special_is_close() is called:
>
>int is_special_close(int x, int y)
>{
>  int x1,y1;
>  for (x1=x-1;x1<x+2;x1++)
>    for (y1=y-1;y1<=y+2;y1++) 
>      if(map_get_tile(x1,y1)->special)
>       return 1;
>  return 0;
>}
>
>but now rivers are also specials so as an effect, you never
>get specials near rivers. Is it on purpose, or noone noticed it?

Yup.  Definitely a bug!!

>I find it not nice really, what about changing this?
>
>--- freeciv/common/map.c       Tue Oct  5 12:46:05 1999
>+++ freeciv-b/common/map.c     Wed Oct 20 18:20:57 1999
>@@ -443,7 +443,7 @@
>   int x1,y1;
>   for (x1=x-1;x1<x+2;x1++)
>     for (y1=y-1;y1<=y+2;y1++) 
>-      if(map_get_tile(x1,y1)->special)
>+      if(map_get_tile(x1,y1)->special & ~(S_RIVER))
>       return 1;
>   return 0;
> }
>
>I tested it and it really makes a difference. 

That will work, but in this context, I think there are really only two
"specials" (S_SPECIAL_1 and S_SPECIAL_2).  So, how about:

diff -ru FreecivCVS/common/map.c freeciv/common/map.c
--- FreecivCVS/common/map.c     Mon Oct  4 11:16:50 1999
+++ freeciv/common/map.c        Wed Oct 20 14:00:00 1999
@@ -443,7 +443,7 @@
   int x1,y1;
   for (x1=x-1;x1<x+2;x1++)
     for (y1=y-1;y1<=y+2;y1++) 
-      if(map_get_tile(x1,y1)->special)
+      if(map_get_tile(x1,y1)->special&(S_SPECIAL_1 | S_SPECIAL_2))
        return 1;
   return 0;
 }

jjm


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