Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #899322 ยป 0035-sdl2-Rename-SDL_Client_Flags-as-sdl2_client_flags.patch

Marko Lindqvist, 2020-11-23 06:42 PM

View differences:

client/gui-sdl2/citydlg.c
if (PRESSED_EVENT(main_data.event)) {
if (pEdit->string_utf8->text != NULL) {
if (strcmp(pEdit->string_utf8->text, city_name_get(pcity_dlg->pcity))) {
SDL_Client_Flags |= CF_CHANGED_CITY_NAME;
sdl2_client_flags |= CF_CHANGED_CITY_NAME;
city_rename(pcity_dlg->pcity, pEdit->string_utf8->text);
}
} else {
......
fc_snprintf(name, MAX_LEN_NAME, "%s", pcity_dlg->pcity_name_edit->string_utf8->text);
if ((strcmp(city_name_get(pcity), name) != 0)
|| (SDL_Client_Flags & CF_CHANGED_CITY_NAME)) {
|| (sdl2_client_flags & CF_CHANGED_CITY_NAME)) {
copy_chars_to_utf8_str(pcity_dlg->pcity_name_edit->string_utf8, city_name_get(pcity));
rebuild_citydlg_title_str(pcity_dlg->pEndCityWidgetList, pcity);
SDL_Client_Flags &= ~CF_CHANGED_CITY_NAME;
sdl2_client_flags &= ~CF_CHANGED_CITY_NAME;
}
}
}
......
if ((city_unhappy(pcity) || city_celebrating(pcity) || city_happy(pcity)
|| cma_is_city_under_agent(pcity, NULL))
^ ((SDL_Client_Flags & CF_CITY_STATUS_SPECIAL) == CF_CITY_STATUS_SPECIAL)) {
^ ((sdl2_client_flags & CF_CITY_STATUS_SPECIAL) == CF_CITY_STATUS_SPECIAL)) {
/* city status was changed : NORMAL <-> DISORDER, HAPPY, CELEBR. */
SDL_Client_Flags ^= CF_CITY_STATUS_SPECIAL;
sdl2_client_flags ^= CF_CITY_STATUS_SPECIAL;
#if 0
/* upd. resource map */
......
/* ===================================================== */
if ((city_unhappy(pcity) || city_celebrating(pcity)
|| city_happy(pcity))) {
SDL_Client_Flags |= CF_CITY_STATUS_SPECIAL;
sdl2_client_flags |= CF_CITY_STATUS_SPECIAL;
}
/* ===================================================== */
......
flush_dirty();
SDL_Client_Flags &= ~CF_CITY_STATUS_SPECIAL;
sdl2_client_flags &= ~CF_CITY_STATUS_SPECIAL;
menus_update();
}
}
client/gui-sdl2/gui_main.c
const char * const gui_character_encoding = "UTF-8";
const bool gui_use_transliteration = FALSE;
Uint32 SDL_Client_Flags = 0;
Uint32 sdl2_client_flags = 0;
Uint32 widget_info_counter = 0;
int MOVE_STEP_X = DEFAULT_MOVE_STEP;
......
button_behavior.hold_state = MB_HOLD_SHORT;
button_behavior.event = fc_calloc(1, sizeof(SDL_MouseButtonEvent));
SDL_Client_Flags = 0;
sdl2_client_flags = 0;
iSDL_Flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
/* auto center new windows in X enviroment */
......
is_unit_move_blocked = FALSE;
SDL_Client_Flags |= (CF_DRAW_PLAYERS_NEUTRAL_STATUS
sdl2_client_flags |= (CF_DRAW_PLAYERS_NEUTRAL_STATUS
|CF_DRAW_PLAYERS_WAR_STATUS
|CF_DRAW_PLAYERS_CEASEFIRE_STATUS
|CF_DRAW_PLAYERS_PEACE_STATUS
......
void enable_focus_animation(void)
{
pAnim_User_Event->user.code = ANIM;
SDL_Client_Flags |= CF_FOCUS_ANIMATION;
sdl2_client_flags |= CF_FOCUS_ANIMATION;
}
/**********************************************************************//**
......
**************************************************************************/
void disable_focus_animation(void)
{
SDL_Client_Flags &= ~CF_FOCUS_ANIMATION;
sdl2_client_flags &= ~CF_FOCUS_ANIMATION;
}
/**********************************************************************//**
client/gui-sdl2/gui_main.h
/* enable this to adjust sizes for 320x240 resolution */
/* #define SMALL_SCREEN */
/* SDL client Flags */
/* SDL2 client Flags */
#define CF_NONE 0
#define CF_ORDERS_WIDGETS_CREATED (1<<0)
#define CF_MAP_UNIT_W_CREATED (1<<1)
......
};
extern struct widget *selected_widget;
extern Uint32 SDL_Client_Flags;
extern Uint32 sdl2_client_flags;
extern bool LSHIFT;
extern bool RSHIFT;
extern bool LCTRL;
client/gui-sdl2/mapctrl.c
undraw_order_widgets();
}
if (SDL_Client_Flags & CF_UNITINFO_SHOWN) {
if (sdl2_client_flags & CF_UNITINFO_SHOWN) {
/* HIDE */
SDL_Surface *buf_surf;
SDL_Rect src, window_area;
......
copy_chars_to_utf8_str(pIcon_Widget->info_label,
_("Show Unit Info Window"));
SDL_Client_Flags &= ~CF_UNITINFO_SHOWN;
sdl2_client_flags &= ~CF_UNITINFO_SHOWN;
set_new_unitinfo_window_pos();
......
alphablit(current_theme->R_ARROW_Icon, NULL, pIcon_Widget->theme, NULL, 255);
SDL_Client_Flags |= CF_UNITINFO_SHOWN;
sdl2_client_flags |= CF_UNITINFO_SHOWN;
set_new_unitinfo_window_pos();
......
undraw_order_widgets();
}
if (SDL_Client_Flags & CF_OVERVIEW_SHOWN) {
if (sdl2_client_flags & CF_OVERVIEW_SHOWN) {
/* Hide MiniMap */
SDL_Surface *buf_surf;
SDL_Rect src, map_area = minimap_window->size;
......
/* make new map icon */
alphablit(current_theme->R_ARROW_Icon, NULL, pMap_Button->theme, NULL, 255);
SDL_Client_Flags &= ~CF_OVERVIEW_SHOWN;
sdl2_client_flags &= ~CF_OVERVIEW_SHOWN;
/* clear area under old map window */
widget_undraw(minimap_window);
......
copy_chars_to_utf8_str(pMap_Button->info_label, _("Hide Mini Map"));
alphablit(current_theme->L_ARROW_Icon, NULL, pMap_Button->theme, NULL, 255);
SDL_Client_Flags |= CF_OVERVIEW_SHOWN;
sdl2_client_flags |= CF_OVERVIEW_SHOWN;
minimap_window->size.w =
(minimap_window->size.w - minimap_window->area.w) + overview_w + BLOCKM_W;
......
int window_x = 0, window_y = 0;
SDL_Rect area;
if (pScale_MiniMap_Dlg || !(SDL_Client_Flags & CF_OVERVIEW_SHOWN)) {
if (pScale_MiniMap_Dlg || !(sdl2_client_flags & CF_OVERVIEW_SHOWN)) {
return;
}
......
int window_x = 0, window_y = 0;
SDL_Rect area;
if (pScale_UnitInfo_Dlg || !(SDL_Client_Flags & CF_UNITINFO_SHOWN)) {
if (pScale_UnitInfo_Dlg || !(sdl2_client_flags & CF_UNITINFO_SHOWN)) {
return;
}
......
minimap_window->area.x - overview_start_x;
mouse_y = main_data.event.motion.y - minimap_window->dst->dest_rect.y -
minimap_window->area.y - overview_start_y;
if ((SDL_Client_Flags & CF_OVERVIEW_SHOWN)
if ((sdl2_client_flags & CF_OVERVIEW_SHOWN)
&& (mouse_x >= 0) && (mouse_x < overview_w)
&& (mouse_y >= 0) && (mouse_y < overview_h)) {
int map_x, map_y;
......
struct widget *pwidget;
SDL_Rect area;
if (SDL_Client_Flags & CF_UNITINFO_SHOWN) {
if (sdl2_client_flags & CF_UNITINFO_SHOWN) {
widget_set_position(units_info_window,
main_window_width() - units_info_window->size.w,
main_window_height() - units_info_window->size.h);
......
unit_info_dlg->begin_widget_list = pwidget;
SDL_Client_Flags |= CF_UNITINFO_SHOWN;
sdl2_client_flags |= CF_UNITINFO_SHOWN;
set_new_unitinfo_window_pos();
......
if (unit_info_dlg) {
popdown_window_group_dialog(unit_info_dlg->begin_widget_list, unit_info_dlg->end_widget_list);
FC_FREE(unit_info_dlg);
SDL_Client_Flags &= ~CF_UNITINFO_SHOWN;
sdl2_client_flags &= ~CF_UNITINFO_SHOWN;
}
}
......
pMiniMap_Dlg->begin_widget_list = pwidget;
SDL_Client_Flags |= CF_OVERVIEW_SHOWN;
sdl2_client_flags |= CF_OVERVIEW_SHOWN;
set_new_minimap_window_pos();
......
if (pMiniMap_Dlg) {
popdown_window_group_dialog(pMiniMap_Dlg->begin_widget_list, pMiniMap_Dlg->end_widget_list);
FC_FREE(pMiniMap_Dlg);
SDL_Client_Flags &= ~CF_OVERVIEW_SHOWN;
sdl2_client_flags &= ~CF_OVERVIEW_SHOWN;
}
}
......
struct widget *pwidget;
SDL_Surface *pIcon_theme = NULL;
if (SDL_Client_Flags & CF_MAP_UNIT_W_CREATED) {
if (sdl2_client_flags & CF_MAP_UNIT_W_CREATED) {
return;
}
popup_minimap_window();
popup_unitinfo_window();
SDL_Client_Flags |= CF_MAP_UNIT_W_CREATED;
sdl2_client_flags |= CF_MAP_UNIT_W_CREATED;
#ifndef SMALL_SCREEN
init_options_button();
......
popdown_minimap_window();
popdown_unitinfo_window();
SDL_Client_Flags &= ~CF_MAP_UNIT_W_CREATED;
sdl2_client_flags &= ~CF_MAP_UNIT_W_CREATED;
}
/**********************************************************************//**
client/gui-sdl2/mapview.c
punit = NULL;
}
if (SDL_Client_Flags & CF_UNITINFO_SHOWN) {
if (sdl2_client_flags & CF_UNITINFO_SHOWN) {
info_window = get_unit_info_window_widget();
/* blit theme surface */
......
**************************************************************************/
static bool is_focus_anim_enabled(void)
{
return (SDL_Client_Flags & CF_FOCUS_ANIMATION) == CF_FOCUS_ANIMATION;
return (sdl2_client_flags & CF_FOCUS_ANIMATION) == CF_FOCUS_ANIMATION;
}
/**********************************************************************//**
......
struct widget *pMMap;
SDL_Rect overview_area;
if (SDL_Client_Flags & CF_OVERVIEW_SHOWN) {
if (sdl2_client_flags & CF_OVERVIEW_SHOWN) {
pMMap = get_minimap_window_widget();
overview_area = (SDL_Rect) {
client/gui-sdl2/menu.c
pBeginOrderWidgetList = buf;
SDL_Client_Flags |= CF_ORDERS_WIDGETS_CREATED;
sdl2_client_flags |= CF_ORDERS_WIDGETS_CREATED;
}
/**********************************************************************//**
......
pBeginOrderWidgetList = NULL;
pEndOrderWidgetList = NULL;
SDL_Client_Flags &= ~CF_ORDERS_WIDGETS_CREATED;
sdl2_client_flags &= ~CF_ORDERS_WIDGETS_CREATED;
}
/**********************************************************************//**
......
if ((C_S_RUNNING != client_state())
|| (get_client_page() != PAGE_GAME)) {
SDL_Client_Flags |= CF_GAME_JUST_STARTED;
sdl2_client_flags |= CF_GAME_JUST_STARTED;
if (SDL_Client_Flags & CF_MAP_UNIT_W_CREATED) {
if (sdl2_client_flags & CF_MAP_UNIT_W_CREATED) {
set_wflag(pOptions_Button, WF_HIDDEN);
hide_minimap_window_buttons();
hide_unitinfo_window_buttons();
}
if (SDL_Client_Flags & CF_ORDERS_WIDGETS_CREATED) {
if (sdl2_client_flags & CF_ORDERS_WIDGETS_CREATED) {
hide_group(pBeginOrderWidgetList, pEndOrderWidgetList);
}
} else {
/* Running state */
if (SDL_Client_Flags & CF_MAP_UNIT_W_CREATED) {
if (sdl2_client_flags & CF_MAP_UNIT_W_CREATED) {
/* show options button */
clear_wflag(pOptions_Button, WF_HIDDEN);
widget_redraw(pOptions_Button);
......
if (NULL == client.conn.playing) {
/* Global observer */
if (SDL_Client_Flags & CF_MAP_UNIT_W_CREATED) {
if (sdl2_client_flags & CF_MAP_UNIT_W_CREATED) {
/* show minimap buttons and unitinfo buttons */
show_minimap_window_buttons();
show_unitinfo_window_buttons();
......
undraw_order_widgets();
}
if (SDL_Client_Flags & CF_GAME_JUST_STARTED) {
SDL_Client_Flags &= ~CF_GAME_JUST_STARTED;
if (sdl2_client_flags & CF_GAME_JUST_STARTED) {
sdl2_client_flags &= ~CF_GAME_JUST_STARTED;
/* show minimap buttons and unitinfo buttons */
show_minimap_window_buttons();
client/gui-sdl2/plrdlg.c
/* exit button -> neutral -> war -> casefire -> peace -> alliance */
struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
SDL_Client_Flags ^= CF_DRAW_PLAYERS_WAR_STATUS;
sdl2_client_flags ^= CF_DRAW_PLAYERS_WAR_STATUS;
do {
pplayer = pplayer->prev;
FREESURFACE(pplayer->gfx);
......
/* exit button -> neutral -> war -> casefire -> peace -> alliance */
struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
SDL_Client_Flags ^= CF_DRAW_PLAYERS_CEASEFIRE_STATUS;
sdl2_client_flags ^= CF_DRAW_PLAYERS_CEASEFIRE_STATUS;
do {
pplayer = pplayer->prev;
FREESURFACE(pplayer->gfx);
......
/* exit button -> neutral -> war -> casefire -> peace -> alliance */
struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
SDL_Client_Flags ^= CF_DRAW_PLAYERS_PEACE_STATUS;
sdl2_client_flags ^= CF_DRAW_PLAYERS_PEACE_STATUS;
do {
pplayer = pplayer->prev;
FREESURFACE(pplayer->gfx);
......
/* exit button -> neutral -> war -> casefire -> peace -> alliance */
struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
SDL_Client_Flags ^= CF_DRAW_PLAYERS_ALLIANCE_STATUS;
sdl2_client_flags ^= CF_DRAW_PLAYERS_ALLIANCE_STATUS;
do {
pplayer = pplayer->prev;
FREESURFACE(pplayer->gfx);
......
/* exit button -> neutral -> war -> casefire -> peace -> alliance */
struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
SDL_Client_Flags ^= CF_DRAW_PLAYERS_NEUTRAL_STATUS;
sdl2_client_flags ^= CF_DRAW_PLAYERS_NEUTRAL_STATUS;
do {
pplayer = pplayer->prev;
FREESURFACE(pplayer->gfx);
......
switch (player_diplstate_get(pplayer,
pplayer1->data.player)->type) {
case DS_ARMISTICE:
if (SDL_Client_Flags & CF_DRAW_PLAYERS_NEUTRAL_STATUS) {
if (sdl2_client_flags & CF_DRAW_PLAYERS_NEUTRAL_STATUS) {
create_line(pplayer1->dst->surface,
dst0.x, dst0.y, dst1.x, dst1.y,
get_theme_color(COLOR_THEME_PLRDLG_ARMISTICE));
}
break;
case DS_WAR:
if (SDL_Client_Flags & CF_DRAW_PLAYERS_WAR_STATUS) {
if (sdl2_client_flags & CF_DRAW_PLAYERS_WAR_STATUS) {
create_line(pplayer1->dst->surface,
dst0.x, dst0.y, dst1.x, dst1.y,
get_theme_color(COLOR_THEME_PLRDLG_WAR));
}
break;
case DS_CEASEFIRE:
if (SDL_Client_Flags & CF_DRAW_PLAYERS_CEASEFIRE_STATUS) {
if (sdl2_client_flags & CF_DRAW_PLAYERS_CEASEFIRE_STATUS) {
create_line(pplayer1->dst->surface,
dst0.x, dst0.y, dst1.x, dst1.y,
get_theme_color(COLOR_THEME_PLRDLG_CEASEFIRE));
}
break;
case DS_PEACE:
if (SDL_Client_Flags & CF_DRAW_PLAYERS_PEACE_STATUS) {
if (sdl2_client_flags & CF_DRAW_PLAYERS_PEACE_STATUS) {
create_line(pplayer1->dst->surface,
dst0.x, dst0.y, dst1.x, dst1.y,
get_theme_color(COLOR_THEME_PLRDLG_PEACE));
}
break;
case DS_ALLIANCE:
if (SDL_Client_Flags & CF_DRAW_PLAYERS_ALLIANCE_STATUS) {
if (sdl2_client_flags & CF_DRAW_PLAYERS_ALLIANCE_STATUS) {
create_line(pplayer1->dst->surface,
dst0.x, dst0.y, dst1.x, dst1.y,
get_theme_color(COLOR_THEME_PLRDLG_ALLIANCE));
......
switch (i) {
case DS_ARMISTICE:
buf = create_checkbox(pwindow->dst,
(SDL_Client_Flags & CF_DRAW_PLAYERS_NEUTRAL_STATUS),
(sdl2_client_flags & CF_DRAW_PLAYERS_NEUTRAL_STATUS),
WF_RESTORE_BACKGROUND);
buf->action = toggle_draw_neutral_status_callback;
buf->key = SDLK_n;
break;
case DS_WAR:
buf = create_checkbox(pwindow->dst,
(SDL_Client_Flags & CF_DRAW_PLAYERS_WAR_STATUS),
(sdl2_client_flags & CF_DRAW_PLAYERS_WAR_STATUS),
WF_RESTORE_BACKGROUND);
buf->action = toggle_draw_war_status_callback;
buf->key = SDLK_w;
break;
case DS_CEASEFIRE:
buf = create_checkbox(pwindow->dst,
(SDL_Client_Flags & CF_DRAW_PLAYERS_CEASEFIRE_STATUS),
(sdl2_client_flags & CF_DRAW_PLAYERS_CEASEFIRE_STATUS),
WF_RESTORE_BACKGROUND);
buf->action = toggle_draw_ceasefire_status_callback;
buf->key = SDLK_c;
break;
case DS_PEACE:
buf = create_checkbox(pwindow->dst,
(SDL_Client_Flags & CF_DRAW_PLAYERS_PEACE_STATUS),
(sdl2_client_flags & CF_DRAW_PLAYERS_PEACE_STATUS),
WF_RESTORE_BACKGROUND);
buf->action = toggle_draw_peace_status_callback;
buf->key = SDLK_p;
break;
case DS_ALLIANCE:
buf = create_checkbox(pwindow->dst,
(SDL_Client_Flags & CF_DRAW_PLAYERS_ALLIANCE_STATUS),
(sdl2_client_flags & CF_DRAW_PLAYERS_ALLIANCE_STATUS),
WF_RESTORE_BACKGROUND);
buf->action = toggle_draw_alliance_status_callback;
buf->key = SDLK_a;
client/gui-sdl2/repodlgs.c
if (PRESSED_EVENT(main_data.event)) {
switch (pCheckBox->ID) {
case ID_CHANGE_TAXRATE_DLG_LUX_BLOCK_CHECKBOX:
SDL_Client_Flags ^= CF_CHANGE_TAXRATE_LUX_BLOCK;
sdl2_client_flags ^= CF_CHANGE_TAXRATE_LUX_BLOCK;
return -1;
case ID_CHANGE_TAXRATE_DLG_SCI_BLOCK_CHECKBOX:
SDL_Client_Flags ^= CF_CHANGE_TAXRATE_SCI_BLOCK;
sdl2_client_flags ^= CF_CHANGE_TAXRATE_SCI_BLOCK;
return -1;
default:
......
switch (pHoriz_Src->ID) {
case ID_CHANGE_TAXRATE_DLG_LUX_SCROLLBAR:
if (SDL_Client_Flags & CF_CHANGE_TAXRATE_LUX_BLOCK) {
if (sdl2_client_flags & CF_CHANGE_TAXRATE_LUX_BLOCK) {
goto END;
}
pMotion.src_rate = (int *)pHoriz_Src->data.ptr;
pMotion.pHoriz_Dst = pHoriz_Src->prev->prev->prev; /* sci */
pMotion.dst_rate = (int *)pMotion.pHoriz_Dst->data.ptr;
pMotion.tax = 100 - *pMotion.src_rate - *pMotion.dst_rate;
if ((SDL_Client_Flags & CF_CHANGE_TAXRATE_SCI_BLOCK)) {
if ((sdl2_client_flags & CF_CHANGE_TAXRATE_SCI_BLOCK)) {
if (pMotion.tax <= get_player_bonus(client.conn.playing, EFT_MAX_RATES)) {
pMotion.pHoriz_Dst = NULL; /* tax */
pMotion.dst_rate = &pMotion.tax;
......
break;
case ID_CHANGE_TAXRATE_DLG_SCI_SCROLLBAR:
if ((SDL_Client_Flags & CF_CHANGE_TAXRATE_SCI_BLOCK)) {
if ((sdl2_client_flags & CF_CHANGE_TAXRATE_SCI_BLOCK)) {
goto END;
}
pMotion.src_rate = (int *)pHoriz_Src->data.ptr;
pMotion.pHoriz_Dst = pHoriz_Src->next->next->next; /* lux */
pMotion.dst_rate = (int *)pMotion.pHoriz_Dst->data.ptr;
pMotion.tax = 100 - *pMotion.src_rate - *pMotion.dst_rate;
if (SDL_Client_Flags & CF_CHANGE_TAXRATE_LUX_BLOCK) {
if (sdl2_client_flags & CF_CHANGE_TAXRATE_LUX_BLOCK) {
if (pMotion.tax <= get_player_bonus(client.conn.playing, EFT_MAX_RATES)) {
/* tax */
pMotion.pHoriz_Dst = NULL;
......
pstr->style |= TTF_STYLE_BOLD;
buf = create_checkbox(pwindow->dst,
SDL_Client_Flags & CF_CHANGE_TAXRATE_LUX_BLOCK,
sdl2_client_flags & CF_CHANGE_TAXRATE_LUX_BLOCK,
WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL);
set_new_checkbox_theme(buf, current_theme->LOCK_Icon, current_theme->UNLOCK_Icon);
buf->info_label = pstr;
......
pstr->style |= TTF_STYLE_BOLD;
buf = create_checkbox(pwindow->dst,
SDL_Client_Flags & CF_CHANGE_TAXRATE_SCI_BLOCK,
sdl2_client_flags & CF_CHANGE_TAXRATE_SCI_BLOCK,
WF_RESTORE_BACKGROUND | WF_WIDGET_HAS_INFO_LABEL);
set_new_checkbox_theme(buf, current_theme->LOCK_Icon, current_theme->UNLOCK_Icon);
    (1-1/1)