Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-07-10 Thread William Allen Simpson

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

Committed trunk revision 13093.

Adopted some of Per's syntax, with my ruleset option, attached for posterity.

Index: server/citytools.c
===
--- server/citytools.c  (revision 13092)
+++ server/citytools.c  (working copy)
@@ -801,7 +801,8 @@
 
   give_citymap_from_player_to_player(pcity, pgiver, ptaker);
   old_vision = pcity-server.vision;
-  pcity-server.vision = vision_new(ptaker, pcity-tile, FALSE);
+  pcity-server.vision = vision_new(ptaker, pcity-tile);
+  vision_reveal_tiles(pcity-server.vision, game.info.city_reveal_tiles);
   vision_layer_iterate(v) {
 vision_change_sight(pcity-server.vision, v,
vision_get_sight(old_vision, v));
@@ -985,7 +986,8 @@
   }
 
   /* Before arranging workers to show unknown land */
-  pcity-server.vision = vision_new(pplayer, ptile, FALSE);
+  pcity-server.vision = vision_new(pplayer, ptile);
+  vision_reveal_tiles(pcity-server.vision, game.info.city_reveal_tiles);
   city_refresh_vision(pcity);
 
   tile_set_city(ptile, pcity);
Index: server/ruleset.c
===
--- server/ruleset.c(revision 13092)
+++ server/ruleset.c(working copy)
@@ -2684,6 +2684,10 @@
 exit(EXIT_FAILURE);
   }
 
+  /* civ1  2 didn't reveal tiles */
+  game.info.city_reveal_tiles =
+secfile_lookup_bool_default(file, FALSE, parameters.vision_reveal_tiles);
+
   /* City Styles ... */
 
   styles = secfile_get_secnames_prefix(file, CITYSTYLE_SECTION_PREFIX, nval);
Index: server/maphand.c
===
--- server/maphand.c(revision 13092)
+++ server/maphand.c(working copy)
@@ -1713,14 +1713,13 @@
 
   See documentation in maphand.h.
 /
-struct vision *vision_new(struct player *pplayer, struct tile *ptile,
- bool can_reveal_tiles)
+struct vision *vision_new(struct player *pplayer, struct tile *ptile)
 {
   struct vision *vision = fc_malloc(sizeof(*vision));
 
   vision-player = pplayer;
   vision-tile = ptile;
-  vision-can_reveal_tiles = can_reveal_tiles;
+  vision-can_reveal_tiles = TRUE;
   vision_layer_iterate(v) {
 vision-radius_sq[v] = -1;
   } vision_layer_iterate_end;
@@ -1729,6 +1728,20 @@
 }
 
 /
+  Sets the can_reveal_tiles flag.
+  Returns the old flag.
+
+  See documentation in maphand.h.
+/
+bool vision_reveal_tiles(struct vision *vision, bool reveal_tiles)
+{
+  bool was = vision-can_reveal_tiles;
+
+  vision-can_reveal_tiles = reveal_tiles;
+  return was;
+}
+
+/
   Returns the sight points (radius_sq) that this vision source has.
 
   See documentation in maphand.h.
Index: server/maphand.h
===
--- server/maphand.h(revision 13092)
+++ server/maphand.h(working copy)
@@ -120,9 +120,9 @@
   only rarely be necessary since all fogging and unfogging operations
   are taken care of internally.
 
-  The can_reveal_tiles parameter controls whether the vision source can
-  discover new (unknown) tiles or simply maintain vision on already-known
-  tiles.  Currently cities should pass FALSE for this since they cannot
+  vision_reveal_tiles() controls whether the vision source can discover
+  new (unknown) tiles or simply maintain vision on already-known tiles.
+  By default, cities should pass FALSE for this since they cannot
   discover new tiles.
 
   * IMPORTANT *
@@ -137,7 +137,7 @@
   visible.  For instance to move a unit:
 
 old_vision = punit-server.vision;
-punit-server.vision = vision_new(punit-owner, dest_tile, TRUE);
+punit-server.vision = vision_new(punit-owner, dest_tile);
 vision_change_sight(punit-server.vision,
 get_unit_vision_at(punit, dest_tile));
 
@@ -151,8 +151,8 @@
   a unit or city between players, etc.
 /
 struct vision;
-struct vision *vision_new(struct player *pplayer, struct tile *ptile,
- bool can_reveal_tiles);
+struct vision *vision_new(struct player *pplayer, struct tile *ptile);
+bool vision_reveal_tiles(struct vision *vision, bool reveal_tiles);
 int vision_get_sight(const struct vision *vision, enum vision_layer vlayer);
 void vision_change_sight(struct vision *vision, enum vision_layer vlayer,
 int radius_sq);
Index: server/unittools.c
===
--- server/unittools.c  (revision 13092)
+++ server/unittools.c  (working copy)
@@ -1378,7 +1378,7 @@
 

Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-05-19 Thread Per I. Mathisen

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

On Sat, 19 May 2007, William Allen Simpson wrote:
 Building civ1 cities didn't reveal unexplored areas!  So, my version
 with the configuration line is better for backward compatibility.

