<commit_before>#include "stdafx.h"
#include "widgets/time.h"
#include "simulationtime.h"
#include "Globals.h"

ui::time_panel::time_panel() : ui_panel(STR_C("Time and environment"), false)
{
	size.x = 450;
}

void ui::time_panel::render_contents()
{
	ImGui::SliderFloat(STR_C("Time"), &time, 0.0f, 24.0f, "%.1f");
	ImGui::SliderInt(STR_C("Day in year"), &yearday, 1, 365);
	ImGui::SliderFloat(STR_C("Visibility"), &fog, 50.0f, 3000.0f, "%.0f");
	ImGui::SliderFloat(STR_C("Overcast and precipitation"), &overcast, 0.0f, 2.0f, "%.1f");
	ImGui::SliderFloat(STR_C("Temperature"), &temperature, -20.0f, 40.0f, "%.0f");

	if (ImGui::Button(STR_C("Apply")))
	{
		m_relay.post(user_command::setdatetime, (double)yearday, time, 1, 0);
		m_relay.post(user_command::setweather, fog, overcast, 1, 0);
		m_relay.post(user_command::settemperature, temperature, 0.0, 1, 0);
	}
}

void ui::time_panel::open()
{
	auto &data = simulation::Time.data();
	time = (float)data.wHour + (float)data.wMinute / 60.0f;

	yearday = simulation::Time.year_day();
	fog = Global.fFogEnd;

	overcast = Global.Overcast;
	temperature = Global.AirTemperature;

	is_open = true;
}<commit_msg>fix datetime widget<commit_after>#include "stdafx.h"
#include "widgets/time.h"
#include "simulationtime.h"
#include "Globals.h"

ui::time_panel::time_panel() : ui_panel(STR_C("Time and environment"), false)
{
	size.x = 450;
}

void ui::time_panel::render_contents()
{
	ImGui::SliderFloat(STR_C("Time"), &time, 0.0f, 24.0f, "%.1f");
	ImGui::SliderInt(STR_C("Day in year"), &yearday, 1, 365);
	ImGui::SliderFloat(STR_C("Visibility"), &fog, 50.0f, 3000.0f, "%.0f");
	ImGui::SliderFloat(STR_C("Overcast and precipitation"), &overcast, 0.0f, 2.0f, "%.1f");
	ImGui::SliderFloat(STR_C("Temperature"), &temperature, -20.0f, 40.0f, "%.0f");

	if (ImGui::Button(STR_C("Apply")))
	{
        m_relay.post(user_command::setdatetime, (double)yearday, time * 60.0, 1, 0);
		m_relay.post(user_command::setweather, fog, overcast, 1, 0);
		m_relay.post(user_command::settemperature, temperature, 0.0, 1, 0);
	}
}

void ui::time_panel::open()
{
	auto &data = simulation::Time.data();
	time = (float)data.wHour + (float)data.wMinute / 60.0f;

	yearday = simulation::Time.year_day();
	fog = Global.fFogEnd;

	overcast = Global.Overcast;
	temperature = Global.AirTemperature;

	is_open = true;
}
{'fraction_non_alphanumeric': 0.19939836699613236, 'fraction_numerical': 0.039965620971207566, 'mean_word_length': 6.0120481927710845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2592848', 'n_tokens_mistral': 1040, 'n_tokens_neox': 961, 'n_words': 165}