17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-07 08:48:01 +01:00

pch migration to modules [wip]

This commit is contained in:
maj00r
2026-09-09 20:35:26 +02:00
parent c3007e3237
commit 3f7960aad5
350 changed files with 5958 additions and 3059 deletions

View File

@@ -1,3 +1,8 @@
module;
#include <string>
module eu07.simcore;
import eu07.utilities.parser;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,11 +12,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/AirCoupler.h"
#include "model/Model3d.h"
#include "utilities/parser.h"
AirCoupler::AirCoupler()
{

View File

@@ -6,10 +6,17 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <string>
export module eu07.simcore:aircoupler;
import :fwd;
import eu07.utilities.parser;
import eu07.utilities.classes;
export {
#pragma once
#include "utilities/Classes.h"
class AirCoupler
{
@@ -78,3 +85,5 @@ public:
};
};
} // export

View File

@@ -1,3 +1,15 @@
module;
#include <array>
#include <limits>
#include <string>
#include "vehicle/DynObj_macros.h"
module eu07.simcore;
import eu07.utilities.parser;
import eu07.simulation.simulation;
import eu07.console;
import eu07.utilities.logs;
import eu07.rendering.renderer;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,14 +19,6 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/Button.h"
#include "utilities/parser.h"
#include "model/Model3d.h"
#include "vehicle/DynObj.h"
#include "Console.h"
#include "utilities/Logs.h"
#include "rendering/renderer.h"
void TButton::Clear(int i)
{

View File

@@ -7,12 +7,21 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "utilities/Classes.h"
#include "audio/sound.h"
// animacja dwustanowa, włącza jeden z dwóch submodeli (jednego z nich może nie być)
module;
#include <cstdint>
#include <string>
export module eu07.simcore:button;
import :fwd;
import eu07.utilities.parser;
import eu07.glm;
import eu07.utilities.classes;
import eu07.audio.sound;
export {
class TButton {
public:
@@ -59,3 +68,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,19 @@
module;
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include "utilities/Globals_macros.h"
#include "utilities/utilities_macros.h"
#include "vehicle/DynObj_macros.h"
#include "McZapkie/MOVER_macros.h"
module eu07.vehicle.camera;
import eu07.utilities.globals;
import eu07.utilities.utilities;
import eu07.utilities.glmhelpers;
import eu07.utilities.timer;
import eu07.simcore;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -7,17 +23,7 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/Camera.h"
#include "utilities/Globals.h"
#include "utilities/utilities.h"
#include "utilities/glmHelpers.h"
#include "Console.h"
#include "utilities/Timer.h"
#include "vehicle/Driver.h"
#include "vehicle/DynObj.h"
#include "MOVER.h"
//---------------------------------------------------------------------------

View File

@@ -7,12 +7,17 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "input/command.h"
#include "vehicle/DynObj.h"
//---------------------------------------------------------------------------
module;
#include "vehicle/DynObj_macros.h"
export module eu07.vehicle.camera;
import eu07.glm;
import eu07.input.command;
import eu07.simcore;
export {
class TCamera {
@@ -46,3 +51,5 @@ struct viewport_proj_config {
glm::vec3 pc; // screen upper left corner
glm::vec3 pe; // eye position
};
} // export

View File

@@ -1,3 +1,33 @@
module;
#include <sys/stat.h>
#include <cstdint>
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <iomanip>
#include <ios>
#include <limits>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <vector>
#include "utilities/Globals_macros.h"
#include "utilities/translation_macros.h"
#include "vehicle/DynObj_macros.h"
module eu07.simcore;
import eu07.utilities.translation;
import eu07.simulation.simulation;
import eu07.world.station;
import :evlaunch;
import eu07.utilities.utilities;
import eu07.utilities.globals;
import eu07.world.mtable;
import eu07.simulation.simulationtime;
using namespace Mtable;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -12,22 +42,7 @@ http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/Driver.h"
#include "utilities/Globals.h"
#include "utilities/translation.h"
#include "utilities/Logs.h"
#include "vehicle/Train.h"
#include "world/mtable.h"
#include "vehicle/DynObj.h"
#include "world/Event.h"
#include "world/MemCell.h"
#include "simulation/simulation.h"
#include "simulation/simulationtime.h"
#include "world/Track.h"
#include "world/station.h"
#include "input/keyboardinput.h"
#define LOGVELOCITY 0
#define LOGORDERS 1
@@ -1865,7 +1880,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
// if (TrainParams)
// asNextStop=TrainParams.NextStop();
// else
TrainParams = TTrainParameters("none"); // rozkład jazdy
TrainParams = Mtable::TTrainParameters("none"); // rozkład jazdy
// OrderCommand="";
// OrderValue=0;
OrdersClear();
@@ -4421,7 +4436,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
#if LOGSTOPS
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
#endif
TrainParams = TTrainParameters(NewCommand); // rozkład jazdy
TrainParams = Mtable::TTrainParameters(NewCommand); // rozkład jazdy
tsGuardSignal = sound_source { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // wywalenie kierownika
m_lastexchangestop.clear();
if (NewCommand != "none")

View File

@@ -6,18 +6,30 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
module;
#include <functional>
#include <list>
#include <optional>
#include <vector>
#include <string>
#include "utilities/Classes.h"
#include "utilities/utilities.h"
#include "MOVER.h"
#include "audio/sound.h"
#include "vehicle/DynObj.h"
#include "world/mtable.h"
#include "utilities/translation.h"
#include "application/driverhints.h"
#include "utilities/utilities_macros.h"
#include "McZapkie/MOVER_macros.h"
#include "vehicle/DynObj_macros.h"
#include "utilities/translation_macros.h"
export module eu07.simcore:driver;
import :fwd;
import :dynobj;
import eu07.glm;
import :mover;
import eu07.application.driverhints;
import eu07.audio.sound;
import eu07.utilities.classes;
import eu07.utilities.utilities;
import eu07.world.mtable;
export {
auto const EU07_AI_ACCELERATION = 0.05;
auto const EU07_AI_NOACCELERATION = -0.05;
@@ -184,29 +196,24 @@ class TSpeedPos
};
//----------------------------------------------------------------------------
static const bool Aggressive = true;
static const bool Easyman = false;
static const bool AIdriver = true;
static const bool Humandriver = false;
static const int maxorders = 64; // ilość rozkazów w tabelce
static const int maxdriverfails = 4; // ile błędów może zrobić AI zanim zmieni nastawienie
inline const bool Aggressive = true;
inline const bool Easyman = false;
inline const bool AIdriver = true;
inline const bool Humandriver = false;
inline const int maxorders = 64; // ilość rozkazów w tabelce
inline const int maxdriverfails = 4; // ile błędów może zrobić AI zanim zmieni nastawienie
extern bool WriteLogFlag; // logowanie parametrów fizycznych
static const int BrakeAccTableSize = 20;
inline const int BrakeAccTableSize = 20;
static const int gbh_NP = -2; //odciecie w hamulcu ogolnym
static const int gbh_RP = 0; //jazda w hamulcu ogolnym
static const int gbh_FS = -1; //napelnianie uderzeniowe w hamulcu ogolnym
static const int gbh_MIN = -2; //minimalna pozycja w hamulcu ogolnym
static const int gbh_MAX = 6; //maksymalna pozycja w hamulcu ogolnym
inline const int gbh_NP = -2; //odciecie w hamulcu ogolnym
inline const int gbh_RP = 0; //jazda w hamulcu ogolnym
inline const int gbh_FS = -1; //napelnianie uderzeniowe w hamulcu ogolnym
inline const int gbh_MIN = -2; //minimalna pozycja w hamulcu ogolnym
inline const int gbh_MAX = 6; //maksymalna pozycja w hamulcu ogolnym
//----------------------------------------------------------------------------
class TController {
// TBD: few authorized inspectors, or bunch of public getters?
friend class TTrain;
friend class drivingaid_panel;
friend class timetable_panel;
friend class scenario_panel;
friend class debug_panel;
friend class whois_event;
public:
@@ -297,16 +304,11 @@ private:
void DirectionForward( bool forward );
void ZeroDirection();
int OrderDirectionChange( int newdir, TMoverParameters *Vehicle );
void sync_consist_reversers();
void Lights( int head, int rear );
std::string StopReasonText() const;
double BrakeAccFactor() const;
// modifies brake distance for low target speeds, to ease braking rate in such situations
float
braking_distance_multiplier( float const Targetvelocity ) const;
inline
int DrivigFlags() const {
return iDrivigFlags; };
inline
double DirectionalVel() const {
return mvOccupied->Vel * sign( iDirection * mvOccupied->V ); }
@@ -376,30 +378,16 @@ public:
double fMedAmax = 0.8; //maximum decceleration when using ep/med brake
private:
bool Psyche = false;
int HelperState = 0; //stan pomocnika maszynisty
TDynamicObject *pVehicle = nullptr; // pojazd w którym siedzi sterujący
TMoverParameters *mvControlling = nullptr; // jakim pojazdem steruje (może silnikowym w EZT)
TMoverParameters *mvOccupied = nullptr; // jakim pojazdem hamuje
TMoverParameters *mvPantographUnit = nullptr; //pantograph equipped vehicle in the occupied/controlled set
std::string VehicleName;
std::array<int, 2> m_lighthints = { -1, -1 }; // suggested light patterns
double AccPreferred = 0.0; // preferowane przyspieszenie (wg psychiki kierującego, zmniejszana przy wykryciu kolizji)
double AccDesired = 0.0; // przyspieszenie, jakie ma utrzymywać (<0:nie przyspieszaj,<-0.1:hamuj)
double VelDesired = 0.0; // predkość, z jaką ma jechać, wynikająca z analizy tableki; <=VelSignal
double fAccDesiredAv = 0.0; // uśrednione przyspieszenie z kolejnych przebłysków świadomości, żeby ograniczyć migotanie
double VelforDriver = -1.0; // prędkość, używana przy zmianie kierunku (ograniczenie przy nieznajmości szlaku?)
double VelSignal = 0.0; // ograniczenie prędkości z kompilacji znaków i sygnałów // normalnie na początku ma stać, no chyba że jedzie
double VelLimit = -1.0; // predkość zadawana przez event jednokierunkowego ograniczenia prędkości // -1: brak ograniczenia prędkości
double VelSignalLast = -1.0; // prędkość zadana na ostatnim semaforze // ostatni semafor też bez ograniczenia
double VelSignalNext = 0.0; // prędkość zadana na następnym semaforze
double VelLimitLast = -1.0; // prędkość zadana przez ograniczenie // ostatnie ograniczenie bez ograniczenia
double VelRoad = -1.0; // aktualna prędkość drogowa (ze znaku W27) (PutValues albo komendą) // prędkość drogowa bez ograniczenia
double VelNext = 120.0; // prędkość, jaka ma być po przejechaniu długości ProximityDist
double VelRestricted = -1.0; // speed of travel after passing a permissive signal at stop
double FirstSemaphorDist = 10000.0; // odległość do pierwszego znalezionego semafora
double ActualProximityDist = 1.0; // odległość brana pod uwagę przy wyliczaniu prędkości i przyspieszenia
std::pair<double, double> VelLimitLastDist { 0.0, 0.0 }; // distance to velocity change point
double SwitchClearDist { 0.0 }; // distance to point after farthest detected switch
int iDirection = 0; // kierunek jazdy względem sprzęgów pojazdu, w którym siedzi AI (1=przód,-1=tył)
int iDirectionOrder = 0; //żadany kierunek jazdy (służy do zmiany kierunku)
std::optional<int> iDirectionBackup; // consist direction to be restored after coupling/uncoupling and similar direction-changing operations
@@ -411,7 +399,6 @@ private:
// bool Need_BrakeRelease = true;
bool IsHeatingTemperatureOK{ true };
bool IsHeatingTemperatureTooLow{ false };
bool IsAtPassengerStop{ false }; // true if the consist is within acceptable range of w4 post
bool IsScheduledPassengerStopVisible{ false };
double fMinProximityDist = 30.0; // stawanie między 30 a 60 m przed przeszkodą // minimalna oległość do przeszkody, jaką należy zachować
double fOverhead1 = 3000.0; // informacja o napięciu w sieci trakcyjnej (0=brak drutu, zatrzymaj!)
@@ -425,9 +412,6 @@ private:
double WaitingTime = 0.0; // zliczany czas oczekiwania do samoistnego ruszenia
double WaitingExpireTime = 31.0; // tyle ma czekać, zanim się ruszy // maksymlany czas oczekiwania do samoistnego ruszenia
double IdleTime{}; // keeps track of time spent at a stop
double fStopTime = 0.0; // czas postoju przed dalszą jazdą (np. na przystanku)
float ExchangeTime{ 0.0 }; // time needed to finish current load exchange
double fShuntVelocity = 40.0; // prędkość manewrowania, zależy m.in. od składu
int iDrivigFlags = // flagi bitowe ruchu
moveStopPoint | // podjedź do W4 możliwie blisko
moveStopHere | // nie podjeżdżaj do semafora, jeśli droga nie jest wolna
@@ -435,16 +419,11 @@ private:
double fDriverBraking = 0.0; // po pomnożeniu przez v^2 [km/h] daje ~drogę hamowania [m]
double fDriverDist = 0.0; // dopuszczalna odległość podjechania do przeszkody
double fVelMax = -1.0; // maksymalna prędkość składu (sprawdzany każdy pojazd)
double fBrakeDist = 0.0; // przybliżona droga hamowania
double fBrakeReaction = 1.0; //opóźnienie zadziałania hamulca - czas w s / (km/h)
double fNominalAccThreshold = 0.0; // nominalny próg opóźnienia dla zadziałania hamulca
double fAccThreshold = 0.0; // aktualny próg opóźnienia dla zadziałania hamulca
double AbsAccS = 0.0; // próg opóźnienia dla zadziałania hamulca
// dla fBrake_aX:
// indeks [0] - wartości odpowiednie dla aktualnej prędkości
// a potem jest 20 wartości dla różnych prędkości zmieniających się co 5 % Vmax pojazdu obsadzonego
double fBrake_a0[ BrakeAccTableSize + 1 ] = { 0.0 }; // opóźnienia hamowania przy ustawieniu zaworu maszynisty w pozycji 1.0
double fBrake_a1[ BrakeAccTableSize + 1 ] = { 0.0 }; // przyrost opóźnienia hamowania po przestawieniu zaworu maszynisty o 0,25 pozycji
double BrakingInitialLevel{ 1.0 };
double BrakingLevelIncrease{ 0.25 };
double ReactionTime = 0.0; // czas reakcji Ra: czego i na co? świadomości AI
@@ -452,19 +431,13 @@ private:
double BrakeChargingCooldown{}; // prevents the ai from trying to charge the train brake too frequently
TBrakeSystem BrakeSystem = TBrakeSystem::Individual; //type of main brake
bool ForcePNBrake = false; //is it necessary to use PN brake instead of EP brake
int DynamicBrakeTest = 0; //is it necessary to make brake test while driving
double DBT_VelocityBrake = 0;
double DBT_VelocityRelease = 0;
double DBT_VelocityFinish = 0;
double DBT_BrakingTime = 0;
double DBT_ReleasingTime = 0;
double DBT_MidPointAcc = 0;
int StaticBrakeTest = 0; //is it necessary to make brake test while standing
double LastReactionTime = 0.0;
double fActionTime = 0.0; // czas używany przy regulacji prędkości i zamykaniu drzwi
double m_radiocontroltime{ 0.0 }; // timer used to control speed of radio operations
TAction eAction{ TAction::actUnknown }; // aktualny stan
std::list< std::tuple<driver_hint, hintpredicate, float> > m_hints; // queued ai operations
// orders
// methods
@@ -481,19 +454,16 @@ private:
void JumpToFirstOrder();
void OrderPush( TOrders NewOrder );
void OrderNext( TOrders NewOrder );
inline TOrders OrderCurrentGet() const;
inline TOrders OrderNextGet() const;
void OrderCheck();
void OrdersInit( double fVel );
void OrdersClear();
void OrdersDump( std::string const Neworder, bool const Verbose = true );
std::string Order2Str( TOrders Order ) const;
// members
std::string m_assignment;
glm::dvec3 vCommandLocation; // polozenie wskaznika, sygnalizatora lub innego obiektu do ktorego odnosi sie komenda // NOTE: not used
TOrders OrderList[ maxorders ]; // lista rozkazów
int OrderPos = 0,
OrderTop = 0; // rozkaz aktualny oraz wolne miejsce do wstawiania nowych
int OrderTop = 0; // wolne miejsce do wstawiania nowych
// scantable
// methods
@@ -513,7 +483,6 @@ private:
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double const Signaldistance );
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int const Pointindex );
// returns most recently calculated distance to potential obstacle ahead
double TrackObstacle() const;
void TablePurger();
void TableSort();
inline double MoveDistanceGet() const {
@@ -522,7 +491,6 @@ private:
inline void MoveDistanceReset() {
dMoveLen = 0.0;
}
std::size_t TableSize() const { return sSpeedTable.size(); }
void TableClear();
int TableDirection() { return iTableDirection; }
// Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
@@ -531,7 +499,6 @@ private:
TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int const Eventdirection = 1, end const End = end::rear, bool const Untiloccupied = true );
void SetProximityVelocity( double dist, double vel, glm::dvec3 const *pos );
TCommandType BackwardScan( double const Range );
std::string TableText( std::size_t const Index ) const;
/*
void RouteSwitch(int d);
*/
@@ -545,8 +512,6 @@ private:
std::size_t SemNextIndex{ std::size_t( -1 ) };
std::size_t SemNextStopIndex{ std::size_t( -1 ) };
double dMoveLen = 0.0; // odległość przejechana od ostatniego sprawdzenia tabelki
basic_event *eSignNext = nullptr; // sygnał zmieniający prędkość, do pokazania na [F2]
neighbour_data Obstacle; // nearest vehicle detected ahead on current route
// timetable
// methods
@@ -554,22 +519,18 @@ public:
const std::string &TrainName() const;
Mtable::TTrainParameters const & TrainTimetable() const;
private:
std::string Relation() const;
int StationIndex() const;
int StationCount() const;
bool IsStop() const;
std::string NextStop() const;
// tests whether the train is delayed and sets accordingly a driving flag
void UpdateDelayFlag();
// members
Mtable::TTrainParameters TrainParams; // rozkład jazdy zawsze jest, nawet jeśli pusty
std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu
// int iStationStart = 0; // numer pierwszej stacji pokazywanej na podglądzie rozkładu
std::string m_lastexchangestop; // HACK: safeguard to prevent multiple load exchanges per station
int m_lastexchangeplatforms { 0 }; // cached station platforms for last exchange
int m_lastexchangedirection { 0 }; //
double fLastStopExpDist = -1.0; // odległość wygasania ostateniego przystanku
int iRadioChannel = 1; // numer aktualnego kanału radiowego
int iGuardRadio = 0; // numer kanału radiowego kierownika (0, gdy nie używa radia)
sound_source tsGuardSignal{ sound_placement::internal };
announcement_t m_lastannouncement{ announcement_t::idle };
@@ -589,30 +550,16 @@ private:
void AutoRewident(); // ustawia hamulce w składzie
void announce( announcement_t const Announcement );
// members
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
double fAccGravity = 0.0; // przyspieszenie składowej stycznej grawitacji
int iVehicles = 0; // ilość pojazdów w składzie
int ControlledEnginesCount{ 0 }; // number of powered vehicles under driver's control
bool iEngineActive{ false }; // ABu: Czy silnik byl juz zalaczony
bool IsPassengerTrain{ false };
bool IsCargoTrain{ false };
bool IsHeavyCargoTrain{ false };
double fReady = 0.0; // poziom odhamowania wagonów
bool Ready = false; // ABu: stan gotowosci do odjazdu - sprawdzenie odhamowania wagonow
bool IsConsistBraked { false };
double ConsistShade{ 1.0 }; // averaged amount of sunlight received by the consist
TDynamicObject *pVehicles[ 2 ]; // skrajne pojazdy w składzie (niekoniecznie bezpośrednio sterowane)
bool DoesAnyDoorNeedOpening{ false };
bool IsAnyDoorOpen[ 2 ]; // state of door in the consist
bool IsAnyDoorOnlyOpen[ 2 ]; // state of door in the consist regardless of step
bool IsAnyDoorPermitActive[ 2 ]; // state of door permit in the consist
bool IsAnyLineBreakerOpen{ false }; // state of line breaker in all powered vehicles under control
bool IsAnyConverterOverloadRelayOpen{ false }; // state of converter overload relays in all vehicles under control
bool IsAnyMotorOverloadRelayOpen{ false }; // state of motor overload relays in all vehicles under control
bool IsAnyGroundRelayOpen{ false };
bool IsAnyCompressorPresent { false };
bool IsAnyCompressorEnabled{ false };
bool IsAnyCompressorExplicitlyEnabled{ false }; // only takes into account manually controlled devices
bool IsAnyConverterPresent{ false };
bool IsAnyConverterEnabled{ false };
@@ -635,13 +582,81 @@ public:
TDynamicObject *Vehicle( end const Side ) const {
return pVehicles[ Side ]; }
private:
std::string OwnerName() const;
// leftovers
/*
int iRouteWanted = 3; // oczekiwany kierunek jazdy (0-stop,1-lewo,2-prawo,3-prosto) np. odpala migacz lub czeka na stan zwrotnicy
*/
public:
// Formerly private, reached through friendship by TTrain and the ui panels.
// Those live in other modules, and a friend declaration would make TController
// the first declarer of a class defined elsewhere, which C++20 modules reject.
// The class TODO above ("few authorized inspectors, or bunch of public getters?")
// is still open; until it is answered these are plain public members.
void sync_consist_reversers();
float ExchangeTime{ 0.0 }; // time needed to finish current load exchange
std::list< std::tuple<driver_hint, hintpredicate, float> > m_hints; // queued ai operations
double TrackObstacle() const;
double fShuntVelocity = 40.0; // prędkość manewrowania, zależy m.in. od składu
Mtable::TTrainParameters TrainParams; // rozkład jazdy zawsze jest, nawet jeśli pusty
TDynamicObject *pVehicle = nullptr; // pojazd w którym siedzi sterujący
double BrakeAccFactor() const;
int DrivigFlags() const { return iDrivigFlags; }
int HelperState = 0; //stan pomocnika maszynisty
TMoverParameters *mvControlling = nullptr; // jakim pojazdem steruje (może silnikowym w EZT)
double AccDesired = 0.0; // przyspieszenie, jakie ma utrzymywać (<0:nie przyspieszaj,<-0.1:hamuj)
double VelDesired = 0.0; // predkość, z jaką ma jechać, wynikająca z analizy tableki; <=VelSignal
double VelSignalLast = -1.0; // prędkość zadana na ostatnim semaforze // ostatni semafor też bez ograniczenia
double VelSignalNext = 0.0; // prędkość zadana na następnym semaforze
double VelLimitLast = -1.0; // prędkość zadana przez ograniczenie // ostatnie ograniczenie bez ograniczenia
double VelRoad = -1.0; // aktualna prędkość drogowa (ze znaku W27) (PutValues albo komendą) // prędkość drogowa bez ograniczenia
double VelNext = 120.0; // prędkość, jaka ma być po przejechaniu długości ProximityDist
double VelRestricted = -1.0; // speed of travel after passing a permissive signal at stop
double ActualProximityDist = 1.0; // odległość brana pod uwagę przy wyliczaniu prędkości i przyspieszenia
std::pair<double, double> VelLimitLastDist { 0.0, 0.0 }; // distance to velocity change point
double SwitchClearDist { 0.0 }; // distance to point after farthest detected switch
bool IsAtPassengerStop{ false }; // true if the consist is within acceptable range of w4 post
double fStopTime = 0.0; // czas postoju przed dalszą jazdą (np. na przystanku)
double fBrakeDist = 0.0; // przybliżona droga hamowania
double fAccThreshold = 0.0; // aktualny próg opóźnienia dla zadziałania hamulca
double AbsAccS = 0.0; // próg opóźnienia dla zadziałania hamulca
double fBrake_a0[ BrakeAccTableSize + 1 ] = { 0.0 }; // opóźnienia hamowania przy ustawieniu zaworu maszynisty w pozycji 1.0
double fBrake_a1[ BrakeAccTableSize + 1 ] = { 0.0 }; // przyrost opóźnienia hamowania po przestawieniu zaworu maszynisty o 0,25 pozycji
int DynamicBrakeTest = 0; //is it necessary to make brake test while driving
double DBT_VelocityBrake = 0;
double DBT_VelocityRelease = 0;
double DBT_VelocityFinish = 0;
double fActionTime = 0.0; // czas używany przy regulacji prędkości i zamykaniu drzwi
inline TOrders OrderCurrentGet() const;
std::string Order2Str( TOrders Order ) const;
int OrderPos = 0; // rozkaz aktualny
std::size_t TableSize() const { return sSpeedTable.size(); }
std::string TableText( std::size_t const Index ) const;
basic_event *eSignNext = nullptr; // sygnał zmieniający prędkość, do pokazania na [F2]
neighbour_data Obstacle; // nearest vehicle detected ahead on current route
int iRadioChannel = 1; // numer aktualnego kanału radiowego
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
double fAccGravity = 0.0; // przyspieszenie składowej stycznej grawitacji
double fReady = 0.0; // poziom odhamowania wagonów
bool Ready = false; // ABu: stan gotowosci do odjazdu - sprawdzenie odhamowania wagonow
bool IsAnyDoorOpen[ 2 ]; // state of door in the consist
bool IsAnyDoorOnlyOpen[ 2 ]; // state of door in the consist regardless of step
bool IsAnyDoorPermitActive[ 2 ]; // state of door permit in the consist
bool IsAnyConverterOverloadRelayOpen{ false }; // state of converter overload relays in all vehicles under control
bool IsAnyCompressorEnabled{ false };
public:
// Read by the ui panels, which are no longer friends: a friend declaration
// would make this module the first declarer of a class defined elsewhere,
// which C++20 modules reject.
std::string Relation() const;
std::string NextStop() const;
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
int iVehicles = 0; // ilość pojazdów w składzie
int ControlledEnginesCount{ 0 }; // number of powered vehicles under driver's control
bool iEngineActive{ false }; // ABu: Czy silnik byl juz zalaczony
bool IsPassengerTrain{ false };
std::string OwnerName() const;
};
inline TOrders TController::OrderCurrentGet() const {
@@ -651,3 +666,5 @@ inline TOrders TController::OrderCurrentGet() const {
inline TOrders TController::OrderNextGet() const {
return OrderList[ OrderPos + 1 ];
}
} // export

View File

@@ -1,4 +1,29 @@
/*
module;
#include <functional>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <memory>
#include <string>
#include <vector>
#include "global_include/interfaces/ITexture_macros.h"
#include "vehicle/DynObj_macros.h"
#include "utilities/Globals_macros.h"
module eu07.simcore;
import eu07.input.messaging;
import eu07.rendering.renderer;
import eu07.utilities.globals;
import eu07.simulation.simulation;
import eu07.model.mdlmngr;
import eu07.glm;
import eu07.rendering.lightarray;
import eu07.vehicle.camera;
import eu07.vehicle.train;
import eu07.utilities.timer;
import eu07.utilities.glmhelpers;
import eu07.application.uitranscripts;
/*
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
@@ -12,27 +37,7 @@ http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/DynObj.h"
#include "simulation/simulation.h"
#include "rendering/lightarray.h"
#include "vehicle/Camera.h"
#include "vehicle/Train.h"
#include "vehicle/Driver.h"
#include "utilities/Globals.h"
#include "utilities/Timer.h"
#include "utilities/Logs.h"
#include "utilities/glmHelpers.h"
#include "Console.h"
#include "world/Traction.h"
#include "audio/sound.h"
#include "model/MdlMngr.h"
#include "model/Model3d.h"
#include "rendering/renderer.h"
#include "application/uitranscripts.h"
#include "input/messaging.h"
#include "vehicle/Driver.h"
// Ra: taki zapis funkcjonuje lepiej, ale może nie jest optymalny
#define vWorldFront glm::vec3(0, 0, 1)

View File

@@ -7,28 +7,41 @@ obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
module;
#include <deque>
#include <optional>
#include "vehicle/DynObj_macros.h"
#include <string>
#include <functional>
#include "utilities/Classes.h"
#include "interfaces/IMaterial.h"
#include "MOVER.h"
#include "world/TrkFoll.h"
#include "vehicle/Button.h"
#include "vehicle/AirCoupler.h"
#include "interfaces/ITexture.h"
#include "audio/sound.h"
#include "world/Spring.h"
#include "McZapkie/MOVER_macros.h"
#include "global_include/interfaces/ITexture_macros.h"
#include <vector>
#include <fstream>
#define EU07_SOUND_BOGIESOUNDS
export module eu07.simcore:dynobj;
import :fwd;
import :aircoupler;
import :button;
import :trkfoll;
import :mover;
import eu07.audio.sound;
import eu07.utilities.parser;
import :traction;
import eu07.glm;
import eu07.utilities.classes;
import eu07.global_include.interfaces.imaterial;
import eu07.global_include.interfaces.itexture;
import eu07.world.spring;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
export {
int const ANIM_WHEELS = 0; // koła
int const ANIM_DOORS = 1; // drzwi
int const ANIM_LEVERS = 2; // elementy obracane (wycieraczki, koła skrętne, przestawiacze, klocki ham.)
@@ -187,10 +200,6 @@ struct material_data {
};
class TDynamicObject { // klasa pojazdu
friend opengl_renderer;
friend opengl33_renderer;
public:
static bool bDynamicRemove; // moved from ground
@@ -883,6 +892,8 @@ private:
};
} // export -- out-of-line member definitions are not namespace-scope
// declarations, so they cannot carry `export`; the class itself is exported.
template <typename Predicate_>
auto
TDynamicObject::find_vehicle( coupling const Coupling, Predicate_ const Predicate ) -> TDynamicObject * {
@@ -917,5 +928,8 @@ TDynamicObject::for_each( coupling const Coupling, UnaryFunction_ const Function
while( ( vehicle = vehicle->Prev( Coupling ) ) != nullptr ) {
Function( vehicle ); }
}
export {
//---------------------------------------------------------------------------
} // export

8
vehicle/DynObj_macros.h Normal file
View File

@@ -0,0 +1,8 @@
#pragma once
// Macros cannot cross a module boundary, so they live in a plain header
// that consumers pull into their global module fragment. The bodies are
// expanded at the use site, where the imported names are in scope, so this
// header deliberately includes nothing.
#define EU07_SOUND_BOGIESOUNDS

View File

@@ -1,3 +1,23 @@
module;
#include <algorithm>
#include <array>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "vehicle/DynObj_macros.h"
module eu07.vehicle.gauge;
import eu07.utilities.float3d;
import eu07.widgets.map_objects;
import eu07.utilities.parser;
import eu07.simcore;
import eu07.utilities.timer;
import eu07.utilities.logs;
import eu07.rendering.renderer;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -13,14 +33,6 @@ http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/Gauge.h"
#include "utilities/parser.h"
#include "model/Model3d.h"
#include "vehicle/DynObj.h"
#include "utilities/Timer.h"
#include "utilities/Logs.h"
#include "rendering/renderer.h"
TGauge::TGauge( sound_source const &Soundtemplate ) :
m_soundtemplate( Soundtemplate )

View File

@@ -6,11 +6,20 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
module;
#include <map>
#include <optional>
export module eu07.vehicle.gauge;
import eu07.simcore;
import eu07.utilities.parser;
import eu07.glm;
import eu07.utilities.classes;
import eu07.audio.sound;
export {
#pragma once
#include "utilities/Classes.h"
#include "audio/sound.h"
enum class TGaugeAnimation {
// typ ruchu
@@ -116,3 +125,5 @@ private:
};
//---------------------------------------------------------------------------
} // export

View File

@@ -1,3 +1,36 @@
module;
#include <GLFW/glfw3.h>
#include <array>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "utilities/Globals_macros.h"
#include "vehicle/DynObj_macros.h"
#include <future>
#include <cmath>
#include <algorithm>
#include <future>
#include <algorithm>
module eu07.vehicle.train;
import eu07.global_include.interfaces.itexture;
import eu07.model.mdlmngr;
import eu07.rendering.renderer;
import eu07.utilities.logs;
import eu07.utilities.globals;
import eu07.simulation.simulation;
import eu07.application.application;
import eu07.utilities.utilities;
import eu07.mczapkie.hamulce;
import eu07.simcore;
import eu07.simulation.simulationtime;
import eu07.utilities.timer;
import eu07.world.mtable;
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
@@ -12,27 +45,7 @@ http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/Train.h"
#include "utilities/Globals.h"
#include "simulation/simulation.h"
#include "world/Event.h"
#include "simulation/simulationtime.h"
#include "vehicle/Camera.h"
#include "utilities/Logs.h"
#include "model/MdlMngr.h"
#include "model/Model3d.h"
#include "utilities/Timer.h"
#include "vehicle/Driver.h"
#include "vehicle/DynObj.h"
#include "world/mtable.h"
#include "Console.h"
#include "application/application.h"
#include "rendering/renderer.h"
#include <future>
#include <cmath>
#include <algorithm>
/*
namespace input {
@@ -12398,8 +12411,6 @@ uint16_t TTrain::id()
return vid;
}
#include <future>
#include <algorithm>
void train_table::updateAsync(double dt)
{

View File

@@ -6,19 +6,36 @@ distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
module;
#include "utilities/Globals_macros.h"
#include <cstdint>
#include <memory>
#include <array>
#include <functional>
#include <optional>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <string>
#include "vehicle/DynObj.h"
#include "vehicle/Driver.h"
#include "vehicle/Button.h"
#include "vehicle/Gauge.h"
#include "audio/sound.h"
#include "scripting/PyInt.h"
#include "input/command.h"
#include "scripting/pythonscreenviewer.h"
#include "utilities/dictionary.h"
#include "vehicle/DynObj_macros.h"
#include "scripting/PyInt_macros.h"
export module eu07.vehicle.train;
import eu07.utilities.globals;
import eu07.glm;
import eu07.utilities.parser;
import eu07.vehicle.gauge;
import eu07.simcore;
import eu07.scripting.pyint;
import eu07.scripting.pythonscreenviewer;
import eu07.utilities.dictionary;
import eu07.input.command;
import eu07.audio.sound;
import eu07.utilities.names;
export {
#undef snprintf // pyint.h->python
@@ -76,7 +93,6 @@ public:
class TTrain {
friend class drivingaid_panel;
public:
// types
@@ -859,11 +875,6 @@ public: // reszta może by?publiczna
// McZapkie: do poruszania sie po kabinie
glm::dvec3 pMechSittingPosition; // ABu 180404
glm::dvec3 MirrorPosition(bool lewe);
glm::dvec3 pMechOffset; // base position of the driver in the cab
glm::vec2 pMechViewAngle { 0.0, 0.0 }; // camera pitch and yaw values, preserved while in external view
private:
double fBlinkTimer;
float fHaslerTimer;
float fConverterTimer; // hunter-261211: dla przekaznika
float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem
@@ -943,6 +954,13 @@ private:
uint16_t id();
bool pending_delete = false;
public:
// Read by the ui panels, which are no longer friends: a friend declaration
// would make this module the first declarer of a class defined elsewhere,
// which C++20 modules reject.
glm::dvec3 pMechOffset; // base position of the driver in the cab
glm::vec2 pMechViewAngle { 0.0, 0.0 }; // camera pitch and yaw values, preserved while in external view
double fBlinkTimer;
};
class train_table : public basic_table<TTrain> {
@@ -953,3 +971,5 @@ public:
};
//---------------------------------------------------------------------------
} // export