mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 00:09:18 +02:00
maintenance: minor code cleanup
This commit is contained in:
@@ -6409,6 +6409,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
|
|||||||
|
|
||||||
if( true == Vehicle.Mains ) {
|
if( true == Vehicle.Mains ) {
|
||||||
// TODO: separate engine and main circuit
|
// TODO: separate engine and main circuit
|
||||||
|
// engine activation
|
||||||
engine_shutdown.stop();
|
engine_shutdown.stop();
|
||||||
engine_ignition
|
engine_ignition
|
||||||
.pitch( engine_ignition.m_frequencyoffset + engine_ignition.m_frequencyfactor * 1.f )
|
.pitch( engine_ignition.m_frequencyoffset + engine_ignition.m_frequencyfactor * 1.f )
|
||||||
@@ -6426,7 +6427,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
|
|||||||
engine_shutdown.pitch( engine_shutdown.m_frequencyoffset + engine_shutdown.m_frequencyfactor * 1.f )
|
engine_shutdown.pitch( engine_shutdown.m_frequencyoffset + engine_shutdown.m_frequencyfactor * 1.f )
|
||||||
.gain( engine_shutdown.m_amplitudeoffset + engine_shutdown.m_amplitudefactor * 1.f )
|
.gain( engine_shutdown.m_amplitudeoffset + engine_shutdown.m_amplitudefactor * 1.f )
|
||||||
.play( sound_flags::exclusive );
|
.play( sound_flags::exclusive );
|
||||||
// main circuit
|
// main circuit deactivation
|
||||||
linebreaker_open
|
linebreaker_open
|
||||||
.pitch( linebreaker_open.m_frequencyoffset + linebreaker_open.m_frequencyfactor * 1.f )
|
.pitch( linebreaker_open.m_frequencyoffset + linebreaker_open.m_frequencyfactor * 1.f )
|
||||||
.gain( linebreaker_open.m_amplitudeoffset + linebreaker_open.m_amplitudefactor * 1.f )
|
.gain( linebreaker_open.m_amplitudeoffset + linebreaker_open.m_amplitudefactor * 1.f )
|
||||||
|
|||||||
24
Model3d.cpp
24
Model3d.cpp
@@ -1314,14 +1314,10 @@ void TSubModel::serialize(std::ostream &s,
|
|||||||
sn_utils::ls_float32(s, fVisible);
|
sn_utils::ls_float32(s, fVisible);
|
||||||
sn_utils::ls_float32(s, fLight);
|
sn_utils::ls_float32(s, fLight);
|
||||||
|
|
||||||
for (size_t i = 0; i < 4; i++)
|
sn_utils::s_vec4(s, f4Ambient);
|
||||||
sn_utils::ls_float32(s, f4Ambient[i]);
|
sn_utils::s_vec4(s, f4Diffuse);
|
||||||
for (size_t i = 0; i < 4; i++)
|
sn_utils::s_vec4(s, f4Specular);
|
||||||
sn_utils::ls_float32(s, f4Diffuse[i]);
|
sn_utils::s_vec4(s, f4Emision);
|
||||||
for (size_t i = 0; i < 4; i++)
|
|
||||||
sn_utils::ls_float32(s, f4Specular[i]);
|
|
||||||
for (size_t i = 0; i < 4; i++)
|
|
||||||
sn_utils::ls_float32(s, f4Emision[i]);
|
|
||||||
|
|
||||||
sn_utils::ls_float32(s, fWireSize);
|
sn_utils::ls_float32(s, fWireSize);
|
||||||
sn_utils::ls_float32(s, fSquareMaxDist);
|
sn_utils::ls_float32(s, fSquareMaxDist);
|
||||||
@@ -1438,14 +1434,10 @@ void TSubModel::deserialize(std::istream &s)
|
|||||||
fVisible = sn_utils::ld_float32(s);
|
fVisible = sn_utils::ld_float32(s);
|
||||||
fLight = sn_utils::ld_float32(s);
|
fLight = sn_utils::ld_float32(s);
|
||||||
|
|
||||||
for (size_t i = 0; i < 4; ++i)
|
f4Ambient = sn_utils::d_vec4(s);
|
||||||
f4Ambient[i] = sn_utils::ld_float32(s);
|
f4Diffuse = sn_utils::d_vec4(s);
|
||||||
for (size_t i = 0; i < 4; ++i)
|
f4Specular = sn_utils::d_vec4(s);
|
||||||
f4Diffuse[i] = sn_utils::ld_float32(s);
|
f4Emision = sn_utils::d_vec4(s);
|
||||||
for (size_t i = 0; i < 4; ++i)
|
|
||||||
f4Specular[i] = sn_utils::ld_float32(s);
|
|
||||||
for (size_t i = 0; i < 4; ++i)
|
|
||||||
f4Emision[i] = sn_utils::ld_float32(s);
|
|
||||||
|
|
||||||
fWireSize = sn_utils::ld_float32(s);
|
fWireSize = sn_utils::ld_float32(s);
|
||||||
fSquareMaxDist = sn_utils::ld_float32(s);
|
fSquareMaxDist = sn_utils::ld_float32(s);
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ driver_ui::driver_ui() {
|
|||||||
push_back( &m_debugpanel );
|
push_back( &m_debugpanel );
|
||||||
push_back( &m_transcriptspanel );
|
push_back( &m_transcriptspanel );
|
||||||
|
|
||||||
m_aidpanel.name = locale::strings[ locale::string::driver_aid_header ];
|
m_aidpanel.title = locale::strings[ locale::string::driver_aid_header ];
|
||||||
|
|
||||||
m_timetablepanel.name = locale::strings[ locale::string::driver_timetable_header ];
|
m_timetablepanel.title = locale::strings[ locale::string::driver_timetable_header ];
|
||||||
m_timetablepanel.size_min = { 435, 110 };
|
m_timetablepanel.size_min = { 435, 110 };
|
||||||
m_timetablepanel.size_max = { 435, Global.iWindowHeight * 0.95 };
|
m_timetablepanel.size_max = { 435, Global.iWindowHeight * 0.95 };
|
||||||
|
|
||||||
m_transcriptspanel.name = locale::strings[ locale::string::driver_transcripts_header ];
|
m_transcriptspanel.title = locale::strings[ locale::string::driver_transcripts_header ];
|
||||||
m_transcriptspanel.size_min = { 435, 85 };
|
m_transcriptspanel.size_min = { 435, 85 };
|
||||||
m_transcriptspanel.size_max = { Global.iWindowWidth * 0.95, Global.iWindowHeight * 0.95 };
|
m_transcriptspanel.size_max = { Global.iWindowWidth * 0.95, Global.iWindowHeight * 0.95 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ debug_panel::render() {
|
|||||||
if( size_min.x > 0 ) {
|
if( size_min.x > 0 ) {
|
||||||
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
||||||
}
|
}
|
||||||
if( true == ImGui::Begin( identifier.c_str(), &is_open, flags ) ) {
|
if( true == ImGui::Begin( name.c_str(), &is_open, flags ) ) {
|
||||||
// header section
|
// header section
|
||||||
for( auto const &line : text_lines ) {
|
for( auto const &line : text_lines ) {
|
||||||
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
||||||
@@ -929,10 +929,10 @@ transcripts_panel::render() {
|
|||||||
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
||||||
}
|
}
|
||||||
auto const panelname { (
|
auto const panelname { (
|
||||||
name.empty() ?
|
title.empty() ?
|
||||||
identifier :
|
name :
|
||||||
name )
|
title )
|
||||||
+ "###" + identifier };
|
+ "###" + name };
|
||||||
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
||||||
// header section
|
// header section
|
||||||
for( auto const &line : text_lines ) {
|
for( auto const &line : text_lines ) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
class drivingaid_panel : public ui_panel {
|
class drivingaid_panel : public ui_panel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
drivingaid_panel( std::string const Name, bool const Isopen )
|
drivingaid_panel( std::string const &Name, bool const Isopen )
|
||||||
: ui_panel( Name, Isopen )
|
: ui_panel( Name, Isopen )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ private:
|
|||||||
class timetable_panel : public ui_panel {
|
class timetable_panel : public ui_panel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
timetable_panel( std::string const Name, bool const Isopen )
|
timetable_panel( std::string const &Name, bool const Isopen )
|
||||||
: ui_panel( Name, Isopen ) {}
|
: ui_panel( Name, Isopen ) {}
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
@@ -46,7 +46,7 @@ private:
|
|||||||
class debug_panel : public ui_panel {
|
class debug_panel : public ui_panel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
debug_panel( std::string const Name, bool const Isopen )
|
debug_panel( std::string const &Name, bool const Isopen )
|
||||||
: ui_panel( Name, Isopen ) {}
|
: ui_panel( Name, Isopen ) {}
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
@@ -97,7 +97,7 @@ private:
|
|||||||
class transcripts_panel : public ui_panel {
|
class transcripts_panel : public ui_panel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
transcripts_panel( std::string const Name, bool const Isopen )
|
transcripts_panel( std::string const &Name, bool const Isopen )
|
||||||
: ui_panel( Name, Isopen ) {}
|
: ui_panel( Name, Isopen ) {}
|
||||||
|
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|||||||
@@ -186,7 +186,12 @@ itemproperties_panel::render() {
|
|||||||
if( size_min.x > 0 ) {
|
if( size_min.x > 0 ) {
|
||||||
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
||||||
}
|
}
|
||||||
if( true == ImGui::Begin( identifier.c_str(), nullptr, flags ) ) {
|
auto const panelname { (
|
||||||
|
title.empty() ?
|
||||||
|
name :
|
||||||
|
title )
|
||||||
|
+ "###" + name };
|
||||||
|
if( true == ImGui::Begin( panelname.c_str(), nullptr, flags ) ) {
|
||||||
// header section
|
// header section
|
||||||
for( auto const &line : text_lines ) {
|
for( auto const &line : text_lines ) {
|
||||||
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
class itemproperties_panel : public ui_panel {
|
class itemproperties_panel : public ui_panel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
itemproperties_panel( std::string const Name, bool const Isopen )
|
itemproperties_panel( std::string const &Name, bool const Isopen )
|
||||||
: ui_panel( Name, Isopen )
|
: ui_panel( Name, Isopen )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ extern "C"
|
|||||||
|
|
||||||
namespace multiplayer {
|
namespace multiplayer {
|
||||||
|
|
||||||
|
std::uint32_t const EU07_MESSAGEHEADER { MAKE_ID4( 'E','U','0','7' ) };
|
||||||
|
|
||||||
void
|
void
|
||||||
Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam) {
|
Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -43,7 +45,7 @@ Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam) {
|
|||||||
void
|
void
|
||||||
OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
||||||
{ // odebranie komunikatu z serwera
|
{ // odebranie komunikatu z serwera
|
||||||
if (pRozkaz->iSygn == MAKE_ID4('E','U','0','7') )
|
if (pRozkaz->iSygn == EU07_MESSAGEHEADER )
|
||||||
switch (pRozkaz->iComm)
|
switch (pRozkaz->iComm)
|
||||||
{
|
{
|
||||||
case 0: // odesłanie identyfikatora wersji
|
case 0: // odesłanie identyfikatora wersji
|
||||||
@@ -204,7 +206,7 @@ WyslijEvent(const std::string &e, const std::string &d)
|
|||||||
{ // Ra: jeszcze do wyczyszczenia
|
{ // Ra: jeszcze do wyczyszczenia
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = 2; // 2 - event
|
r.iComm = 2; // 2 - event
|
||||||
size_t i = e.length(), j = d.length();
|
size_t i = e.length(), j = d.length();
|
||||||
r.cString[0] = char(i);
|
r.cString[0] = char(i);
|
||||||
@@ -212,7 +214,7 @@ WyslijEvent(const std::string &e, const std::string &d)
|
|||||||
r.cString[i + 2] = char(j); // licznik po zerze kończącym
|
r.cString[i + 2] = char(j); // licznik po zerze kończącym
|
||||||
strcpy(r.cString + 3 + i, d.c_str()); // zakończony zerem
|
strcpy(r.cString + 3 + i, d.c_str()); // zakończony zerem
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = (DWORD)(12 + i + j); // 8+dwa liczniki i dwa zera kończące
|
cData.cbData = (DWORD)(12 + i + j); // 8+dwa liczniki i dwa zera kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
||||||
@@ -225,14 +227,14 @@ WyslijUszkodzenia(const std::string &t, char fl)
|
|||||||
{ // wysłanie informacji w postaci pojedynczego tekstu
|
{ // wysłanie informacji w postaci pojedynczego tekstu
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = 13; // numer komunikatu
|
r.iComm = 13; // numer komunikatu
|
||||||
size_t i = t.length();
|
size_t i = t.length();
|
||||||
r.cString[0] = char(fl);
|
r.cString[0] = char(fl);
|
||||||
r.cString[1] = char(i);
|
r.cString[1] = char(i);
|
||||||
strcpy(r.cString + 2, t.c_str()); // z zerem kończącym
|
strcpy(r.cString + 2, t.c_str()); // z zerem kończącym
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = (DWORD)(11 + i); // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(11 + i); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
||||||
@@ -245,13 +247,13 @@ WyslijString(const std::string &t, int n)
|
|||||||
{ // wysłanie informacji w postaci pojedynczego tekstu
|
{ // wysłanie informacji w postaci pojedynczego tekstu
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = n; // numer komunikatu
|
r.iComm = n; // numer komunikatu
|
||||||
size_t i = t.length();
|
size_t i = t.length();
|
||||||
r.cString[0] = char(i);
|
r.cString[0] = char(i);
|
||||||
strcpy(r.cString + 1, t.c_str()); // z zerem kończącym
|
strcpy(r.cString + 1, t.c_str()); // z zerem kończącym
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = (DWORD)(10 + i); // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(10 + i); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
||||||
@@ -271,7 +273,7 @@ WyslijNamiary(TDynamicObject const *Vehicle)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// WriteLog("Wysylam pojazd");
|
// WriteLog("Wysylam pojazd");
|
||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = 7; // 7 - dane pojazdu
|
r.iComm = 7; // 7 - dane pojazdu
|
||||||
int i = 32;
|
int i = 32;
|
||||||
size_t j = Vehicle->asName.length();
|
size_t j = Vehicle->asName.length();
|
||||||
@@ -334,7 +336,7 @@ WyslijNamiary(TDynamicObject const *Vehicle)
|
|||||||
r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować
|
r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować
|
||||||
strcpy(r.cString + i + 1, Vehicle->asName.c_str()); // zakończony zerem
|
strcpy(r.cString + i + 1, Vehicle->asName.c_str()); // zakończony zerem
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = (DWORD)(10 + i + j); // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(10 + i + j); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
// WriteLog("Ramka gotowa");
|
// WriteLog("Ramka gotowa");
|
||||||
@@ -349,7 +351,7 @@ WyslijObsadzone()
|
|||||||
{ // wysłanie informacji o pojeździe
|
{ // wysłanie informacji o pojeździe
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DaneRozkaz2 r;
|
DaneRozkaz2 r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = 12; // kod 12
|
r.iComm = 12; // kod 12
|
||||||
for (int i=0; i<1984; ++i) r.cString[i] = 0;
|
for (int i=0; i<1984; ++i) r.cString[i] = 0;
|
||||||
|
|
||||||
@@ -383,7 +385,7 @@ WyslijObsadzone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = 8 + 1984; // 8+licznik i zero kończące
|
cData.cbData = 8 + 1984; // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
// WriteLog("Ramka gotowa");
|
// WriteLog("Ramka gotowa");
|
||||||
@@ -397,7 +399,7 @@ WyslijParam(int nr, int fl)
|
|||||||
{ // wysłanie parametrów symulacji w ramce (nr) z flagami (fl)
|
{ // wysłanie parametrów symulacji w ramce (nr) z flagami (fl)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = EU07_MESSAGEHEADER;
|
||||||
r.iComm = nr; // zwykle 5
|
r.iComm = nr; // zwykle 5
|
||||||
r.iPar[0] = fl; // flagi istotności kolejnych parametrów
|
r.iPar[0] = fl; // flagi istotności kolejnych parametrów
|
||||||
int i = 0; // domyślnie brak danych
|
int i = 0; // domyślnie brak danych
|
||||||
@@ -410,7 +412,7 @@ WyslijParam(int nr, int fl)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = EU07_MESSAGEHEADER; // sygnatura
|
||||||
cData.cbData = 12 + i; // 12+rozmiar danych
|
cData.cbData = 12 + i; // 12+rozmiar danych
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Application.window() ), (LPARAM)&cData );
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
namespace scene {
|
namespace scene {
|
||||||
|
|
||||||
std::string const EU07_FILEEXTENSION_REGION { ".sbt" };
|
std::string const EU07_FILEEXTENSION_REGION { ".sbt" };
|
||||||
|
std::uint32_t const EU07_FILEHEADER { MAKE_ID4( 'E','U','0','7' ) };
|
||||||
std::uint32_t const EU07_FILEVERSION_REGION { MAKE_ID4( 'S', 'B', 'T', 1 ) };
|
std::uint32_t const EU07_FILEVERSION_REGION { MAKE_ID4( 'S', 'B', 'T', 1 ) };
|
||||||
|
|
||||||
// potentially activates event handler with the same name as provided node, and within handler activation range
|
// potentially activates event handler with the same name as provided node, and within handler activation range
|
||||||
@@ -1002,7 +1003,7 @@ basic_region::serialize( std::string const &Scenariofile ) const {
|
|||||||
|
|
||||||
// region file version 1
|
// region file version 1
|
||||||
// header: EU07SBT + version (0-255)
|
// header: EU07SBT + version (0-255)
|
||||||
sn_utils::ls_uint32( output, MAKE_ID4( 'E', 'U', '0', '7' ) );
|
sn_utils::ls_uint32( output, EU07_FILEHEADER );
|
||||||
sn_utils::ls_uint32( output, EU07_FILEVERSION_REGION );
|
sn_utils::ls_uint32( output, EU07_FILEVERSION_REGION );
|
||||||
// sections
|
// sections
|
||||||
// TBD, TODO: build table of sections and file offsets, if we postpone section loading until they're within range
|
// TBD, TODO: build table of sections and file offsets, if we postpone section loading until they're within range
|
||||||
@@ -1047,7 +1048,7 @@ basic_region::deserialize( std::string const &Scenariofile ) {
|
|||||||
uint32_t headermain { sn_utils::ld_uint32( input ) };
|
uint32_t headermain { sn_utils::ld_uint32( input ) };
|
||||||
uint32_t headertype { sn_utils::ld_uint32( input ) };
|
uint32_t headertype { sn_utils::ld_uint32( input ) };
|
||||||
|
|
||||||
if( ( headermain != MAKE_ID4( 'E', 'U', '0', '7' )
|
if( ( headermain != EU07_FILEHEADER
|
||||||
|| ( headertype != EU07_FILEVERSION_REGION ) ) ) {
|
|| ( headertype != EU07_FILEVERSION_REGION ) ) ) {
|
||||||
// wrong file type
|
// wrong file type
|
||||||
WriteLog( "Bad file: \"" + filename + "\" is of either unrecognized type or version" );
|
WriteLog( "Bad file: \"" + filename + "\" is of either unrecognized type or version" );
|
||||||
|
|||||||
12
uilayer.cpp
12
uilayer.cpp
@@ -27,8 +27,8 @@ GLint ui_layer::m_textureunit { GL_TEXTURE0 };
|
|||||||
bool ui_layer::m_cursorvisible { true };
|
bool ui_layer::m_cursorvisible { true };
|
||||||
|
|
||||||
|
|
||||||
ui_panel::ui_panel( std::string const Identifier, bool const Isopen )
|
ui_panel::ui_panel( std::string const &Identifier, bool const Isopen )
|
||||||
: identifier( Identifier ), is_open( Isopen )
|
: name( Identifier ), is_open( Isopen )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -49,10 +49,10 @@ ui_panel::render() {
|
|||||||
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
ImGui::SetNextWindowSizeConstraints( ImVec2( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) );
|
||||||
}
|
}
|
||||||
auto const panelname { (
|
auto const panelname { (
|
||||||
name.empty() ?
|
title.empty() ?
|
||||||
identifier :
|
name :
|
||||||
name )
|
title )
|
||||||
+ "###" + identifier };
|
+ "###" + name };
|
||||||
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
||||||
for( auto const &line : text_lines ) {
|
for( auto const &line : text_lines ) {
|
||||||
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() );
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class ui_panel {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
ui_panel( std::string const Identifier, bool const Isopen );
|
ui_panel( std::string const &Identifier, bool const Isopen );
|
||||||
// methods
|
// methods
|
||||||
virtual void update() {};
|
virtual void update() {};
|
||||||
virtual void render();
|
virtual void render();
|
||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
// members
|
// members
|
||||||
std::string name;
|
std::string title;
|
||||||
bool is_open;
|
bool is_open;
|
||||||
glm::ivec2 size { -1, -1 };
|
glm::ivec2 size { -1, -1 };
|
||||||
glm::ivec2 size_min { -1, -1 };
|
glm::ivec2 size_min { -1, -1 };
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// members
|
// members
|
||||||
std::string identifier;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ui_layer {
|
class ui_layer {
|
||||||
|
|||||||
@@ -64,13 +64,11 @@ std::string Now() {
|
|||||||
// na dłuższą metę trzeba uwzględnić datę, jakby opóżnienia miały przekraczać 12h (towarowych)
|
// na dłuższą metę trzeba uwzględnić datę, jakby opóżnienia miały przekraczać 12h (towarowych)
|
||||||
double CompareTime(double t1h, double t1m, double t2h, double t2m) {
|
double CompareTime(double t1h, double t1m, double t2h, double t2m) {
|
||||||
|
|
||||||
double t;
|
|
||||||
|
|
||||||
if ((t2h < 0))
|
if ((t2h < 0))
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t = (t2h - t1h) * 60 + t2m - t1m; // jeśli t2=00:05, a t1=23:50, to różnica wyjdzie ujemna
|
auto t = (t2h - t1h) * 60 + t2m - t1m; // jeśli t2=00:05, a t1=23:50, to różnica wyjdzie ujemna
|
||||||
if ((t < -720)) // jeśli różnica przekracza 12h na minus
|
if ((t < -720)) // jeśli różnica przekracza 12h na minus
|
||||||
t = t + 1440; // to dodanie doby minut;else
|
t = t + 1440; // to dodanie doby minut;else
|
||||||
if ((t > 720)) // jeśli przekracza 12h na plus
|
if ((t > 720)) // jeśli przekracza 12h na plus
|
||||||
@@ -188,49 +186,49 @@ std::vector<std::string> Split(const std::string &s)
|
|||||||
return elems;
|
return elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string(int _Val)
|
std::string to_string(int Value)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(unsigned int _Val)
|
std::string to_string(unsigned int Value)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(double _Val)
|
std::string to_string(double Value)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(int _Val, int precision)
|
std::string to_string(int Value, int precision)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << std::fixed << std::setprecision(precision);
|
o << std::fixed << std::setprecision(precision);
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(double _Val, int precision)
|
std::string to_string(double Value, int precision)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << std::fixed << std::setprecision(precision);
|
o << std::fixed << std::setprecision(precision);
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string to_string(int _Val, int precision, int width)
|
std::string to_string(int Value, int precision, int width)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o.width(width);
|
o.width(width);
|
||||||
o << std::fixed << std::setprecision(precision);
|
o << std::fixed << std::setprecision(precision);
|
||||||
o << _Val;
|
o << Value;
|
||||||
return o.str();
|
return o.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
20
utilities.h
20
utilities.h
@@ -98,18 +98,18 @@ std::vector<std::string> &Split(const std::string &s, char delim, std::vector<st
|
|||||||
std::vector<std::string> Split(const std::string &s, char delim);
|
std::vector<std::string> Split(const std::string &s, char delim);
|
||||||
//std::vector<std::string> Split(const std::string &s);
|
//std::vector<std::string> Split(const std::string &s);
|
||||||
|
|
||||||
std::string to_string(int _Val);
|
std::string to_string(int Value);
|
||||||
std::string to_string(unsigned int _Val);
|
std::string to_string(unsigned int Value);
|
||||||
std::string to_string(int _Val, int precision);
|
std::string to_string(int Value, int precision);
|
||||||
std::string to_string(int _Val, int precision, int width);
|
std::string to_string(int Value, int precision, int width);
|
||||||
std::string to_string(double _Val);
|
std::string to_string(double Value);
|
||||||
std::string to_string(double _Val, int precision);
|
std::string to_string(double Value, int precision);
|
||||||
std::string to_string(double _Val, int precision, int width);
|
std::string to_string(double Value, int precision, int width);
|
||||||
std::string to_hex_str( int const _Val, int const width = 4 );
|
std::string to_hex_str( int const Value, int const width = 4 );
|
||||||
|
|
||||||
inline std::string to_string(bool _Val) {
|
inline std::string to_string(bool Value) {
|
||||||
|
|
||||||
return _Val == true ? "true" : "false";
|
return ( Value == true ? "true" : "false" );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type_, glm::precision Precision_ = glm::defaultp>
|
template <typename Type_, glm::precision Precision_ = glm::defaultp>
|
||||||
|
|||||||
Reference in New Issue
Block a user