On 06.01.2013 13:40, Michael T. Pope wrote:
> Something has broken badly in movement cost handling for roads and possibly
> rivers, and it seems to be related to the "style" changes.  BR#3599498
> references a saved game that shows the problem nicely if you try to send the
> wagon mentioned to New Rotterdam --- the path it takes is highly suboptimal
> and seems to often ignore the roads.  I have traced the failure to get the
> expected benefit from a road down to TileImprovement.getMoveCost --- the road
> tile improvement at 39,116 for example has a style of 0000 despite being
> nearly surrounded by other tiles with road improvements, thus the
> style.isConnectedTo() test fails.
>
> Out of time now.  Looks like another delay for 0.10.7:-(.
>
> Cheers,
> Mike Pope
>    

Something like this is butt-ugly, but it should work:


     public boolean isConnectedTo(Direction direction) {
         if (isRiver()) {
             return style == null ? false : style.isConnectedTo(direction);
         } else if (isRoad()) {
             Tile other = tile.getNeighbourOrNull(direction);
             if (other == null) {
                 return other.hasRoad();
             }
         }
         // other improvement types do not connect
         return false;
     }


A proper solution would be to calculate the correct style for each newly 
added road, as well as the roads on all surrounding tiles, I think.


Regards

Michael


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to