]> git.pond.sub.org Git - empserver/commit
fairland: Simplify search for next wilderness to elevate
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 16 Aug 2020 15:42:02 +0000 (17:42 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 09:41:36 +0000 (10:41 +0100)
commit380d2e9f551499da8ddf2dcbe897416f98732623
treeb319a56080e2737698b39f708d56dda25b0e41c7
parent4f0af0bae0a98e452127552b5c15499ac25e5be6
fairland: Simplify search for next wilderness to elevate

To find the wilderness sector to elevate next, elevate_land() searches
the non-mountain, non-capital sectors of the island for one that
maximizes a function of its distance to mountains and to sea.

The search ignores already elevated sectors in a less than obvious
way: 1. it never picks a sector where the function yields -INFINITY or
less, and 2. when elevating a wilderness, its (cached) distances get
reset to values that make the function return a more negative value.

Use a more direct check of "not yet elevated": elevation is still the
initial -INFINITY.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/util/fairland.c