16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 08:09:19 +02:00

Fix C4566

This commit is contained in:
docentYT
2026-05-12 16:36:32 +02:00
parent 4c7cf22d06
commit be91c4da70
3 changed files with 17 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/.
#include "rendering/renderer.h" #include "rendering/renderer.h"
#include "utilities/Logs.h" #include "utilities/Logs.h"
#include "widgets/vehicleparams.h" #include "widgets/vehicleparams.h"
#include "utilities/U8.h"
#define DRIVER_HINT_CONTENT #define DRIVER_HINT_CONTENT
#include "application/driverhints.h" #include "application/driverhints.h"
@@ -390,7 +391,7 @@ timetable_panel::update() {
} }
else { else {
// header // header
m_tablelines.emplace_back( "┌─────┬────────────────────────────────────┬─────────┬─────┐", Global.UITextColor ); m_tablelines.emplace_back(U8("┌─────┬────────────────────────────────────┬─────────┬─────┐"), Global.UITextColor);
TMTableLine const *tableline; TMTableLine const *tableline;
for( int i = table.StationStart; i <= table.StationCount; ++i ) { for( int i = table.StationStart; i <= table.StationCount; ++i ) {
@@ -422,11 +423,11 @@ timetable_panel::update() {
auto const arrival { ( auto const arrival { (
tableline->Ah >= 0 ? tableline->Ah >= 0 ?
std::to_string( int( 100 + tableline->Ah ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Am, true, 3 ) : std::to_string( int( 100 + tableline->Ah ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Am, true, 3 ) :
"" ) }; U8("") ) };
auto const departure { ( auto const departure { (
tableline->Dh >= 0 ? tableline->Dh >= 0 ?
std::to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) : std::to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
"" ) }; U8("") ) };
auto const candepart { ( auto const candepart { (
( table.StationStart < table.StationIndex ) ( table.StationStart < table.StationIndex )
&& ( i < table.StationIndex ) && ( i < table.StationIndex )
@@ -445,25 +446,25 @@ timetable_panel::update() {
candepart ? colors::uitextgreen : // czas minął i odjazd był, to nazwa stacji będzie na zielono candepart ? colors::uitextgreen : // czas minął i odjazd był, to nazwa stacji będzie na zielono
isatpassengerstop ? colors::uitextorange : isatpassengerstop ? colors::uitextorange :
Global.UITextColor ) }; Global.UITextColor ) };
auto const trackcount{ ( tableline->TrackNo == 1 ? "" : "" ) }; std::string const trackcount{ ( tableline->TrackNo == 1 ? U8("") : U8("" )) };
m_tablelines.emplace_back( m_tablelines.emplace_back(
( "" + vmax + "" + station + trackcount + arrival + "" + traveltime + "" ), ( U8("") + vmax + U8("") + station + trackcount + arrival + U8("") + traveltime + U8("") ),
linecolor ); linecolor );
m_tablelines.emplace_back( m_tablelines.emplace_back(
( "│ │ " + location + tableline->StationWare + trackcount + departure + " │ │" ), ( U8("│ │ ") + location + tableline->StationWare + trackcount + departure + U8(" │ │") ),
linecolor ); linecolor );
// divider/footer // divider/footer
if( i < table.StationCount ) { if( i < table.StationCount ) {
auto const *nexttableline { tableline + 1 }; auto const *nexttableline { tableline + 1 };
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? "│ ├" : "├─────┼" ) }; std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? U8("│ ├") : U8("├─────┼") ) };
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? "" : "" ) }; auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? U8("") : U8("") ) };
m_tablelines.emplace_back( m_tablelines.emplace_back(
vmaxnext + "────────────────────────────────────" + trackcountnext + "─────────┼─────┤", vmaxnext + U8("────────────────────────────────────") + trackcountnext + U8("─────────┼─────┤"),
Global.UITextColor ); Global.UITextColor );
} }
else { else {
m_tablelines.emplace_back( m_tablelines.emplace_back(
"└─────┴────────────────────────────────────┴─────────┴─────┘", U8("└─────┴────────────────────────────────────┴─────────┴─────┘"),
Global.UITextColor ); Global.UITextColor );
} }
} }

3
utilities/U8.h Normal file
View File

@@ -0,0 +1,3 @@
#pragma once
#define U8(str) (const char *)u8##str

View File

@@ -27,6 +27,8 @@ Copyright (C) 2007-2014 Maciej Cierniak
#include "utilities/utilities.h" #include "utilities/utilities.h"
#include "utilities/Globals.h" #include "utilities/Globals.h"
#include "utilities/parser.h" #include "utilities/parser.h"
#include "utilities/U8.h"
//#include "utilities/Logs.h" //#include "utilities/Logs.h"
@@ -204,7 +206,7 @@ std::string to_hex_str(int const Value, int const Width)
return o.str(); return o.str();
}; };
std::string const fractionlabels[] = {" ", "¹", "²", "³", "", "", "", "", "", ""}; std::string const fractionlabels[] = {U8(" "), U8("¹"), U8("²"), U8("³"), U8(""), U8(""), U8(""), U8(""), U8(""), U8("")};
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width) std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width)
{ {