42#define log_featured_text log_verbose
44#define text_tag_list_rev_iterate(tags, ptag) \
45 TYPED_LIST_ITERATE_REV(struct text_tag, tags, ptag)
46#define text_tag_list_rev_iterate_end LIST_ITERATE_REV_END
199 if (end -
buf_in + 1 > 0) {
230 ptag->start_offset = start_offset;
242 sizeof(
ptag->color.foreground))
244 sizeof(
ptag->color.foreground))) {
245 ptag->color.foreground[0] =
'\0';
248 sizeof(
ptag->color.background))
250 sizeof(
ptag->color.background))) {
251 ptag->color.background[0] =
'\0';
264 "target link type not set.");
268 ptag->link.type = -1;
275 if (
ptag->link.type == -1) {
277 "target link type not supported (\"%s\").",
buf);
281 switch (
ptag->link.type) {
286 "city link without id.");
291 "city link without valid id (\"%s\").",
buf);
296 sizeof(
ptag->link.name))) {
299 "CITY_ID%d",
ptag->link.id);
310 "tile link without x coordinate.");
315 "tile link without valid x coordinate "
322 "tile link without y coordinate.");
327 "tile link without valid y coordinate "
335 "(%d, %d) are not valid coordinates "
336 "in this game.",
x,
y);
348 "unit link without id.");
353 "unit link without valid id (\"%s\").",
buf);
358 sizeof(
ptag->link.name))) {
361 "UNIT_ID%d",
ptag->link.id);
393 ptag->start_offset = start_offset;
394 ptag->stop_offset = stop_offset;
414 ptag->color.foreground[0] =
'\0';
420 ptag->color.background[0] =
'\0';
427 switch (
ptag->link.type) {
435 ptag->link.id = pcity->
id;
474 switch (
ptag->type) {
486 if (
ptag->color.foreground[0] !=
'\0') {
488 ptag->color.foreground);
490 if (
ptag->color.background[0] !=
'\0') {
492 ptag->color.background);
502 switch (
ptag->link.type) {
509 " id=%d name=\"%s\"",
513 " id=%d",
ptag->link.id);
526 " id=%d",
ptag->link.id);
536 " id=%d name=\"%s\"",
540 " id=%d",
ptag->link.id);
546 if (
ptag->stop_offset ==
ptag->start_offset) {
585 switch (
ptag->link.type) {
698 return ptag->start_offset;
706 return ptag->stop_offset;
716 log_error(
"text_tag_color_foreground(): incompatible tag type.");
720 return ptag->color.foreground;
730 log_error(
"text_tag_color_background(): incompatible tag type.");
734 return ptag->color.background;
744 log_error(
"text_tag_link_type(): incompatible tag type.");
748 return ptag->link.type;
759 log_error(
"text_tag_link_id(): incompatible tag type.");
763 return ptag->link.id;
777 const char *end = stop;
846 if (end -
buf_in + 2 > 0) {
const char * city_name_get(const struct city *pcity)
#define city_tile(_pcity_)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
static bool text_tag_init_from_sequence(struct text_tag *ptag, enum text_tag_type type, ft_offset_t start_offset, const char *sequence)
const struct ft_color ftc_chat_private
size_t featured_text_apply_tag(const char *text_source, char *featured_text, size_t featured_text_len, enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
const struct ft_color ftc_luaconsole_debug
static bool find_option(const char *buf_in, const char *option, char *buf_out, size_t write_len)
const struct ft_color ftc_vote_abstain
enum text_link_type text_tag_link_type(const struct text_tag *ptag)
const struct ft_color ftc_log
const struct ft_color ftc_player_lost
const char * city_tile_link(const struct city *pcity)
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_luaconsole_verbose
struct text_tag * text_tag_copy(const struct text_tag *ptag)
#define text_tag_list_rev_iterate(tags, ptag)
const char * tile_link(const struct tile *ptile)
const struct ft_color ftc_command
ft_offset_t text_tag_stop_offset(const struct text_tag *ptag)
static bool text_tag_initv(struct text_tag *ptag, enum text_tag_type type, ft_offset_t start_offset, ft_offset_t stop_offset, va_list args)
const struct ft_color ftc_server
const struct ft_color ftc_vote_failed
void text_tag_destroy(struct text_tag *ptag)
const struct ft_color ftc_vote_yes
static size_t text_tag_start_sequence(const struct text_tag *ptag, char *buf, size_t len)
const struct ft_color ftc_luaconsole_error
const struct ft_color ftc_warning
const char * text_tag_color_foreground(const struct text_tag *ptag)
#define text_tag_list_rev_iterate_end
static const char * text_link_type_name(enum text_link_type type)
const struct ft_color ftc_client
const struct ft_color ftc_luaconsole_normal
const struct ft_color ftc_editor
static const char * text_tag_type_name(enum text_tag_type type)
static size_t text_tag_replace_text(const struct text_tag *ptag, char *buf, size_t len, bool replace_link_text)
const char * city_link(const struct city *pcity)
const struct ft_color ftc_any
const struct ft_color ftc_vote_no
const struct ft_color ftc_vote_passed
VAR_ARG_CONST struct ft_color ftc_changed
#define log_featured_text
static size_t text_tag_stop_sequence(const struct text_tag *ptag, char *buf, size_t len)
const struct ft_color ftc_luaconsole_warn
static size_t extract_sequence_text(const char *featured_text, char *buf, size_t len, enum sequence_type *seq_type, enum text_tag_type *type)
int text_tag_link_id(const struct text_tag *ptag)
const struct ft_color ftc_chat_luaconsole
static const char * text_tag_type_short_name(enum text_tag_type type)
ft_offset_t text_tag_start_offset(const struct text_tag *ptag)
struct text_tag * text_tag_new(enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
const struct ft_color ftc_vote_team
const struct ft_color ftc_game_start
const char * unit_link(const struct unit *punit)
const struct ft_color ftc_server_prompt
const struct ft_color ftc_vote_public
const char * unit_tile_link(const struct unit *punit)
const char * text_tag_color_background(const struct text_tag *ptag)
const struct ft_color ftc_luaconsole_input
const struct ft_color ftc_chat_public
const struct ft_color ftc_chat_ally
#define text_tag_list_iterate_end
#define text_tag_list_iterate(tags, ptag)
#define text_tag_list_new()
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
#define log_error(message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
bool str_to_int(const char *str, int *pint)
char background[MAX_LEN_STR]
struct text_tag::@26::@28 color
char foreground[MAX_LEN_STR]
struct text_tag::@26::@29 link
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
#define sz_strlcpy(dest, src)
const char * unit_name_translation(const struct unit *punit)