16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49: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 "utilities/Logs.h"
#include "widgets/vehicleparams.h"
#include "utilities/U8.h"
#define DRIVER_HINT_CONTENT
#include "application/driverhints.h"
@@ -390,7 +391,7 @@ timetable_panel::update() {
}
else {
// header
m_tablelines.emplace_back( "┌─────┬────────────────────────────────────┬─────────┬─────┐", Global.UITextColor );
m_tablelines.emplace_back(U8("┌─────┬────────────────────────────────────┬─────────┬─────┐"), Global.UITextColor);
TMTableLine const *tableline;
for( int i = table.StationStart; i <= table.StationCount; ++i ) {
@@ -422,11 +423,11 @@ timetable_panel::update() {
auto const arrival { (
tableline->Ah >= 0 ?
std::to_string( int( 100 + tableline->Ah ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Am, true, 3 ) :
"" ) };
U8("") ) };
auto const departure { (
tableline->Dh >= 0 ?
std::to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
"" ) };
U8("") ) };
auto const candepart { (
( table.StationStart < 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
isatpassengerstop ? colors::uitextorange :
Global.UITextColor ) };
auto const trackcount{ ( tableline->TrackNo == 1 ? "" : "" ) };
std::string const trackcount{ ( tableline->TrackNo == 1 ? U8("") : U8("" )) };
m_tablelines.emplace_back(
( "" + vmax + "" + station + trackcount + arrival + "" + traveltime + "" ),
( U8("") + vmax + U8("") + station + trackcount + arrival + U8("") + traveltime + U8("") ),
linecolor );
m_tablelines.emplace_back(
( "│ │ " + location + tableline->StationWare + trackcount + departure + " │ │" ),
( U8("│ │ ") + location + tableline->StationWare + trackcount + departure + U8(" │ │") ),
linecolor );
// divider/footer
if( i < table.StationCount ) {
auto const *nexttableline { tableline + 1 };
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? "│ ├" : "├─────┼" ) };
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? "" : "" ) };
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? U8("│ ├") : U8("├─────┼") ) };
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? U8("") : U8("") ) };
m_tablelines.emplace_back(
vmaxnext + "────────────────────────────────────" + trackcountnext + "─────────┼─────┤",
vmaxnext + U8("────────────────────────────────────") + trackcountnext + U8("─────────┼─────┤"),
Global.UITextColor );
}
else {
m_tablelines.emplace_back(
"└─────┴────────────────────────────────────┴─────────┴─────┘",
U8("└─────┴────────────────────────────────────┴─────────┴─────┘"),
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/Globals.h"
#include "utilities/parser.h"
#include "utilities/U8.h"
//#include "utilities/Logs.h"
@@ -204,7 +206,7 @@ std::string to_hex_str(int const Value, int const Width)
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)
{