SmatZ wrote:crash after building road in SE when there is no town
Okay, will be fixed.
SmatZ wrote:savegame bump is not needed
But how do you know you need to calculate the closest town then? I'm also not sure if it has bad side-effects if a game saved by this patch is loaded in a non-patched version (the town index may be non-zero for non-town-owned roads now). So, are you sure, it's not needed?
SmatZ wrote:use "threshold == UINT_MAX" instead of "threshold == (uint)-1" (similiar problem at more places)
I also thought, this looked strange, but only re-used existing code. I can change it, though. UINT_MAX looks a lot better
SmatZ wrote:you should use existing CheckSavegameVersion()
The existing one is strange, why does it exist for a non-existing savegame version?
SmatZ wrote:UpdateRoadTilesTown() name is a bit weird

I guess my C++ compiler wouldn't be that happy about UpdateRoadTile'sTown
SmatZ wrote:
"if (_game_mode == GM_EDITOR)" in town_cmd.cpp - is it needed?
When founding towns after building roads (which can only happen in scenario editor), the closest town of a road tile may change and needs to be recalculated.
SmatZ wrote:change in ClosestTownFromTile() - is it needed? won't it cause strange behaviour when treshold == 99999999?
Of course, this must be changed, as otherwise the expensive call to CalcClosestTownFromTile would still happen.
However, if that check for the threshold is not there, the land info on road tile will always report the road to have the local authority of the closest town. Hmm, I just notice, I shouldn't call CalcClosestTownFromTile in that case, either, but just check, whether the closest town is in range.
Thank you for taking the time to comment.
I'll do the changes tomorrow, as nothing is worse than coding when dog-tired

So, guys don't build roads before founding a town until then
Edit: I also considered a caching approach, i.e. not converting on loading the game, but checking the town for validity on access and calculate if needed. Would that be better? The problem about this is, that town index zero is stored for non-town-owned roads at the moment and this is a valid town index, isn't it?
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008