diff options
author | Craig Robbins <kde.psych@gmail.com> | 2014-11-03 00:17:20 +1000 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2014-11-02 18:07:20 +0100 |
commit | 43bf4324d5f639f338f88a599fe862630f85f787 (patch) | |
tree | 10992a5f830caaf37ac4dc404e667cb376547de8 /src/game.cpp | |
parent | 8040806f22b9be480f13ac10f63aa9ec6c66b5b7 (diff) | |
download | minetest-43bf4324d5f639f338f88a599fe862630f85f787.tar.gz minetest-43bf4324d5f639f338f88a599fe862630f85f787.tar.bz2 minetest-43bf4324d5f639f338f88a599fe862630f85f787.zip |
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()
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/game.cpp b/src/game.cpp index 48d43c9f7..a700da8cd 100644 --- a/src/game.cpp +++ b/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 |