The International Simutrans Forum

 

Author Topic: Bad line of code in simhalt.cc  (Read 169 times)

0 Members and 1 Guest are viewing this topic.

Offline ACarlotti

  • *
  • Posts: 451
Bad line of code in simhalt.cc
« on: June 21, 2019, 11:34:26 PM »
So this line of code (simhalt.cc:1511 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 gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18619
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bad line of code in simhalt.cc
« 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.