The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ij on January 15, 2015, 09:02:48 PM

Title: Suspicious condition in dataobj/route.cc
Post by: ij on January 15, 2015, 09:02:48 PM
Is there perhaps bug close to the end of this line:

https://github.com/aburch/simutrans/blob/master/dataobj/route.cc#L663 (https://github.com/aburch/simutrans/blob/master/dataobj/route.cc#L663)

The use of doubled && instead of & in this subcondition looks extremely suspicious: ... &&  (fahr->get_ribi(gr)&&ribi)!=0  ) ...I guess it would be supposed to check if fahr->get_ribi(gr) has ribi bit set.

--
i.

Title: Re: Suspicious condition in dataobj/route.cc
Post by: Ters on January 15, 2015, 09:21:40 PM
Looks wrong to me as well. If it was supposed to be &&, I doubt there would be an != after. Although the != is unnecessary in C/C++, here it indeed strongly suggest flags checking.
Title: Re: Suspicious condition in dataobj/route.cc
Post by: prissi on January 26, 2015, 10:09:34 PM
Hmm this line is not 663. I assume this has been fixed?
Title: Re: Suspicious condition in dataobj/route.cc
Post by: Ters on January 27, 2015, 05:49:07 AM
Yes, revision 7487.