URL:
  <http://gna.org/bugs/?15714>

                 Summary: Cient-side connect-with-rail doesn't take into
account railroad length
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Saturday 03/27/10 at 17:41
                Category: client
                Severity: 2 - Minor
                Priority: 5 - Normal
                  Status: Ready For Test
             Assigned to: jtn
        Originator Email: 
             Open/Closed: Open
                 Release: 2.1.11, 2.2.0
         Discussion Lock: Any
        Operating System: None
         Planned Release: 2.1.12, 2.2.1

    _______________________________________________________

Details:

While reading the client-side goto code for railroad (in
client/goto.c:get_connect_road()) I found this:


      if (total_cost > *dest_cost
         || (total_cost == *dest_cost && total_cost >= *dest_cost)) {


There are clearly redundant terms; compare the clause just above. I think it
should be the obvious lexicographic comparison:


      if (total_cost > *dest_cost
         || (total_cost == *dest_cost && total_extra >= *dest_extra)) {


Looks like it's been this way since client-side connect was implemented in
2004 (RT #7282).

I think the effect is that for two candidate paths whose construction cost is
equal, the length of the resulting railroad is not taken into account as a
tie-breaker, contrary to the comments in the function which suggest that it
will be minimised. I think this is a pretty minor bug (if it manifests at
all) as the length of a railroad is usually not interesting; I haven't been
able to contrive a case where it makes a difference.

It also means that the return of the function is not consistent with the
comparison within the function (as the return takes into account
total_extra), but looking at the path-finding code I don't think that'll
break anything.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Saturday 03/27/10 at 17:41  Name:
S2_1-S2_2-trunk-connect-railroad-calc.diff  Size: 447B   By: jtn
S2_1/S2_2/trunk r17172: connect-with-rail takes into account length of
railroad
<http://gna.org/bugs/download.php?file_id=8694>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?15714>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to