<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39830 >

Per Inge Mathisen wrote:
> But why is this a problem? The vision code and the border code should
> not interact at all in the current design.
And that, my friend, is the root of the problem.  As the border expands,
the vision isn't expanding with it (as I thought we'd established
earlier in the thread.)  Some parts of the code think the pseudo-city
within the border should be in the player's city list, plus some other
problem (cause not discovered) sends unknown tiles within the border.

>> Moreover, the savegame map_load should run map_calculate_borders().  Is
>> there a reason it was only done between turns?
> Because running it causes borders to expand, and saving then loading
> should not change game state.
OK, understood.  Has to be based on saved data.

As often happens, I slept on it, and awoke (3 hours early) with a
possible solution.  As they say, "All problems in computer science
can be solved by another level of indirection."

There already exists a (server-side-only) struct dumb_city.  By moving
border, culture, influence, etc. information there (suitably renamed,
there are only 9 references), changing (server-side-only) owner_source
to point at it, the inconsistency can be resolved.

In turn, the dumb_city presence boosts (server-side-only) player_tile->
seen_count (just like a unit), updating tile->tile_seen.  No changes to
network code!

This also handles base, fortress, airport, etc. -- currently a big
difference between 2.1 and 2.2.  I was wondering how I'd solve that base
issue.  Coding the previous two patches in this series was a bit of a
nightmare.  Seemingly every patch section was slightly different, patch
rejected them.  I used the BBEdit ability to parallel search and replace
on multiple directories, and synchronize window scrolling, to make each
change.  My eyes are hurting comparing the two, even with wide screens!

Freeciv-dev mailing list

Reply via email to