Follow-up Comment #7, patch #3829 (project freeciv):

Ah, good point.  Perhaps rather than adding roads to the integrators list at
parse time, it ought just set the bitvector (redundantly setting it causes no
issue, and checking that it is set likely usually wastes cycles).  Once the
iterates bitvector is set, a list can be constructed from it, sorted by cost
(lowest to highest), and stored as integrators.

Having a separate chunk of code specifically setting integrators should also
make the entirety more readable, so that this confusion doesn't arise again
(as both of us read it as wrong last week, the current code is clearly
suboptimal).

I don't think it is safe to terminate the tile_move_cost_ptrs() loop once a
road is found, because we can't know that it hasn't hit the RMM_RELAXED
condition, but the cost of iterating through the remainder should be low,
because we check (cost > iroad->move_cost) early enough that the remainder of
the iteration should go quickly.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3829>

_______________________________________________
  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