News:

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

[r8811] roadsign_desc_t::is_simple_signal()

Started by THLeaderH, September 15, 2019, 12:18:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

roadsign_desc_t::is_simple_signal(), which was introduced in r8804, has a defect.
Although this function must return whether the signal is "simple" signal, the function may return true for some longblock signals and priority signals because the function does not check the flags like SIGN_LONGBLOCK_SIGNAL. Due to this, I confirmed that the longblock signal of pak128 behaves as if it is a normal signal, and a Japanese player reported that some priority signals behave same.

danivenk

After some investigation I found that the bug begins to happen after some kind of signal fix in r8806, it all worked in r8803.
My conclusion of this is that the fix didn't totally worked...

THLeaderH

Changing the following code of  descriptor/roadsign_desc.h

//  return true for signal
bool is_simple_signal() const { return (flags & (SIGN_SIGNAL|CHOOSE_SIGN)) == SIGN_SIGNAL; }

to

//  return true for normal signal
bool is_simple_signal() const { return (flags & (SIGN_SIGNAL|CHOOSE_SIGN|SIGN_PRE_SIGNAL|SIGN_PRIORITY_SIGNAL|SIGN_LONGBLOCK_SIGNAL)) == SIGN_SIGNAL; }

should solve this problem.

Ters

That really calls for some form of mask constant to filter bits related to signal type from other flags.

However, it has always puzzled me why signal type is a set of bit flags. The only value looking like a flag is ONLY_BACKIMAGE, while the rest seem mutually exclusive.

prissi