Project

General

Profile

Feature #572 » 0064-Manual-Add-Unit-Classes-page.patch

main - Marko Lindqvist, 05/09/2024 03:51 AM

View differences:

client/gui-gtk-3.22/helpdlg.c
utype_name_translation(utype->obsoleted_by));
}
helptext_unit(buf, sizeof(buf), client.conn.playing, pitem->text, utype);
helptext_unit(buf, sizeof(buf), client.conn.playing, pitem->text, utype,
TRUE);
gtk_text_buffer_set_text(help_text, buf, -1);
gtk_widget_show(help_text_sw);
client/gui-gtk-4.0/helpdlg.c
utype_name_translation(utype->obsoleted_by));
}
helptext_unit(buf, sizeof(buf), client_player(), pitem->text, utype);
helptext_unit(buf, sizeof(buf), client_player(), pitem->text, utype,
TRUE);
gtk_text_buffer_set_text(help_text, buf, -1);
gtk_widget_set_visible(help_text_sw, TRUE);
client/gui-gtk-5.0/helpdlg.c
utype_name_translation(utype->obsoleted_by));
}
helptext_unit(buf, sizeof(buf), client_player(), pitem->text, utype);
helptext_unit(buf, sizeof(buf), client_player(), pitem->text, utype,
TRUE);
gtk_text_buffer_set_text(help_text, buf, -1);
gtk_widget_set_visible(help_text_sw, TRUE);
client/gui-qt/citydlg.cpp
buf2[0] = '\0';
str = helptext_unit(buffer, sizeof(buffer), client_player(),
buf2, utype);
buf2, utype, TRUE);
str = cut_helptext(str);
str = split_text(str, true);
str = str.trimmed().toHtmlEscaped();
......
} else if (VUT_UTYPE == target->kind) {
def_str = get_tooltip_unit(target->value.utype);
str = helptext_unit(buffer, sizeof(buffer), pplayer,
buf2, target->value.utype);
buf2, target->value.utype, TRUE);
} else {
if (!is_convert_improvement(target->value.building)) {
def_str = get_tooltip_improvement(target->value.building);
client/gui-qt/helpdlg.cpp
utype = unit_type_by_translated_name(title);
if (utype) {
helptext_unit(buffer, sizeof(buffer), client.conn.playing,
topic->text, utype);
topic->text, utype, TRUE);
text_browser->setPlainText(buffer);
// Create information panel
client/gui-qt/repodlgs.cpp
} else if (rttp->tunit != nullptr) {
def_str = get_tooltip_unit(rttp->tunit);
tt_text += helptext_unit(buffer, sizeof(buffer), pplayer,
buf2, rttp->tunit);
buf2, rttp->tunit, TRUE);
tt_text = cut_helptext(tt_text);
} else if (rttp->tgov != nullptr) {
helptext_government(buffer, sizeof(buffer), pplayer,
client/gui-sdl2/helpdlg.c
start_x = (area.x + 1 + scrollbar_width + help_dlg->active_widget_list->size.w + adj_size(20));
buffer[0] = '\0';
helptext_unit(buffer, sizeof(buffer), client.conn.playing, "", utype_by_number(type_id));
helptext_unit(buffer, sizeof(buffer), client.conn.playing, "", utype_by_number(type_id),
TRUE);
if (buffer[0] != '\0') {
utf8_str *ustr = create_utf8_from_char_fonto(buffer, FONTO_ATTENTION);
client/gui-sdl3/helpdlg.c
start_x = (area.x + 1 + scrollbar_width + help_dlg->active_widget_list->size.w + adj_size(20));
buffer[0] = '\0';
helptext_unit(buffer, sizeof(buffer), client.conn.playing, "", utype_by_number(type_id));
helptext_unit(buffer, sizeof(buffer), client.conn.playing, "", utype_by_number(type_id),
TRUE);
if (buffer[0] != '\0') {
utf8_str *ustr = create_utf8_from_char_fonto(buffer, FONTO_ATTENTION);
client/helpdata.c
@param buf Buffer to append help text to
@param bufsz Size of the buffer
****************************************************************************/
static void helptext_unitclass(struct unit_class *pclass,
char *buf, size_t bufsz)
void helptext_unitclass(struct unit_class *pclass, char *buf, size_t bufsz)
{
int flagid;
......
pplayer may be NULL.
****************************************************************************/
char *helptext_unit(char *buf, size_t bufsz, struct player *pplayer,
const char *user_text, const struct unit_type *utype)
const char *user_text, const struct unit_type *utype,
bool class_help)
{
bool has_vet_levels;
int flagid;
......
BULLET,
uclass_name_translation(pclass));
helptext_unitclass(pclass, buf, bufsz);
if (class_help) {
helptext_unitclass(pclass, buf, bufsz);
} else {
cat_snprintf(buf, bufsz, "\n");
}
if (uclass_has_flag(pclass, UCF_ZOC)
&& !utype_has_flag(utype, UTYF_IGZOC)) {
client/helpdata.h
char *helptext_building(char *buf, size_t bufsz, struct player *pplayer,
const char *user_text, const struct impr_type *pimprove);
char *helptext_unit(char *buf, size_t bufsz, struct player *pplayer,
const char *user_text, const struct unit_type *utype);
const char *user_text, const struct unit_type *utype,
bool class_help);
void helptext_unitclass(struct unit_class *pclass, char *buf, size_t bufsz);
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer,
const char *user_text, int i);
void helptext_terrain(char *buf, size_t bufsz, struct player *pplayer,
gen_headers/enums/manual_enums.def
MANUAL_WONDERS N_("Wonders")
MANUAL_GOVS N_("Governments")
MANUAL_UNITS N_("Units")
MANUAL_UCLASS N_("Unit Classes")
MANUAL_TECHS N_("Techs")
end
meson.build
'tools/manual/manual_settings.c',
'tools/manual/manual_techs.c',
'tools/manual/manual_terrain.c',
'tools/manual/manual_uclass.c',
'tools/manual/manual_units.c',
'client/helpdata.c',
sources: [enum_targets['manual']],
tools/manual/Makefile.am
manual_settings.c \
manual_techs.c \
manual_terrain.c \
manual_uclass.c \
manual_units.c
# This is a bit of a hack. The program links in with the server lib
tools/manual/fc_manual.c
|| !manual_buildings(tag_info)
|| !manual_governments(tag_info)
|| !manual_units(tag_info)
|| !manual_uclasses(tag_info)
|| !manual_techs(tag_info)) {
return FALSE;
}
......
/* Set the default log level. */
srvarg.loglevel = LOG_NORMAL;
/* parse command-line arguments... */
/* Parse command-line arguments... */
inx = 1;
while (inx < argc) {
if ((option = get_option_malloc("--ruleset", argv, &inx, argc, TRUE))) {
......
init_our_capability();
/* must be before con_log_init() */
/* Must be before con_log_init() */
init_connections();
con_log_init(srvarg.log_filename, srvarg.loglevel,
srvarg.fatal_assertions);
/* logging available after this point */
/* Logging available after this point */
/* Get common code to treat us as a tool. */
i_am_tool();
tools/manual/fc_manual.h
bool manual_buildings(struct tag_types *tag_info);
bool manual_governments(struct tag_types *tag_info);
bool manual_units(struct tag_types *tag_info);
bool manual_uclasses(struct tag_types *tag_info);
bool manual_techs(struct tag_types *tag_info);
#ifdef __cplusplus
tools/manual/manual_uclass.c
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif
/* utility */
#include "fcintl.h"
/* common */
#include "game.h"
#include "tech.h"
/* client */
#include "helpdata.h"
/* tools/manual */
#include "fc_manual.h"
/**********************************************************************//**
Write unit classes manual page
@param tag_info Tag set to use
@return Success
**************************************************************************/
bool manual_uclasses(struct tag_types *tag_info)
{
FILE *doc;
doc = manual_start(tag_info, MANUAL_UCLASS);
if (doc == NULL) {
return FALSE;
}
/* TRANS: markup ... Freeciv version ... ruleset name ... markup */
fprintf(doc, _("%sFreeciv %s unit classes help (%s)%s\n\n"),
tag_info->title_begin, VERSION_STRING, game.control.name,
tag_info->title_end);
unit_class_iterate(uclass) {
char buf[64000];
fprintf(doc, tag_info->item_begin, "uclass", uclass_index(uclass));
fprintf(doc, "%s%s%s\n\n", tag_info->sect_title_begin,
uclass_name_translation(uclass), tag_info->sect_title_end);
fprintf(doc, tag_info->subitem_begin, "helptext");
buf[0] = '\0';
helptext_unitclass(uclass, buf, sizeof(buf));
fprintf(doc, "%s", buf);
fprintf(doc, "%s", tag_info->subitem_end);
fprintf(doc, "%s", tag_info->item_end);
} unit_class_iterate_end;
manual_finalize(tag_info, doc, MANUAL_UCLASS);
return TRUE;
}
tools/manual/manual_units.c
utype_name_translation(putype->obsoleted_by));
fprintf(doc, "%s", tag_info->subitem_end);
fprintf(doc, tag_info->subitem_begin, "helptext");
helptext_unit(buf, sizeof(buf), NULL, "", putype);
helptext_unit(buf, sizeof(buf), NULL, "", putype, FALSE);
fprintf(doc, "%s", buf);
fprintf(doc, "%s", tag_info->subitem_end);
fprintf(doc, "%s", tag_info->item_end);
(1-1/2)