Use enum for console priorities
This commit is contained in:
parent
297746024b
commit
0f57787601
|
@ -19,12 +19,15 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
/* Priority levels */
|
||||
#define CON_CRITICAL -3
|
||||
#define CON_URGENT -2
|
||||
#define CON_HUD -1
|
||||
#define CON_NORMAL 0
|
||||
#define CON_VERBOSE 1
|
||||
#define CON_DEBUG 2
|
||||
enum con_priority
|
||||
{
|
||||
CON_CRITICAL = -3,
|
||||
CON_URGENT,
|
||||
CON_HUD,
|
||||
CON_NORMAL,
|
||||
CON_VERBOSE,
|
||||
CON_DEBUG
|
||||
};
|
||||
|
||||
#define CON_LINES_ONSCREEN 18
|
||||
#define CON_SCROLL_OFFSET (CON_LINES_ONSCREEN - 3)
|
||||
|
@ -43,15 +46,15 @@ struct console_buffer
|
|||
};
|
||||
|
||||
void con_init(void);
|
||||
void con_puts(int level, char *str, size_t len) __attribute_nonnull();
|
||||
void con_puts(int level, const char *str, size_t len) __attribute_nonnull();
|
||||
void con_puts(con_priority level, char *str, size_t len) __attribute_nonnull();
|
||||
void con_puts(con_priority level, const char *str, size_t len) __attribute_nonnull();
|
||||
template <size_t len>
|
||||
static inline void con_puts_literal(int level, const char (&str)[len])
|
||||
static inline void con_puts_literal(const con_priority level, const char (&str)[len])
|
||||
{
|
||||
con_puts(level, str, len - 1);
|
||||
}
|
||||
#define con_puts(A1,S,...) (con_puts(A1,S, _dxx_call_puts_parameter2(1, ## __VA_ARGS__, strlen(S))))
|
||||
void con_printf(int level, const char *fmt, ...) __attribute_format_printf(2, 3);
|
||||
void con_printf(con_priority level, const char *fmt, ...) __attribute_format_printf(2, 3);
|
||||
#ifdef DXX_CONSTANT_TRUE
|
||||
#define DXX_CON_PRINTF_CHECK_TRAILING_NEWLINE(F) \
|
||||
(DXX_CONSTANT_TRUE(sizeof((F)) > 1 && (F)[sizeof((F)) - 2] == '\n') && \
|
||||
|
|
|
@ -38,7 +38,7 @@ static RAIIPHYSFS_File gamelog_fp;
|
|||
static array<console_buffer, CON_LINES_MAX> con_buffer;
|
||||
static int con_state = CON_STATE_CLOSED, con_scroll_offset = 0, con_size = 0;
|
||||
|
||||
static void con_add_buffer_line(int priority, const char *buffer, size_t len)
|
||||
static void con_add_buffer_line(const con_priority priority, const char *const buffer, const size_t len)
|
||||
{
|
||||
/* shift con_buffer for one line */
|
||||
std::move(std::next(con_buffer.begin()), con_buffer.end(), con_buffer.begin());
|
||||
|
@ -50,7 +50,7 @@ static void con_add_buffer_line(int priority, const char *buffer, size_t len)
|
|||
memcpy(&c.line,buffer, copy);
|
||||
}
|
||||
|
||||
void (con_printf)(int priority, const char *fmt, ...)
|
||||
void (con_printf)(const con_priority priority, const char *const fmt, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
char buffer[CON_LINE_LENGTH];
|
||||
|
@ -106,7 +106,7 @@ static void con_print_file(const char *buffer)
|
|||
}
|
||||
}
|
||||
|
||||
void con_puts(int priority, char *buffer, size_t len)
|
||||
void con_puts(const con_priority priority, char *const buffer, const size_t len)
|
||||
{
|
||||
if (priority <= CGameArg.DbgVerbose)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ void con_puts(int priority, char *buffer, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
void con_puts(int priority, const char *buffer, size_t len)
|
||||
void con_puts(const con_priority priority, const char *const buffer, const size_t len)
|
||||
{
|
||||
if (priority <= CGameArg.DbgVerbose)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue