Include less things from macros.h

This commit is contained in:
Marc Gilleron 2022-04-09 00:51:52 +01:00
parent ca83c720ff
commit 5afab83cd6
3 changed files with 19 additions and 2 deletions

View File

@ -7,7 +7,9 @@
#include "../../util/profiling_clock.h"
#include "voxel_graph_node_db.h"
#include <core/config/engine.h>
#include <core/core_string_names.h>
#include <core/io/image.h>
namespace zylann::voxel {

9
util/macros.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <core/os/os.h>
namespace zylann {
bool is_verbose_output_enabled() {
return OS::get_singleton()->is_stdout_verbose();
}
} // namespace zylann

View File

@ -1,12 +1,12 @@
#ifndef VOXEL_MACROS_H
#define VOXEL_MACROS_H
#include <core/os/os.h>
#include <core/string/print_string.h>
// print_verbose() is used everywhere in the engine, but its drawback is that even if you turn it off, strings
// you print are still allocated and formatted, to not be used. This macro avoids the string.
#define ZN_PRINT_VERBOSE(msg) \
if (OS::get_singleton()->is_stdout_verbose()) { \
if (is_verbose_output_enabled()) { \
print_line(msg); \
}
@ -24,4 +24,10 @@
#define ZN_TTR(msg) msg
#endif
namespace zylann {
bool is_verbose_output_enabled();
} // namespace zylann
#endif // VOXEL_MACROS_H