mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
fix(game_time): use unsigned tick type and enforce positive tick speed
This commit is contained in:
@@ -45,7 +45,7 @@ private:
|
|||||||
bool m_gen_thread_running = true;
|
bool m_gen_thread_running = true;
|
||||||
int m_theme = 0;
|
int m_theme = 0;
|
||||||
int m_pre_set_day_tick = 0;
|
int m_pre_set_day_tick = 0;
|
||||||
int m_pre_set_tick_speed = 0;
|
int m_pre_set_tick_speed = 1;
|
||||||
void show_about_table_bar();
|
void show_about_table_bar();
|
||||||
void show_biome_table_bar();
|
void show_biome_table_bar();
|
||||||
void show_time_table_bar();
|
void show_time_table_bar();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
using TickType = long long;
|
using TickType = unsigned long long;
|
||||||
|
|
||||||
constexpr int DEFAULT_PER_TICK_TIME = 50;
|
constexpr int DEFAULT_PER_TICK_TIME = 50;
|
||||||
|
|
||||||
|
|||||||
@@ -265,8 +265,8 @@ void DevPanel::show_biome_table_bar() {
|
|||||||
|
|
||||||
void DevPanel::show_time_table_bar() {
|
void DevPanel::show_time_table_bar() {
|
||||||
World& world = m_app.world();
|
World& world = m_app.world();
|
||||||
ImGui::Text("Game Tick %lld", world.game_tick());
|
ImGui::Text("Game Tick %llu", world.game_tick());
|
||||||
ImGui::Text("Day Tick %lld", world.day_tick());
|
ImGui::Text("Day Tick %llu", world.day_tick());
|
||||||
if (ImGui::SliderInt("SetDayTick", &m_pre_set_day_tick, 0, DAY_TIME)) {
|
if (ImGui::SliderInt("SetDayTick", &m_pre_set_day_tick, 0, DAY_TIME)) {
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@@ -274,7 +274,7 @@ void DevPanel::show_time_table_bar() {
|
|||||||
world.day_tick(static_cast<TickType>(m_pre_set_day_tick));
|
world.day_tick(static_cast<TickType>(m_pre_set_day_tick));
|
||||||
}
|
}
|
||||||
ImGui::Text("MSPT %d", world.per_tick_time());
|
ImGui::Text("MSPT %d", world.per_tick_time());
|
||||||
if (ImGui::SliderInt("SetMSPT", &m_pre_set_tick_speed, 0, 200)) {
|
if (ImGui::SliderInt("SetMSPT", &m_pre_set_tick_speed, 1, 200)) {
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Set##MSPT")) {
|
if (ImGui::Button("Set##MSPT")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user