mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-27 23:57:09 +01:00
The first row of a timetable, which usually gives only the departure time, became a stop only when its name matched the relation's first station case-sensitively. Os33733 of linia_107_poludnie.scn writes ZAGORZ in the rows and Zagorz in the relation, so its driver counted Zagorz as passed at the start, left before its departure time and the train manager never gave the departure signal. The names are now compared regardless of case (timetable::starts_at in the core library). Tests: unit test of the rule; td.scn scenario cases with a timetable of the case's own (first row STACJA1, and Stacja1 as control) and the td.scn train started with its head 80 m past the W4 of Stacja1; the scenario runner can copy a timetable of the case into the game for the run.
26 lines
738 B
C++
26 lines
738 B
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
#include "world/timetablestart.h"
|
|
|
|
#include <algorithm>
|
|
#include <cctype>
|
|
|
|
namespace timetable {
|
|
|
|
bool starts_at(std::string_view const Firststation, std::string_view const Relationfrom) {
|
|
// the station names are plain ascii by now, the timetable loader strips the polish letters
|
|
return std::ranges::equal(Firststation, Relationfrom, [](char const Left, char const Right) {
|
|
return std::tolower(static_cast<unsigned char>(Left)) == std::tolower(static_cast<unsigned char>(Right));
|
|
});
|
|
}
|
|
|
|
} // namespace timetable
|