The International Simutrans Forum

 

Author Topic: [r8811] roadsign_desc_t::is_simple_signal()  (Read 393 times)

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 340
  • Languages: JP,EN
[r8811] roadsign_desc_t::is_simple_signal()
« on: September 15, 2019, 12:18:37 PM »
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.

Offline danivenk

  • *
  • Posts: 96
  • Languages: EN, NL, JP
Re: [r8811] roadsign_desc_t::is_simple_signal()
« Reply #1 on: September 18, 2019, 02:01:21 PM »
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...

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 340
  • Languages: JP,EN
Re: [r8811] roadsign_desc_t::is_simple_signal()
« Reply #2 on: September 20, 2019, 12:18:33 PM »
Changing the following code of  descriptor/roadsign_desc.h
Code: [Select]
//  return true for signal
bool is_simple_signal() const { return (flags & (SIGN_SIGNAL|CHOOSE_SIGN)) == SIGN_SIGNAL; }
to
Code: [Select]
//  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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5593
  • Languages: EN, NO
Re: [r8811] roadsign_desc_t::is_simple_signal()
« Reply #3 on: September 20, 2019, 04:50:00 PM »
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9713
  • Languages: De,EN,JP
Re: [r8811] roadsign_desc_t::is_simple_signal()
« Reply #4 on: September 22, 2019, 01:26:13 PM »
Indeed, thank you. Changed in r8821.