The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on December 17, 2017, 01:55:11 PM

Title: Redundant code or possible error in simcity.cc
Post by: jamespetts on December 17, 2017, 01:55:11 PM
Running a static analysis on Simutrans-Extended has revealed an error which also appears to be in Simutrans-Standard.

Line 2938 of simcity.cc is:


if (h == NULL  &&  sum_industrial > sum_residential  &&  sum_industrial > sum_residential) {


This simply repeats sum_industrial > sum_residential. Presumably, this was not intended, but it is not clear what was intended here.
Title: Re: Redundant code or possible error in simcity.cc
Post by: Dwachs on December 17, 2017, 10:13:18 PM
Looks like the second check should be

sum_industrial > sum_commercial

thanks for spotting
Title: Re: Redundant code or possible error in simcity.cc
Post by: jamespetts on December 17, 2017, 10:23:14 PM
Splendid, thank you. Now incorporated in Extended.
Title: Re: Redundant code or possible error in simcity.cc
Post by: Dwachs on December 19, 2017, 06:29:08 PM
in r8355