Crossfire Server, Trunk
MessageWriter.cpp
Go to the documentation of this file.
1
/*
2
* Crossfire -- cooperative multi-player graphical RPG and adventure game
3
*
4
* Copyright (c) 2020 the Crossfire Development Team
5
*
6
* Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7
* welcome to redistribute it under certain conditions. For details, please
8
* see COPYING and LICENSE.
9
*
10
* The authors can be reached via e-mail at <crossfire@metalforge.org>.
11
*/
12
13
#include "
MessageWriter.h
"
14
15
void
MessageWriter::write
(
const
GeneralMessage
*
message
,
StringBuffer
*
buf
) {
16
if
(
message
->identifier[0] ==
'\n'
) {
17
stringbuffer_append_string
(
buf
,
"MSG\n"
);
18
}
else
{
19
stringbuffer_append_printf
(
buf
,
"MSG %s\n"
,
message
->identifier);
20
}
21
if
(
message
->title) {
22
stringbuffer_append_printf
(
buf
,
"TITLE %s\n"
,
message
->title);
23
}
24
if
(
message
->chance) {
25
stringbuffer_append_printf
(
buf
,
"CHANCE %d\n"
,
message
->chance);
26
}
27
if
(
message
->quest_code) {
28
stringbuffer_append_printf
(
buf
,
"QUEST %s\n"
,
message
->quest_code);
29
}
30
if
(
message
->face) {
31
stringbuffer_append_printf
(
buf
,
"FACE %s\n"
,
message
->face->name);
32
}
33
if
(
message
->message) {
34
stringbuffer_append_string
(
buf
,
"TEXT\n"
);
35
stringbuffer_append_string
(
buf
,
message
->message);
36
}
37
stringbuffer_append_string
(
buf
,
"ENDMSG\n"
);
38
}
GeneralMessage
Definition:
book.h:44
stringbuffer_append_printf
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Definition:
stringbuffer.cpp:138
MessageWriter.h
buf
StringBuffer * buf
Definition:
readable.cpp:1565
stringbuffer_append_string
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Definition:
stringbuffer.cpp:95
MessageWriter::write
virtual void write(const GeneralMessage *message, StringBuffer *buf)
Definition:
MessageWriter.cpp:15
StringBuffer
Definition:
stringbuffer.cpp:25
diamondslots.message
string message
Definition:
diamondslots.py:57
crossfire-crossfire-server
common
assets
MessageWriter.cpp
Generated by
1.8.17