18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 04:47:06 +01:00

refactor(ai): the cab and the whois event are no longer friends of the AI, its public fields are private

TTrain and whois_event reached into the private members of TController as its
friends; they read what the AI knows of its consist and its route through
queries now (ConsistDoorsOpen(), ConsistConverterOverloaded(), ConsistLength(),
DesiredVelocity(), NextSignalVelocity(), BrakesReleaseLevel(), ...), and the cab
changes the radio channel through SetRadioChannel() rather than a reference to
the AI's field. The reversers of the consist, the stations of the timetable and
the obstacle ahead are public queries and operations.

The public fields of TController are private: whether the AI drives
(AIControllFlag()), the masks of the running without current the vehicles of
the consist set (MarkOverhead(), the same bits TDynamicObject::OverheadTrack()
set itself), the most deceleration of the blended brakes (MedAmax(),
SetMedAmax()), and the positions the driving aid panels show. Only the four
debug and timetable panels stay friends.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
2026-11-29 13:06:16 +01:00
parent 439adc2f46
commit 74f0aa240d
29 changed files with 251 additions and 220 deletions
+1 -1
View File
@@ -312,7 +312,7 @@ void state_manager::process_commands() {
targetvehicle->ctOwner == currentvehicle->Mechanik
|| targetvehicle->ctOwner == currentvehicle->ctOwner };
auto const isincharge{ currentvehicle->Mechanik->primary() };
auto const aidriveractive{ currentvehicle->Mechanik->AIControllFlag };
auto const aidriveractive{ currentvehicle->Mechanik->AIControllFlag() };
// TODO: support for primary mode request passed as commanddata.param1
if( !sameconsist && isincharge ) {
// oddajemy dotychczasowy AI