forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages.h
75 lines (67 loc) · 2.06 KB
/
messages.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#ifndef CATA_SRC_MESSAGES_H
#define CATA_SRC_MESSAGES_H
#include <cstddef>
#include <string>
#include <utility>
#include <vector>
#include "cached_options.h"
#include "string_formatter.h"
#include "enums.h"
#include "debug.h"
class JsonOut;
class JsonObject;
class translation;
namespace catacurses
{
class window;
} // namespace catacurses
namespace Messages
{
std::vector<std::pair<std::string, std::string>> recent_messages( size_t count );
void add_msg( std::string msg );
void add_msg( const game_message_params ¶ms, std::string msg );
void clear_messages();
void deactivate();
size_t size();
bool has_undisplayed_messages();
void display_messages();
void display_messages( const catacurses::window &ipk_target, int left, int top, int right,
int bottom );
void serialize( JsonOut &json );
void deserialize( const JsonObject &json );
} // namespace Messages
void add_msg( std::string msg );
template<typename ...Args>
inline void add_msg( const std::string &msg, Args &&... args )
{
return add_msg( string_format( msg, std::forward<Args>( args )... ) );
}
template<typename ...Args>
inline void add_msg( const char *const msg, Args &&... args )
{
return add_msg( string_format( msg, std::forward<Args>( args )... ) );
}
template<typename ...Args>
inline void add_msg( const translation &msg, Args &&... args )
{
return add_msg( string_format( msg, std::forward<Args>( args )... ) );
}
void add_msg( const game_message_params ¶ms, std::string msg );
template<typename ...Args>
inline void add_msg( const game_message_params ¶ms, const std::string &msg, Args &&... args )
{
if( params.type == m_debug && !debug_mode ) {
return;
}
return add_msg( params, string_format( msg, std::forward<Args>( args )... ) );
}
template<typename ...Args>
inline void add_msg( const game_message_params ¶ms, const char *const msg, Args &&... args )
{
if( params.type == m_debug && !debug_mode ) {
return;
}
return add_msg( params, string_format( msg, std::forward<Args>( args )... ) );
}
#endif // CATA_SRC_MESSAGES_H