Freeciv-3.3
Loading...
Searching...
No Matches
luaconsole_common.c
Go to the documentation of this file.
1/*****************************************************************************
2 Freeciv - Copyright (C) 2002 - R. Falke
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*****************************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdarg.h>
19#include <string.h>
20
21/* utility */
22#include "fcintl.h"
23#include "mem.h"
24
25/* common */
26#include "featured_text.h"
27
28/* include */
29#include "luaconsole_g.h"
30
31/* client */
32#include "luaconsole_common.h"
33
34
35
36/*************************************************************************/
41 const char *featured_text)
42{
44 struct text_tag_list *tags;
45
46 /* Separate the text and the tags. */
48 sizeof(plain_text), &tags, TRUE);
49
51 /* A color is requested. */
53 color);
54
55 if (ptag) {
56 /* Prepends to the list, to avoid to overwrite inside colors. */
58 } else {
59 log_error("Failed to create a color text tag (fg = %s, bg = %s).",
60 (NULL != color.foreground ? color.foreground : "NULL"),
61 (NULL != color.background ? color.background : "NULL"));
62 }
63 }
64
67}
68
69/*************************************************************************/
74 const char *format, va_list args)
75{
77
78 fc_vsnprintf(featured_text, sizeof(featured_text), format, args);
80}
81
82
83/*************************************************************************/
88 const char *format, ...)
89{
90 va_list args;
91
92 va_start(args, format);
93 luaconsole_vprintf(color, format, args);
94 va_end(args);
95}
96
97/*************************************************************************/
101 const struct text_tag_list *tags)
102{
104}
105
106/*************************************************************************/
110{
111 luaconsole_append(ftc_any, _("This is the Client Lua Console."));
112}
char * incite_cost
Definition comments.c:76
#define MAX_LEN_MSG
Definition conn_types.h:37
#define _(String)
Definition fcintl.h:67
size_t featured_text_to_plain_text(const char *featured_text, char *plain_text, size_t plain_text_len, struct text_tag_list **tags, bool replace_link_text)
const struct ft_color ftc_any
struct text_tag * text_tag_new(enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
#define FT_OFFSET_UNSET
static bool ft_color_requested(const struct ft_color color)
@ TTT_COLOR
void real_luaconsole_append(const char *astring, const struct text_tag_list *tags)
Definition luaconsole.c:459
#define log_error(message,...)
Definition log.h:104
void luaconsole_vprintf(const struct ft_color color, const char *format, va_list args)
void luaconsole_welcome_message(void)
void luaconsole_event(const char *plain_text, const struct text_tag_list *tags)
void luaconsole_append(const struct ft_color color, const char *featured_text)
void luaconsole_printf(const struct ft_color color, const char *format,...)
Definition colors.h:21
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
Definition support.c:886
#define TRUE
Definition support.h:46