mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 09:05:19 +02:00
Cleanup and (mostly) document util/string.h and (very) minor refactoring
Updated: Incorporated feedback from 'kahrl' Updated: Moved MinetestApp::boolToCStr() from game.cpp into string.h renaming it bool_to_cstr()
This commit is contained in:
15
src/game.cpp
15
src/game.cpp
@@ -1386,8 +1386,6 @@ protected:
|
||||
void showOverlayMessage(const char *msg, float dtime, int percent,
|
||||
bool draw_clouds = true);
|
||||
|
||||
inline const char *boolToCStr(bool v);
|
||||
|
||||
private:
|
||||
InputHandler *input;
|
||||
|
||||
@@ -2472,7 +2470,7 @@ void MinetestApp::toggleFreeMove(float *statustext_time)
|
||||
static const wchar_t *msg[] = { L"free_move disabled", L"free_move enabled" };
|
||||
|
||||
bool free_move = !g_settings->getBool("free_move");
|
||||
g_settings->set("free_move", boolToCStr(free_move));
|
||||
g_settings->set("free_move", bool_to_cstr(free_move));
|
||||
|
||||
*statustext_time = 0;
|
||||
statustext = msg[free_move];
|
||||
@@ -2494,7 +2492,7 @@ void MinetestApp::toggleFast(float *statustext_time)
|
||||
{
|
||||
static const wchar_t *msg[] = { L"fast_move disabled", L"fast_move enabled" };
|
||||
bool fast_move = !g_settings->getBool("fast_move");
|
||||
g_settings->set("fast_move", boolToCStr(fast_move));
|
||||
g_settings->set("fast_move", bool_to_cstr(fast_move));
|
||||
|
||||
*statustext_time = 0;
|
||||
statustext = msg[fast_move];
|
||||
@@ -2508,7 +2506,7 @@ void MinetestApp::toggleNoClip(float *statustext_time)
|
||||
{
|
||||
static const wchar_t *msg[] = { L"noclip disabled", L"noclip enabled" };
|
||||
bool noclip = !g_settings->getBool("noclip");
|
||||
g_settings->set("noclip", boolToCStr(noclip));
|
||||
g_settings->set("noclip", bool_to_cstr(noclip));
|
||||
|
||||
*statustext_time = 0;
|
||||
statustext = msg[noclip];
|
||||
@@ -3937,13 +3935,6 @@ void MinetestApp::showOverlayMessage(const char *msg, float dtime,
|
||||
}
|
||||
|
||||
|
||||
inline const char *MinetestApp::boolToCStr(bool v)
|
||||
{
|
||||
static const char *str[] = { "false", "true" };
|
||||
return str[v];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Shutdown / cleanup
|
||||
|
Reference in New Issue
Block a user