mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Train number of train entering isolation in WM_COPYDATA
This commit is contained in:
@@ -310,6 +310,11 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
Parser.getTokens(1, false);
|
||||
Parser >> iMultiplayer;
|
||||
}
|
||||
else if (token == "isolatedtrainnumber")
|
||||
{
|
||||
Parser.getTokens(1, false);
|
||||
Parser >> bIsolatedTrainName;
|
||||
}
|
||||
else if (token == "maxtexturesize")
|
||||
{
|
||||
// wymuszenie przeskalowania tekstur
|
||||
@@ -1102,6 +1107,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
|
||||
export_as_text( Output, "feedbackmode", iFeedbackMode );
|
||||
export_as_text( Output, "feedbackport", iFeedbackPort );
|
||||
export_as_text( Output, "multiplayer", iMultiplayer );
|
||||
export_as_text( Output, "isolatedtrainnumber", bIsolatedTrainName);
|
||||
export_as_text( Output, "maxtexturesize", iMaxTextureSize );
|
||||
export_as_text( Output, "maxcabtexturesize", iMaxCabTextureSize );
|
||||
export_as_text( Output, "movelight", fMoveLight );
|
||||
|
||||
@@ -196,6 +196,7 @@ struct global_settings {
|
||||
#endif
|
||||
// multiplayer
|
||||
int iMultiplayer{ 0 }; // blokada działania niektórych eventów na rzecz kominikacji
|
||||
bool bIsolatedTrainName{ false }; //wysyłanie zajęcia odcinka izolowanego z nazwą pociągu
|
||||
// other
|
||||
std::string AppName{ "EU07" };
|
||||
std::string asVersion{ "UNKNOWN" }; // z opisem
|
||||
|
||||
22
Track.cpp
22
Track.cpp
@@ -21,6 +21,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "MemCell.h"
|
||||
#include "messaging.h"
|
||||
#include "DynObj.h"
|
||||
#include "Driver.h"
|
||||
#include "AnimModel.h"
|
||||
#include "Track.h"
|
||||
#include "Timer.h"
|
||||
@@ -125,8 +126,8 @@ void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
{ // jeśli po zmianie nie ma żadnej osi na odcinku izolowanym
|
||||
if (evFree)
|
||||
simulation::Events.AddToQuery(evFree, o); // dodanie zwolnienia do kolejki
|
||||
if (Global.iMultiplayer) // jeśli multiplayer
|
||||
multiplayer::WyslijString(asName, 10); // wysłanie pakietu o zwolnieniu
|
||||
if (Global.iMultiplayer) // jeśli multiplayer
|
||||
multiplayer::WyslijString(asName, 10); // wysłanie pakietu o zwolnieniu
|
||||
if (pMemCell) // w powiązanej komórce
|
||||
pMemCell->UpdateValues( "", 0, int( pMemCell->Value2() ) & ~0xFF,
|
||||
basic_event::flags::value2 ); //"zerujemy" ostatnią wartość
|
||||
@@ -139,8 +140,21 @@ void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
{
|
||||
if (evBusy)
|
||||
simulation::Events.AddToQuery(evBusy, o); // dodanie zajętości do kolejki
|
||||
if (Global.iMultiplayer) // jeśli multiplayer
|
||||
multiplayer::WyslijString(asName, 11); // wysłanie pakietu o zajęciu
|
||||
if (Global.iMultiplayer) // jeśli multiplayer
|
||||
{
|
||||
auto const *owner = (
|
||||
((o->Mechanik != nullptr) && (o->Mechanik->primary())) ?
|
||||
o->Mechanik :
|
||||
o->ctOwner);
|
||||
auto textline = owner != nullptr ? Bezogonkow(owner->TrainName(), true) : "none";
|
||||
if ("none" != textline && Global.bIsolatedTrainName) {
|
||||
textline = ":" + Bezogonkow(owner->TrainName(), true);
|
||||
}
|
||||
else {
|
||||
textline = "";
|
||||
}
|
||||
multiplayer::WyslijString(asName+textline, 11); // wysłanie pakietu o zajęciu
|
||||
}
|
||||
if (pMemCell) // w powiązanej komórce
|
||||
pMemCell->UpdateValues( "", 0, int( pMemCell->Value2() ) | 1, basic_event::flags::value2 ); // zmieniamy ostatnią wartość na nieparzystą
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user