forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simmesg.h
88 lines (69 loc) · 1.64 KB
/
simmesg.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
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef simmesg_h
#define simmesg_h
#include "simtypes.h"
#include "gui/gui_theme.h"
#include "display/simimg.h"
#include "dataobj/koord.h"
#include "tpl/slist_tpl.h"
class karte_t;
class karte_ptr_t;
/* class for a simple message
* this way they are stored in a list
* @author prissi
*/
class message_t
{
public:
class node {
public:
char msg[256];
sint32 type;
koord pos;
FLAGGED_PIXVAL color;
image_id image;
sint32 time;
void rdwr(loadsave_t *file);
uint32 get_type_shifted() const { return 1<<(type & ~local_flag); }
FLAGGED_PIXVAL get_player_color(karte_t*) const;
};
enum msg_typ {
general=0,
ai=1,
city=2,
problems=3,
industry=4,
chat=5,
new_vehicle=6,
full=7,
warnings=8,
traffic_jams=9,
scenario=10,
MAX_MESSAGE_TYPE,
local_flag = 0x8000u
};
void add_message( const char *text, koord pos, uint16 what, FLAGGED_PIXVAL color=SYSCOL_TEXT, image_id image=IMG_EMPTY );
/* determines, which message is displayed where */
void get_message_flags( sint32 *t, sint32 *w, sint32 *a, sint32 *i);
void set_message_flags( sint32, sint32, sint32, sint32 );
message_t();
~message_t();
private:
static karte_ptr_t welt;
// bitfields that contains the messages
sint32 ticker_flags;
sint32 win_flags;
sint32 auto_win_flags;
sint32 ignore_flags;
slist_tpl<node *> list;
public:
const slist_tpl<node *> &get_list() const { return list; }
void clear();
void rotate90( sint16 size_w );
void rdwr( loadsave_t *file );
/**
* Returns first valid coordinate from text (or koord::invalid if none is found).
* syntax: either @x,y or (x,y)
*/
static koord get_coord_from_text(const char* text);
};
#endif