16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

desync info tweaks

This commit is contained in:
milek7
2019-11-17 14:02:24 +01:00
parent c31af696c4
commit a16cf6cdab
4 changed files with 14 additions and 4 deletions

View File

@@ -248,6 +248,7 @@ struct global_settings {
std::vector<std::pair<std::string, std::string>> network_servers;
std::optional<std::pair<std::string, std::string>> network_client;
float desync = 0.0f;
std::unordered_map<int, std::string> trainset_overrides;

View File

@@ -257,9 +257,7 @@ eu07_application::run() {
WriteLog("net: desync! calculated: " + std::to_string(sync)
+ ", received: " + std::to_string(slave_sync), logtype::net);
ImGui::Begin("NET");
ImGui::TextUnformatted("desync!");
ImGui::End();
Global.desync = slave_sync - sync;
}
// set total delta for rendering code

View File

@@ -261,4 +261,11 @@ driver_ui::render_() {
m_pause_modal_opened = true;
ImGui::OpenPopup(popupheader);
}
if (Global.desync != 0.0f) {
ImGui::SetNextWindowSize(ImVec2(-1, -1));
if (ImGui::Begin("network", nullptr, ImGuiWindowFlags_NoCollapse))
ImGui::Text("desync: %0.2f", Global.desync);
ImGui::End();
}
}

View File

@@ -243,7 +243,11 @@ void network::client::handle_message(std::shared_ptr<connection> conn, const mes
WriteLog("net: accept received", logtype::net);
}
else if (msg.type == message::FRAME_INFO) {
if (conn->state != connection::ACTIVE)
return;
if (msg.type == message::FRAME_INFO) {
resume_frame_counter++;
auto delta = dynamic_cast<const frame_info&>(msg);