17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-10 12:38:37 +01:00

feat(editor): a block signal template knows its aspects, 4 where its events give S3, the green light flashing with the next signal at S5, else 3; one step of the signalling takes includes away too, the signals among them with their read events, Ctrl+Z bringing them back with the rest of it

This commit is contained in:
maj00r
2026-10-22 19:26:25 +02:00
parent fc0b9b46e8
commit b92d1283ac
5 changed files with 50 additions and 2 deletions

View File

@@ -537,6 +537,25 @@ bool signal_speeds(std::string const &File, std::vector<int> &Speeds)
return true;
}
int block_aspects(std::string const &File)
{
template_text text;
std::string error;
if (false == read_template(File, text, error))
{
return 0;
}
auto const tokens{tokenize(text.content)};
for (std::size_t idx = 0; idx + 1 < tokens.size(); ++idx)
{
if (tokens[idx] == "event" && tokens[idx + 1].size() > 3 && tokens[idx + 1].ends_with("_s3"))
{
return 4;
}
}
return 3;
}
void suggest(std::string const &File, include_info &Info)
{
template_text text;