I do not see why we should worry about that. It is nice that people can 
play mods that feel like Civ1/2 with Freeciv, but we do not need to 
support all kinds of small oddball configurations and/or bugs that people 
scarcely even remember from civ1/2.

Given how many bugs we have and have had related to vision, I think we 
need to move toward making it simpler, rather than making it more complex.

   - Per



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-05-19 Thread William Allen Simpson

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

Per I. Mathisen wrote:
 I do not see why we should worry about that. It is nice that people can 
 play mods that feel like Civ1/2 with Freeciv, but we do not need to 
 support all kinds of small oddball configurations and/or bugs that people 
 scarcely even remember from civ1/2.
 
Admittedly, I played 1  2 so long ago that my memory is failing. ;-)

I'm assuming that you are old enough to have played civ1 regularly for
years (and civnet against multiple players), followed by more years
playing civ2.

I'm pretty sure the original freeciv authors disagree that the basic
visual operation of civ12 was oddball.  They went to some lengths to
reflect the actual historic functionality.

Indeed, my suggestion was *NOT* that the old functionality go away, but
that it should not be hard-coded -- a simple knob I proposed be added to
allow civ34 behavior.

Although I've only been on the mailing list for 18 months or so, and
rarely contribute, I've some recollection that you worked on adding many
knobs generalizing formerly hard-coded constants and functionality.  I'm
trying to cooperate in the same way.


 Given how many bugs we have and have had related to vision, I think we 
 need to move toward making it simpler, rather than making it more complex.
 
While hard-coding a behavior is simpler, it doesn't reflect my
understanding of the purpose of the project: the Good Parts Version of
the entire civ series with superior networking ability, and (hopefully)
improved AI, running on multiple platforms.

The old civ12 vision has been in the code and working for some time.

I'm actually quite disappointed about the recent removing of basic
functionality of civ12, such as reputation, temporary cease fire,
Fundamentalism, etc.

I'm even more disappointed that civ3 hasn't yet been added.  But one
thing at a time :-)



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-05-17 Thread Per I. Mathisen

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

On Wed, 16 May 2007, William Allen Simpson wrote:
 One of the nuisances (compared to the commercial games) is the
 limited vision radius of the city itself.
...
 When the city is founded, it still has only 1 radius vision.  That's
 wrong!  The citizens are capable of traveling 2 radii to work, but
 not working because they don't know about the lay of the land?  That
 makes no sense.

 50 years is plenty of time for settled citizens to explore.

Yes. Patch to change this most welcome.

   - Per



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-05-17 Thread William Allen Simpson

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

Per I. Mathisen wrote:
 Yes. Patch to change this most welcome.
 
Apparently, it was a conscious decision by some prior developer.  There
is a documented vision parameter that is only FALSE for cities.

Therefore, I propose a configurable ruleset option.  Tested, works for me.

--- ../cities.ruleset   Sun Feb 18 23:01:51 2007
+++ data/default/cities.ruleset Thu May 17 14:43:49 2007
@@ -60,6 +60,8 @@
 ;forced_luxury = 100
 ;forced_gold = 0
 
+vision_reveal_tiles = 1  ; was default zero for old savegames
+
 ;
 ; City styles define the way cities are drawn
 ;
--- ../citytools.c  Tue Mar 20 22:22:54 2007
+++ server/citytools.c  Thu May 17 13:49:28 2007
@@ -791,7 +791,7 @@
 
   give_citymap_from_player_to_player(pcity, pgiver, ptaker);
   old_vision = pcity-server.vision;
-  pcity-server.vision = vision_new(ptaker, pcity-tile, FALSE);
+  pcity-server.vision = vision_new(ptaker, pcity-tile, 
game.info.city_reveal_tiles);
   vision_layer_iterate(v) {
 vision_change_sight(pcity-server.vision, v,
vision_get_sight(old_vision, v));
@@ -974,7 +974,7 @@
   }
 
   /* Before arranging workers to show unknown land */
-  pcity-server.vision = vision_new(pplayer, ptile, FALSE);
+  pcity-server.vision = vision_new(pplayer, ptile, 
game.info.city_reveal_tiles);
   city_refresh_vision(pcity);
 
   tile_set_city(ptile, pcity);
--- ../packets.def  Tue Mar 20 22:23:07 2007
+++ common/packets.def  Thu May 17 13:25:59 2007
@@ -417,6 +417,7 @@
   UINT8 allowed_city_names;
   IMPROVEMENT palace_building;
   IMPROVEMENT land_defend_building;
+  BOOL city_reveal_tiles;
   BOOL changable_tax;
   UINT8 forced_science;
   UINT8 forced_luxury;
--- ../ruleset.cSun Feb 18 23:01:46 2007
+++ server/ruleset.cThu May 17 13:42:57 2007
@@ -2319,6 +2319,7 @@
   game.info.angrycitizen =
 secfile_lookup_bool_default(file, GAME_DEFAULT_ANGRYCITIZEN,
 parameters.angry_citizens);
