17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-09 11:22:25 +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

@@ -501,10 +501,9 @@ int parameter_count(std::string const &File)
return read_template(File, text, error) ? count_parameters(text) : 0;
}
bool signal_speeds(std::string const &File, std::vector<int> &Speeds, bool &Informs)
bool signal_speeds(std::string const &File, std::vector<int> &Speeds)
{
Speeds.clear();
Informs = false;
template_text text;
std::string error;
if (false == read_template(File, text, error))
@@ -522,23 +521,17 @@ bool signal_speeds(std::string const &File, std::vector<int> &Speeds, bool &Info
Speed = static_cast<int>(std::lround(value));
return true;
};
for (std::size_t idx = 0; idx + 2 < tokens.size(); ++idx)
for (std::size_t idx = 0; idx + 1 < tokens.size(); ++idx)
{
if (tokens[idx] != "setvelocity")
{
continue;
}
int own{0};
int next{0};
auto const shown{speed(tokens[idx + 1], own)};
if (shown && own != 0 && std::find(Speeds.begin(), Speeds.end(), own) == Speeds.end())
if (speed(tokens[idx + 1], own) && own != 0 && std::find(Speeds.begin(), Speeds.end(), own) == Speeds.end())
{
Speeds.push_back(own);
}
if (speed(tokens[idx + 2], next) && next == 0 && (tokens[idx + 1] == "*" || (shown && own != 0 && own != 20)))
{
Informs = true;
}
}
std::sort(Speeds.begin(), Speeds.end());
return true;