From aaed751bf4430bf4b9b30cef532b8753b9f639ce Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Sep 2025 13:48:31 +0500 Subject: Replace most of C strings with string_view --- game/client/toggles.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'game/client/toggles.cc') diff --git a/game/client/toggles.cc b/game/client/toggles.cc index 96c4ae4..e6ffc26 100644 --- a/game/client/toggles.cc +++ b/game/client/toggles.cc @@ -13,7 +13,7 @@ #include "client/globals.hh" struct ToggleInfo final { - const char* description; + std::string_view description; int glfw_keycode; bool is_enabled; }; @@ -24,7 +24,7 @@ static ToggleInfo toggle_infos[TOGGLE_COUNT]; static void print_toggle_state(const ToggleInfo& info) { - if(info.description) { + if(info.description.size()) { if(info.is_enabled) { gui::client_chat::print(std::format("[toggles] {} ON", info.description)); } @@ -102,7 +102,7 @@ void toggles::init(void) toggle_infos[TOGGLE_CHUNK_AABB].glfw_keycode = GLFW_KEY_G; toggle_infos[TOGGLE_CHUNK_AABB].is_enabled = false; - toggle_infos[TOGGLE_METRICS_UI].description = nullptr; + toggle_infos[TOGGLE_METRICS_UI].description = std::string_view(); toggle_infos[TOGGLE_METRICS_UI].glfw_keycode = GLFW_KEY_V; toggle_infos[TOGGLE_METRICS_UI].is_enabled = false; @@ -114,10 +114,6 @@ void toggles::init(void) toggle_infos[TOGGLE_PM_FLIGHT].glfw_keycode = GLFW_KEY_F; toggle_infos[TOGGLE_PM_FLIGHT].is_enabled = false; -#ifndef NDEBUG - toggle_infos[TOGGLE_WIREFRAME].is_enabled = true; -#endif - globals::dispatcher.sink().connect<&on_glfw_key>(); } -- cgit