+
   game.info.changable_tax = 
 secfile_lookup_bool_default(file, TRUE, parameters.changable_tax);
   game.info.forced_science = 
@@ -2332,6 +2333,10 @@
 freelog(LOG_FATAL, Forced taxes do not add up in ruleset!);
 exit(EXIT_FAILURE);
   }
+
+  /* old versions didn't reveal tiles */
+  game.info.city_reveal_tiles = 
+secfile_lookup_bool_default(file, FALSE, parameters.vision_reveal_tiles);
 
   /* City Styles ... */
 
--- ../savegame.c   Tue Mar 20 22:22:54 2007
+++ server/savegame.c   Thu May 17 13:45:08 2007
@@ -2378,7 +2378,7 @@
 }
 
 /* adding the cities contribution to fog-of-war */
-pcity-server.vision = vision_new(pcity-owner, pcity-tile, FALSE);
+pcity-server.vision = vision_new(pcity-owner, pcity-tile, 
game.info.city_reveal_tiles);
 city_refresh_vision(pcity);
 
 pcity-units_supported = unit_list_new();
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39370) 2.1.0b4 city vision radius too small

2007-05-17 Thread William Allen Simpson

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

Oh bother, I see that while I was poking at keeping things backward
compatible, you made a sweeping change.  Ah well, here's my 2.1.0b4
proposal as applied to trunk  Mix and match?

 /*
Index: server/citytools.c
===
--- server/citytools.c  (revision 12955)
+++ server/citytools.c  (working copy)
@@ -792,7 +792,7 @@
 
   give_citymap_from_player_to_player(pcity, pgiver, ptaker);
   old_vision = pcity-server.vision;
-  pcity-server.vision = vision_new(ptaker, pcity-tile, FALSE);
+  pcity-server.vision = vision_new(ptaker, pcity-tile, 
game.info.city_reveal_tiles);
   vision_layer_iterate(v) {
 vision_change_sight(pcity-server.vision, v,
vision_get_sight(old_vision, v));
@@ -976,7 +976,7 @@
   }
 
   /* Before arranging workers to show unknown land */
-  pcity-server.vision = vision_new(pplayer, ptile, FALSE);
+  pcity-server.vision = vision_new(pplayer, ptile, 
game.info.city_reveal_tiles);
   city_refresh_vision(pcity);
 
   tile_set_city(ptile, pcity);
Index: server/ruleset.c
===
--- server/ruleset.c(revision 12955)
+++ server/ruleset.c(working copy)
@@ -2575,6 +2575,7 @@
   game.info.angrycitizen =
 secfile_lookup_bool_default(file, GAME_DEFAULT_ANGRYCITIZEN,
 parameters.angry_citizens);
+
   game.info.changable_tax = 
 secfile_lookup_bool_default(file, TRUE, parameters.changable_tax);
   game.info.forced_science = 
@@ -2589,6 +2590,10 @@
 exit(EXIT_FAILURE);
   }
 
+  /* old versions didn't reveal tiles */
+  game.info.city_reveal_tiles = 
+secfile_lookup_bool_default(file, FALSE, parameters.vision_reveal_tiles);
+
   /* City Styles ... */
 
   styles = secfile_get_secnames_prefix(file, citystyle_, nval);
Index: server/savegame.c
===
--- server/savegame.c   (revision 12955)
+++ server/savegame.c   (working copy)
@@ -2426,7 +2426,7 @@
 }
 
 /* adding the cities contribution to fog-of-war */
-pcity-server.vision = vision_new(pcity-owner, pcity-tile, FALSE);
+pcity-server.vision = vision_new(pcity-owner, pcity-tile, 
game.info.city_reveal_tiles);
 city_refresh_vision(pcity);
 
 pcity-units_supported = unit_list_new();
 /***
Index: data/default/cities.ruleset
===
--- data/default/cities.ruleset (revision 12955)
+++ data/default/cities.ruleset (working copy)
@@ -60,6 +60,8 @@
 ;forced_luxury = 100
 ;forced_gold = 0
 
+vision_reveal_tiles = 1  ; was default zero for old savegames
+
 ;
 ; City styles define the way cities are drawn
 ;
Index: common/packets.def
===
--- common/packets.def  (revision 12955)
+++ common/packets.def  (working copy)
@@ -425,6 +425,7 @@
   UINT8 allowed_city_names;
   IMPROVEMENT palace_building;
   IMPROVEMENT land_defend_building;
+  BOOL city_reveal_tiles;
   BOOL changable_tax;
   UINT8 forced_science;
   UINT8 forced_luxury;
Index: common/city.c
===
--- common/city.c   (revision 12955)
+++ common/city.c   (working copy)
@@ -2389,6 +2389,7 @@
   pcity-server.needs_arrange = FALSE;
   pcity-server.vision = NULL; /* No vision. */
 
+  pcity-ai.founder_boat = FALSE;
   pcity-ai.founder_want = 0; /* calculating this is really expensive */
   pcity-ai.next_founder_want_recalc = 0; /* turns to recalc found_want */
   pcity-ai.trade_want = 1; /* we always want some */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev