Project

General

Profile

Feature #1109 ยป 0015-Replace-is_view_supported-by-gui-property.patch

Marko Lindqvist, 01/05/2025 01:36 PM

View differences:

client/gui-gtk-3.22/graphics.c
GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];
/***********************************************************************//**
Returns TRUE to indicate that gtk3.22-client supports given view type
***************************************************************************/
bool is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return TRUE;
case TS_3D:
#ifdef GTK3_3D_ENABLED
return TRUE;
#else /* GTK3_3D_ENABLED */
return FALSE;
#endif /* GTK3_3D_ENABLED */
}
return FALSE;
}
/***********************************************************************//**
Loading tileset of the specified type
***************************************************************************/
client/gui-gtk-3.22/gui_main.c
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
#ifdef GTK3_3D_ENABLED
gui_properties.views.d3 = TRUE;
#else /* GTK3_3D_ENABLED */
gui_properties.views.d3 = FALSE;
#endif /* GTK3_3D_ENABLED */
}
client/gui-gtk-4.0/graphics.c
GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];
/***********************************************************************//**
Returns TRUE to indicate that gtk4-client supports given view type
***************************************************************************/
bool is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return TRUE;
case TS_3D:
#ifdef GTK3_3D_ENABLED
return TRUE;
#else /* GTK3_3D_ENABLED */
return FALSE;
#endif /* GTK3_3D_ENABLED */
}
return FALSE;
}
/***********************************************************************//**
Loading tileset of the specified type
***************************************************************************/
client/gui-gtk-4.0/gui_main.c
void setup_gui_properties(void)
{
gui_properties.animations = TRUE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
#ifdef GTK3_3D_ENABLED
gui_properties.views.d3 = TRUE;
#else /* GTK3_3D_ENABLED */
gui_properties.views.d3 = FALSE;
#endif /* GTK3_3D_ENABLED */
}
client/gui-gtk-5.0/graphics.c
GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];
/***********************************************************************//**
Returns TRUE to indicate that gtk4x-client supports given view type
***************************************************************************/
bool is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return TRUE;
case TS_3D:
#ifdef GTK3_3D_ENABLED
return TRUE;
#else /* GTK3_3D_ENABLED */
return FALSE;
#endif /* GTK3_3D_ENABLED */
}
return FALSE;
}
/***********************************************************************//**
Loading tileset of the specified type
***************************************************************************/
client/gui-gtk-5.0/gui_main.c
void setup_gui_properties(void)
{
gui_properties.animations = TRUE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
#ifdef GTK3_3D_ENABLED
gui_properties.views.d3 = TRUE;
#else /* GTK3_3D_ENABLED */
gui_properties.views.d3 = FALSE;
#endif /* GTK3_3D_ENABLED */
}
client/gui-qt/graphics.cpp
#include "graphics.h"
#include "qtg_cxxside.h"
/************************************************************************//**
Return whether the client supports given view type.
****************************************************************************/
bool qtg_is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return true;
case TS_3D:
return false;
}
return false;
}
/************************************************************************//**
Loading tileset of the specified type
****************************************************************************/
client/gui-qt/gui_main.cpp
void qtg_setup_gui_properties()
{
gui_properties.animations = FALSE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
gui_properties.views.d3 = FALSE;
}
client/gui-qt/qtg_cxxside.cpp
funcs->version_message = qtg_version_message;
funcs->real_output_window_append = qtg_real_output_window_append;
funcs->is_view_supported = qtg_is_view_supported;
funcs->tileset_type_set = qtg_tileset_type_set;
funcs->load_gfxfile = qtg_load_gfxfile;
funcs->load_gfxnumber = qtg_load_gfxnumber;
client/gui-qt/qtg_cxxside.h
const struct text_tag_list *tags,
int conn_id);
bool qtg_is_view_supported(enum ts_type type);
void qtg_tileset_type_set(enum ts_type type);
struct sprite *qtg_load_gfxfile(const char *filename, bool svgflag);
struct sprite *qtg_load_gfxnumber(int num);
client/gui-sdl2/graphics.c
/* ============ Freeciv game graphics function =========== */
/**********************************************************************//**
Return whether the client supports given view type
**************************************************************************/
bool is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return TRUE;
case TS_3D:
return FALSE;
}
return FALSE;
}
/**********************************************************************//**
Loading tileset of the specified type
**************************************************************************/
client/gui-sdl2/gui_main.c
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
gui_properties.views.d3 = FALSE;
}
client/gui-sdl3/graphics.c
/* ============ Freeciv game graphics function =========== */
/**********************************************************************//**
Return whether the client supports given view type
**************************************************************************/
bool is_view_supported(enum ts_type type)
{
switch (type) {
case TS_ISOMETRIC:
case TS_OVERHEAD:
return TRUE;
case TS_3D:
return FALSE;
}
return FALSE;
}
/**********************************************************************//**
Loading tileset of the specified type
**************************************************************************/
client/gui-sdl3/gui_main.c
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
gui_properties.views.isometric = TRUE;
gui_properties.views.overhead = TRUE;
gui_properties.views.d3 = FALSE;
}
client/gui-stub/graphics.c
#include "graphics.h"
/************************************************************************//**
Return whether the client supports given view type
****************************************************************************/
bool gui_is_view_supported(enum ts_type type)
{
/* PORTME */
return FALSE;
}
/************************************************************************//**
Loading tileset of the specified type
****************************************************************************/
client/gui_cbsetter.c
funcs->version_message = gui_version_message;
funcs->real_output_window_append = gui_real_output_window_append;
funcs->is_view_supported = gui_is_view_supported;
funcs->load_gfxfile = gui_load_gfxfile;
funcs->create_sprite = gui_create_sprite;
funcs->get_sprite_dimensions = gui_get_sprite_dimensions;
client/gui_interface.c
funcs.insert_client_build_info(outbuf, outlen);
}
/**********************************************************************//**
Call is_view_supported callback
**************************************************************************/
bool is_view_supported(enum ts_type type)
{
return funcs.is_view_supported(type);
}
/**********************************************************************//**
Call tileset_type_set callback
**************************************************************************/
client/gui_interface.h
const struct text_tag_list *tags,
int conn_id);
bool (*is_view_supported)(enum ts_type type);
void (*tileset_type_set)(enum ts_type type);
struct sprite * (*load_gfxfile)(const char *filename, bool svgflag);
struct sprite * (*load_gfxnumber)(int num);
client/gui_properties.h
struct client_properties {
bool animations;
struct {
bool isometric;
bool overhead;
bool d3;
} views;
};
extern struct client_properties gui_properties;
client/include/graphics_g.h
#include "gui_proto_constructor.h"
GUI_FUNC_PROTO(bool, is_view_supported, enum ts_type type)
GUI_FUNC_PROTO(void, tileset_type_set, enum ts_type type)
GUI_FUNC_PROTO(void, load_cursors, void)
#endif /* FC__GRAPHICS_G_H */
#endif /* FC__GRAPHICS_G_H */
client/tilespec.c
bool svg;
enum spec_file_types slist_type;
const char *type_name;
bool vsup;
fname = tilespec_fullname(tileset_name);
......
t->ts_topo_idx = ts_topology_index(topo);
if (!is_view_supported(t->type)) {
switch (t->type) {
case TS_ISOMETRIC:
vsup = gui_properties.views.isometric;
break;
case TS_OVERHEAD:
vsup = gui_properties.views.overhead;
break;
case TS_3D:
vsup = gui_properties.views.d3;
break;
}
if (!vsup) {
/* TRANS: "Overhead" or "Isometric" */
log_normal(_("Client does not support %s tilesets."),
_(ts_type_name(t->type)));
    (1-1/1)