The International Simutrans Forum


Author Topic: Bad line of code in  (Read 840 times)

0 Members and 1 Guest are viewing this topic.

Offline ACarlotti

  • *
  • Posts: 483
Bad line of code in
« on: June 21, 2019, 11:34:26 PM »
So this line of code ( approximately) is clearly incorrect - it is comparing a variable to itself. I suspect there may have been some confusion about order of precedence of operators. I don't know what was intended here - perhaps James can remember or work out his intentions here in 2017.
Code: [Select]
const uint32 max_iteration = average_waiting_time > average_waiting_time ? min(8, iter.value.month) : 1;
(I happened to notice gcc warning about this during repeated recompilations while I worked out how to indicate the correct data types elsewhere in the file.)

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19656
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bad line of code in
« Reply #1 on: June 22, 2019, 11:08:06 AM »
Splendid, thank you for spotting that. I have pushed a fix to set this to what I believe was intended, which was to check whether the average waiting times were higher than the estimated waiting times, and, if so, flush the stale times more aggressively to prevent temporary blockages causing high waiting times to linger for a long time.