News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Redundant code or possible error in simcity.cc

Started by jamespetts, December 17, 2017, 01:55:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

Looks like the second check should be

sum_industrial > sum_commercial

thanks for spotting
Parsley, sage, rosemary, and maggikraut.

jamespetts

Splendid, thank you. Now incorporated in Extended.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

Parsley, sage, rosemary, and maggikraut.