18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 00:22:42 +01:00
Commit Graph

2 Commits

Author SHA1 Message Date
pawelw 1a12c7ef4f fix(events): say in the log when a condition passes because it can't test, and when a call is dropped (#448)
* fix(events): say in the log when a condition passes because it can't test, and when a call is dropped

A condition which can't do its test passes, and nothing told the scenery
author. Now the log says so when the scenery loads:

- trackfree / trackoccupied with no target, or with a target that isn't a
  track (an isolated section, a memory cell): the track test passes every
  time;
- a word in a condition the reader doesn't know, such as a name written
  after trackfree: it's skipped;
- a multiple comparing a memory cell that doesn't exist: besides the cell
  (already logged), that its whole memcompare condition is off and it
  always runs the events before its else.

And log.txt says when an event called while it's still in the queue isn't
added again, with the vehicle of the lost call and of the queued one.

Nothing changes in how events run.

* fix(events): log a lost call once per stay in the queue, set the activator of a joint event

A standing vehicle queues its event0 / eventall0 every frame, so an event
with a delay logged "EVENT ALREADY IN QUEUE" once a frame until it ran
(65 thousand lines in 70 s of a train standing on such a track). Now a lost
call is logged only when it comes from another vehicle than the one which
queued the event, and once per stay in the queue.

An instant event handing over to its joint (same-name) event queued that
event with the vehicle of its previous run. It gets the vehicle of the
call now, which it runs with and which the log names.

The message about a missing memory cell says that only the memcompare test
is off, and that the event always runs the events before its else only when
no track or probability test is left.

* fix(events): don't log a lost call from another vehicle of the same train

A standing train calls its eventall0 from every vehicle, so the second
vehicle's call was logged once per stay in the queue, and as the line is
written once per stay, it could hide a lost call of another train standing
on another track with the same event. A call from a vehicle coupled to the
one which queued the event isn't logged now.

* test(events): the unknown word in a condition is logged with the event and skipped

A name written after trackfree is read as a word the condition reader
doesn't know: one line in the log names the event and the word, and only
the track test is set. The known words of a condition log nothing.

* test(events): turn the log capture off when a case stops at a failed REQUIRE
2026-11-27 23:51:42 +01:00
jerrrrycho be28108b91 fix(events): write memcompareex conditions back in the order they are read (#498)
The editor wrote a memory cell comparison as memcompareex <text> <op>
<value1> <op> <value2> <op>, without the pass word and with each value
before its operator. The parser and the sceneries use memcompareex
<pass> <op> <text> <op> <value1> <op> <value2>. A saved scenery read its
conditions shifted by one token, and the last value took the next word
of the event.

The writer now puts out the pass and the operator before each value.
The >= operator was written as >; it is written as >= now.

The text side of the conditions moves unchanged to the core file
world/eventconditions.cpp, so a unit test can check that what is
written reads back the same.
2026-11-25 05:41:50 +01:00