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
202 if (end -
buf_in + 1 > 0) {
233 ptag->start_offset = start_offset;
245 sizeof(
ptag->color.foreground))
247 sizeof(
ptag->color.foreground))) {
248 ptag->color.foreground[0] =
'\0';
251 sizeof(
ptag->color.background))
253 sizeof(
ptag->color.background))) {
254 ptag->color.background[0] =
'\0';
267 "target link type not set.");
271 ptag->link.type = -1;
278 if (
ptag->link.type == -1) {
280 "target link type not supported (\"%s\").",
buf);
284 switch (
ptag->link.type) {
289 "city link without id.");
294 "city link without valid id (\"%s\").",
buf);
299 sizeof(
ptag->link.name))) {
302 "CITY_ID%d",
ptag->link.id);
313 "tile link without x coordinate.");
318 "tile link without valid x coordinate "
325 "tile link without y coordinate.");
330 "tile link without valid y coordinate "
338 "(%d, %d) are not valid coordinates "
339 "in this game.",
x,
y);
351 "unit link without id.");
356 "unit link without valid id (\"%s\").",
buf);
361 sizeof(
ptag->link.name))) {
364 "UNIT_ID%d",
ptag->link.id);
396 ptag->start_offset = start_offset;
397 ptag->stop_offset = stop_offset;
409 if ((
color.foreground ==
nullptr ||
color.foreground[0] ==
'\0')
410 && (
color.background ==
nullptr ||
color.background[0] ==
'\0')) {
414 if (
color.foreground !=
nullptr &&
color.foreground[0] !=
'\0') {
417 ptag->color.foreground[0] =
'\0';
420 if (
color.background !=
nullptr &&
color.background[0] !=
'\0') {
423 ptag->color.background[0] =
'\0';
430 switch (
ptag->link.type) {
477 switch (
ptag->type) {
489 if (
ptag->color.foreground[0] !=
'\0') {
491 ptag->color.foreground);
493 if (
ptag->color.background[0] !=
'\0') {
495 ptag->color.background);
505 switch (
ptag->link.type) {
512 " id=%d name=\"%s\"",
516 " id=%d",
ptag->link.id);
529 " id=%d",
ptag->link.id);
539 " id=%d name=\"%s\"",
543 " id=%d",
ptag->link.id);
549 if (
ptag->stop_offset ==
ptag->start_offset) {
588 switch (
ptag->link.type) {
671 if (
ptag ==
nullptr) {
702 return ptag->start_offset;
710 return ptag->stop_offset;
720 log_error(
"text_tag_color_foreground(): incompatible tag type.");
724 return ptag->color.foreground;
734 log_error(
"text_tag_color_background(): incompatible tag type.");
738 return ptag->color.background;
748 log_error(
"text_tag_link_type(): incompatible tag type.");
752 return ptag->link.type;
763 log_error(
"text_tag_link_id(): incompatible tag type.");
767 return ptag->link.id;
781 const char *end = stop;
787 if (stop ==
nullptr) {
850 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
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 int const struct action *paction struct unit struct city * pcity
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)
struct text_tag::@27::@30 link
char background[MAX_LEN_STR]
struct text_tag::@27::@29 color
char foreground[MAX_LEN_STR]
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)