mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 19:49:19 +02:00
Merge pull request #25 from carmel4a/minor_changes
Add conversion from `scenario_time` to `std::string`.
This commit is contained in:
@@ -194,4 +194,10 @@ scenario_time::julian_day() const {
|
|||||||
return JD;
|
return JD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scenario_time::operator std::string(){
|
||||||
|
|
||||||
|
return to_string( m_time.wHour ) + ":"
|
||||||
|
+ ( m_time.wMinute < 10 ? "0" : "" ) + to_string( m_time.wMinute ) + ":"
|
||||||
|
+ ( m_time.wSecond < 10 ? "0" : "" ) + to_string( m_time.wSecond );
|
||||||
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "winheaders.h"
|
#include "winheaders.h"
|
||||||
|
|
||||||
// wrapper for scenario time
|
// wrapper for scenario time
|
||||||
@@ -47,6 +49,8 @@ public:
|
|||||||
zone_bias() const {
|
zone_bias() const {
|
||||||
return m_timezonebias; }
|
return m_timezonebias; }
|
||||||
|
|
||||||
|
/** Returns std::string in format: `"mm:ss"`. */
|
||||||
|
operator std::string();
|
||||||
private:
|
private:
|
||||||
// calculates day and month from given day of year
|
// calculates day and month from given day of year
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -279,12 +279,8 @@ ui_layer::update() {
|
|||||||
|
|
||||||
case( GLFW_KEY_F1 ) : {
|
case( GLFW_KEY_F1 ) : {
|
||||||
// f1, default mode: current time and timetable excerpt
|
// f1, default mode: current time and timetable excerpt
|
||||||
auto const &time = simulation::Time.data();
|
|
||||||
uitextline1 =
|
uitextline1 =
|
||||||
"Time: "
|
"Time: " + std::string( simulation::Time );
|
||||||
+ to_string( time.wHour ) + ":"
|
|
||||||
+ ( time.wMinute < 10 ? "0" : "" ) + to_string( time.wMinute ) + ":"
|
|
||||||
+ ( time.wSecond < 10 ? "0" : "" ) + to_string( time.wSecond );
|
|
||||||
if( Global.iPause ) {
|
if( Global.iPause ) {
|
||||||
uitextline1 += " (paused)";
|
uitextline1 += " (paused)";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user