Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
Re: [Freeciv-Dev] arctic railroads are sometimes broken (PR#52)
Home

Re: [Freeciv-Dev] arctic railroads are sometimes broken (PR#52)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jjm@xxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Freeciv-Dev] arctic railroads are sometimes broken (PR#52)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Wed, 14 Jul 1999 22:47:54 +1000 (EST)

Jeff Mallatt wrote:

> When in the far arctic (map y==0, near the maximum x location), I upgraded a
> road to a railroad, and that square's "roadness" went away.

Ahah, I think I've worked out whats going wrong.  
A few things, really. 

First is that ai_calc_railroad() should not have been
using map_set_special() and map_clear_special() at all,
because it leads to unecessary calls to reset_move_costs()
(see the comment in ai_calc_road() above it).

Second is boundary conditions and the mess with the 
void_tile and map_adjust_y(), which are both a bit dubious.
Effectively the void_tile allows often ignoring the 
map boundary conditions, but sometimes you get bitten.

Here, when using map_get_tile(), it returns &void_tile
when off the North/South of the map.  Normally you can
mess with void_tile without hurting anything.  But better
would be for ai_calc_railroad to quit early for out-of-range
y values.

The problem comes because map_set_special() and map_clear_special()
do an insidious "y = map_adjust_y(y);" which means that instead
of operating on the void_tile, we end up operating on a real
tile with different y; in this case when we should be operating
on the void_tile (or preferably, doing nothing), we end up
clearing the roadness of a real tile.

At least I think that is what is happening...

Summary :-)

- Jeff's patch is fine, as it stands (avoids map_set/clear_special,
  so operates consistently on the void_tile, and is simpler and 
  clearer than the current to boot);
- Really/also, this and related functions should be modified to
  quit early when y is out of range.  (Avoid unnecessary calcs,
  potential similar problems.)

(A related bug: it is possible to place one worker (out of
all cities) on the void_tile -- that is, in the blackness
North/South of the poles...)

Regards,
-- David

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