17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 21:39:03 +01:00

refactor(editor): a signal head tells the next one shows stop by its chambers alone, an orange light above the red one, not by the events of its template reading the next signal, which the templates of the old sceneries lack

This commit is contained in:
maj00r
2026-10-22 18:54:54 +02:00
parent a811486b53
commit 9c124b23bb
6 changed files with 11 additions and 19 deletions

View File

@@ -302,15 +302,16 @@ bool has_speed(std::vector<int> const &Speeds, int const Speed)
return std::find(Speeds.begin(), Speeds.end(), Speed) != Speeds.end();
}
// the template has the lights the need takes: a lower orange one for a lower speed, a strip for 60 and 100, Ie-1 § 7, two orange
// ones to show a lower speed with the next signal at stop
// the template has the lights the need takes, by its chambers: an orange one to tell the next signal shows stop, a lower orange one
// for a lower speed, a strip for 60 and 100 by the speeds its events set, Ie-1 § 7, two orange ones to show a lower speed with the
// next signal at stop
bool shows(signal_head const &Head, head_need const &Need)
{
auto const &lamps{Head.lamps};
auto const count = [&](char const Lamp) { return std::count(lamps.begin(), lamps.end(), Lamp); };
if (count('z') == 0 || count('c') == 0 || (Need.white && count('b') == 0))
return false;
if (Need.informs && (false == Head.informs || count('p') == 0))
if (Need.informs && count('p') == 0)
return false;
if (Need.speeds.empty())
return true;