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 #903449 ยป 0044-sdl2-Rename-pTmp-to-adhere-with-coding-style.patch

Marko Lindqvist, 2020-12-05 01:46 PM

View differences:

client/gui-sdl2/dialogs.c
**************************************************************************/
static void change_nation_label(void)
{
SDL_Surface *pTmp_Surf, *pTmp_Surf_zoomed;
SDL_Surface *tmp_surf, *tmp_surf_zoomed;
struct widget *pwindow = nation_dlg->end_widget_list;
struct NAT *setup = (struct NAT *)(pwindow->data.ptr);
struct widget *label = setup->name_edit->next;
struct nation_type *pNation = nation_by_number(setup->nation);
pTmp_Surf = get_nation_flag_surface(pNation);
pTmp_Surf_zoomed = zoomSurface(pTmp_Surf, DEFAULT_ZOOM * 1.0, DEFAULT_ZOOM * 1.0, 1);
tmp_surf = get_nation_flag_surface(pNation);
tmp_surf_zoomed = zoomSurface(tmp_surf, DEFAULT_ZOOM * 1.0, DEFAULT_ZOOM * 1.0, 1);
FREESURFACE(label->theme);
label->theme = pTmp_Surf_zoomed;
label->theme = tmp_surf_zoomed;
copy_chars_to_utf8_str(label->string_utf8, nation_plural_translation(pNation));
......
utf8_str *pstr;
int len = 0;
int w = adj_size(10), h = adj_size(10);
SDL_Surface *pTmp_Surf, *pTmp_Surf_zoomed = NULL;
SDL_Surface *tmp_surf, *tmp_surf_zoomed = NULL;
SDL_Surface *pMain_Bg, *text_name;
SDL_Rect dst;
float zoom;
......
continue;
}
pTmp_Surf_zoomed = adj_surf(get_nation_flag_surface(pNation));
tmp_surf_zoomed = adj_surf(get_nation_flag_surface(pNation));
pTmp_Surf = crop_rect_from_surface(pMain_Bg, NULL);
tmp_surf = crop_rect_from_surface(pMain_Bg, NULL);
copy_chars_to_utf8_str(pstr, nation_plural_translation(pNation));
change_ptsize_utf8(pstr, adj_font(12));
text_name = create_text_surf_smaller_than_w(pstr, pTmp_Surf->w - adj_size(4));
text_name = create_text_surf_smaller_than_w(pstr, tmp_surf->w - adj_size(4));
dst.x = (pTmp_Surf->w - pTmp_Surf_zoomed->w) / 2;
len = pTmp_Surf_zoomed->h +
dst.x = (tmp_surf->w - tmp_surf_zoomed->w) / 2;
len = tmp_surf_zoomed->h +
adj_size(10) + text_name->h;
dst.y = (pTmp_Surf->h - len) / 2;
alphablit(pTmp_Surf_zoomed, NULL, pTmp_Surf, &dst, 255);
dst.y += (pTmp_Surf_zoomed->h + adj_size(10));
dst.y = (tmp_surf->h - len) / 2;
alphablit(tmp_surf_zoomed, NULL, tmp_surf, &dst, 255);
dst.y += (tmp_surf_zoomed->h + adj_size(10));
dst.x = (pTmp_Surf->w - text_name->w) / 2;
alphablit(text_name, NULL, pTmp_Surf, &dst, 255);
dst.x = (tmp_surf->w - text_name->w) / 2;
alphablit(text_name, NULL, tmp_surf, &dst, 255);
dst.y += text_name->h;
FREESURFACE(text_name);
pwidget = create_icon2(pTmp_Surf, pwindow->dst,
pwidget = create_icon2(tmp_surf, pwindow->dst,
(WF_RESTORE_BACKGROUND|WF_FREE_THEME));
set_wstate(pwidget, FC_WS_NORMAL);
......
pstr->render = 2;
pstr->fgcol = *get_theme_color(COLOR_THEME_NATIONDLG_TEXT);
pTmp_Surf_zoomed = adj_surf(get_nation_flag_surface(pnat));
tmp_surf_zoomed = adj_surf(get_nation_flag_surface(pnat));
pwidget = create_iconlabel(pTmp_Surf_zoomed, pwindow->dst, pstr,
pwidget = create_iconlabel(tmp_surf_zoomed, pwindow->dst, pstr,
(WF_ICON_ABOVE_TEXT|WF_ICON_CENTER|WF_FREE_GFX));
if (nationsets == NULL) {
buf = pwidget;
......
styles_iterate(pstyle) {
i = basic_city_style_for_style(pstyle);
pTmp_Surf = get_sample_city_surface(i);
tmp_surf = get_sample_city_surface(i);
if (pTmp_Surf->w > 48) {
zoom = DEFAULT_ZOOM * (48.0 / pTmp_Surf->w);
if (tmp_surf->w > 48) {
zoom = DEFAULT_ZOOM * (48.0 / tmp_surf->w);
}
pTmp_Surf_zoomed = zoomSurface(get_sample_city_surface(i), zoom, zoom, 0);
tmp_surf_zoomed = zoomSurface(get_sample_city_surface(i), zoom, zoom, 0);
pwidget = create_icon2(pTmp_Surf_zoomed, pwindow->dst, WF_RESTORE_BACKGROUND);
pwidget = create_icon2(tmp_surf_zoomed, pwindow->dst, WF_RESTORE_BACKGROUND);
pwidget->action = style_callback;
if (i != setup->nation_style) {
set_wstate(pwidget, FC_WS_NORMAL);
client/gui-sdl2/gui_tilespec.c
SDL_Surface *intro = theme_get_background(theme, BACKGROUND_MAINPAGE);
if (intro->w != main_window_width()) {
SDL_Surface *pTmp = ResizeSurface(intro, main_window_width(), main_window_height(), 1);
SDL_Surface *tmp = ResizeSurface(intro, main_window_width(), main_window_height(), 1);
FREESURFACE(intro);
intro = pTmp;
intro = tmp;
}
/* draw intro gfx center in screen */
client/gui-sdl2/mapview.c
void update_info_label(void)
{
SDL_Color bg_color = {0, 0, 0, 80};
SDL_Surface *pTmp = NULL;
SDL_Surface *tmp = NULL;
char buffer[512];
#ifdef SMALL_SCREEN
SDL_Rect area = {0, 0, 0, 0};
......
#endif /* SMALL_SCREEN */
/* convert to unistr and create text surface */
copy_chars_to_utf8_str(ptext, buffer);
pTmp = create_text_surf_from_utf8(ptext);
tmp = create_text_surf_from_utf8(ptext);
area.x = (main_window_width() - pTmp->w) / 2 - adj_size(5);
area.w = pTmp->w + adj_size(8);
area.h = pTmp->h + adj_size(4);
area.x = (main_window_width() - tmp->w) / 2 - adj_size(5);
area.w = tmp->w + adj_size(8);
area.h = tmp->h + adj_size(4);
SDL_FillRect(main_data.gui->surface, &area,
map_rgba(main_data.gui->surface->format, bg_color));
......
get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME));
/* blit text to screen */
blit_entire_src(pTmp, main_data.gui->surface, area.x + adj_size(5), area.y + adj_size(2));
blit_entire_src(tmp, main_data.gui->surface, area.x + adj_size(5), area.y + adj_size(2));
dirty_sdl_rect(&area);
FREESURFACE(pTmp);
FREESURFACE(tmp);
}
set_indicator_icons(client_research_sprite(),
client/gui-sdl2/repodlgs.c
enum tech_info_mode mode)
{
struct unit_type *punit = NULL;
SDL_Surface *surf, *text, *pTmp, *pTmp2;
SDL_Surface *surf, *text, *tmp, *tmp2;
SDL_Surface *Surf_Array[10], **buf_array;
SDL_Rect dst;
SDL_Color color;
......
0,0, surf->w - 1, surf->h - 1,
get_theme_color(COLOR_THEME_SCIENCEDLG_FRAME));
pTmp = get_tech_icon(tech_id);
tmp = get_tech_icon(tech_id);
if (mode == SMALL_MODE) {
/* draw name tech text */
......
FREESURFACE(text);
/* draw tech icon */
text = ResizeSurface(pTmp, adj_size(25), adj_size(25), 1);
text = ResizeSurface(tmp, adj_size(25), adj_size(25), 1);
dst.x = (adj_size(35) - text->w) / 2;
dst.y = (surf->h - text->h) / 2;
alphablit(text, NULL, surf, &dst, 255);
......
FREESURFACE(text);
/* draw tech icon */
dst.x = (surf->w - pTmp->w) / 2;
alphablit(pTmp, NULL, surf, &dst, 255);
dst.y += pTmp->w + adj_size(10);
dst.x = (surf->w - tmp->w) / 2;
alphablit(tmp, NULL, surf, &dst, 255);
dst.y += tmp->w + adj_size(10);
/* fill array with iprvm. icons */
w = 0;
......
requirement_vector_iterate(&pimprove->reqs, preq) {
if (VUT_ADVANCE == preq->source.kind
&& advance_number(preq->source.value.advance) == tech_id) {
pTmp2 = get_building_surface(pimprove);
Surf_Array[w++] = zoomSurface(pTmp2, DEFAULT_ZOOM * ((float)36 / pTmp2->w), DEFAULT_ZOOM * ((float)36 / pTmp2->w), 1);
tmp2 = get_building_surface(pimprove);
Surf_Array[w++] = zoomSurface(tmp2, DEFAULT_ZOOM * ((float)36 / tmp2->w), DEFAULT_ZOOM * ((float)36 / tmp2->w), 1);
}
} requirement_vector_iterate_end;
} improvement_iterate_end;
......
} /* if (w) */
}
FREESURFACE(pTmp);
FREESURFACE(tmp);
return surf;
}
client/gui-sdl2/widget.c
void draw_frame(SDL_Surface *pdest, Sint16 start_x, Sint16 start_y,
Uint16 w, Uint16 h)
{
SDL_Surface *pTmpLeft =
SDL_Surface *tmp_left =
ResizeSurface(current_theme->FR_Left, current_theme->FR_Left->w, h, 1);
SDL_Surface *pTmpRight =
SDL_Surface *tmp_right =
ResizeSurface(current_theme->FR_Right, current_theme->FR_Right->w, h, 1);
SDL_Surface *pTmpTop =
SDL_Surface *tmp_top =
ResizeSurface(current_theme->FR_Top, w, current_theme->FR_Top->h, 1);
SDL_Surface *pTmpBottom =
SDL_Surface *tmp_bottom =
ResizeSurface(current_theme->FR_Bottom, w, current_theme->FR_Bottom->h, 1);
SDL_Rect tmp,dst = {start_x, start_y, 0, 0};
tmp = dst;
alphablit(pTmpLeft, NULL, pdest, &tmp, 255);
alphablit(tmp_left, NULL, pdest, &tmp, 255);
dst.x += w - pTmpRight->w;
dst.x += w - tmp_right->w;
tmp = dst;
alphablit(pTmpRight, NULL, pdest, &tmp, 255);
alphablit(tmp_right, NULL, pdest, &tmp, 255);
dst.x = start_x;
tmp = dst;
alphablit(pTmpTop, NULL, pdest, &tmp, 255);
alphablit(tmp_top, NULL, pdest, &tmp, 255);
dst.y += h - pTmpBottom->h;
dst.y += h - tmp_bottom->h;
tmp = dst;
alphablit(pTmpBottom, NULL, pdest, &tmp, 255);
alphablit(tmp_bottom, NULL, pdest, &tmp, 255);
FREESURFACE(pTmpLeft);
FREESURFACE(pTmpRight);
FREESURFACE(pTmpTop);
FREESURFACE(pTmpBottom);
FREESURFACE(tmp_left);
FREESURFACE(tmp_right);
FREESURFACE(tmp_top);
FREESURFACE(tmp_bottom);
}
/**********************************************************************//**
client/gui-sdl2/widget_scrollbar.c
{
struct widget *begin = pActiveWidgetLIST;
struct widget *buf = pActiveWidgetLIST;
struct widget *pTmp = NULL;
struct widget *tmp = NULL;
int count = active; /* row */
int count_step = step; /* col */
......
/*
move pointers to positions and unhide scrolled widgets
B = buf - new top
T = pTmp - current top == pActiveWidgetLIST
T = tmp - current top == pActiveWidgetLIST
[B] [ ] [ ]
-----------
[T] [ ] [ ]
......
-----------
[ ] [ ] [ ]
*/
pTmp = buf; /* now buf == pActiveWidgetLIST == current Top */
tmp = buf; /* now buf == pActiveWidgetLIST == current Top */
while (count_step > 0) {
buf = buf->next;
clear_wflag(buf, WF_HIDDEN);
......
/*
scroll pointers up
B = buf
T = pTmp
T = tmp
[B0] [B1] [B2]
-----------
[T0] [T1] [T2] => B position = T position
......
while (count > 0) {
if (real) {
buf->size.x = pTmp->size.x;
buf->size.y = pTmp->size.y;
buf->gfx = pTmp->gfx;
buf->size.x = tmp->size.x;
buf->size.y = tmp->size.y;
buf->gfx = tmp->gfx;
if ((buf->size.w != pTmp->size.w) || (buf->size.h != pTmp->size.h)) {
widget_undraw(pTmp);
widget_mark_dirty(pTmp);
if ((buf->size.w != tmp->size.w) || (buf->size.h != tmp->size.h)) {
widget_undraw(tmp);
widget_mark_dirty(tmp);
if (get_wflags(buf) & WF_RESTORE_BACKGROUND) {
refresh_widget_background(buf);
}
}
pTmp->gfx = NULL;
tmp->gfx = NULL;
if (count == 1) {
set_wflag(pTmp, WF_HIDDEN);
set_wflag(tmp, WF_HIDDEN);
}
if (pTmp == begin_widget_list) {
if (tmp == begin_widget_list) {
real = FALSE;
}
pTmp = pTmp->prev;
tmp = tmp->prev;
} else {
/*
unsymmetric list support.
......
/*
move pointers to positions and unhide scrolled widgets
B = buf
T = pTmp
T = tmp
A - start (pActiveWidgetLIST)
[ ] [ ] [ ]
-----------
......
-----------
[ ] [ ] [B]
*/
pTmp = buf->next;
tmp = buf->next;
count_step = step - 1;
while (count_step && buf != begin_widget_list) {
clear_wflag(buf, WF_HIDDEN);
......
/*
Unsymmetric list support.
correct pTmp and undraw empty fields
correct tmp and undraw empty fields
B = buf
T = pTmp
T = tmp
A - start (pActiveWidgetLIST)
[ ] [ ] [ ]
-----------
......
count = count_step;
while (count) {
/* hack - clear area under unexisting list members */
widget_undraw(pTmp);
widget_mark_dirty(pTmp);
FREESURFACE(pTmp->gfx);
widget_undraw(tmp);
widget_mark_dirty(tmp);
FREESURFACE(tmp->gfx);
if (active == 1) {
set_wflag(pTmp, WF_HIDDEN);
set_wflag(tmp, WF_HIDDEN);
}
pTmp = pTmp->next;
tmp = tmp->next;
count--;
}
......
/*
scroll pointers down
B = buf
T = pTmp
T = tmp
[ ] [ ] [ ]
-----------
[ ] [ ] [ ]
......
[B2] [B1] [B0]
*/
while (count) {
buf->size.x = pTmp->size.x;
buf->size.y = pTmp->size.y;
buf->gfx = pTmp->gfx;
buf->size.x = tmp->size.x;
buf->size.y = tmp->size.y;
buf->gfx = tmp->gfx;
if ((buf->size.w != pTmp->size.w) || (buf->size.h != pTmp->size.h)) {
widget_undraw(pTmp);
widget_mark_dirty(pTmp);
if ((buf->size.w != tmp->size.w) || (buf->size.h != tmp->size.h)) {
widget_undraw(tmp);
widget_mark_dirty(tmp);
if (get_wflags(buf) & WF_RESTORE_BACKGROUND) {
refresh_widget_background(buf);
}
}
pTmp->gfx = NULL;
tmp->gfx = NULL;
if (count == 1) {
set_wflag(pTmp, WF_HIDDEN);
set_wflag(tmp, WF_HIDDEN);
}
pTmp = pTmp->next;
tmp = tmp->next;
buf = buf->next;
count_step--;
if (!count_step) {
......
}
while (buf) {
if (buf == dlg->begin_active_widget_list) {
struct widget *pTmp = buf;
struct widget *tmp = buf;
count = dlg->scroll->step;
while (count) {
pTmp = pTmp->next;
tmp = tmp->next;
count--;
}
buf->size.x = pTmp->size.x;
buf->size.y = pTmp->size.y + pTmp->size.h;
buf->size.x = tmp->size.x;
buf->size.y = tmp->size.y + tmp->size.h;
/* break when last active widget or last seen widget */
break;
} else {
client/gui-sdl2/widget_window.c
{
int ret;
SDL_Color title_bg_color = {255, 255, 255, 200};
SDL_Surface *pTmp = NULL;
SDL_Surface *tmp = NULL;
SDL_Rect dst = pwindow->size;
ret = (*baseclass_redraw)(pwindow);
......
fill_rect_alpha(pwindow->dst->surface, &dst, &title_bg_color);
/* Draw Text on Window's TitleBar */
pTmp = create_text_surf_from_utf8(pwindow->string_utf8);
tmp = create_text_surf_from_utf8(pwindow->string_utf8);
dst.x += adj_size(4);
if (pTmp) {
dst.y += ((WINDOW_TITLE_HEIGHT - pTmp->h) / 2);
alphablit(pTmp, NULL, pwindow->dst->surface, &dst, 255);
FREESURFACE(pTmp);
if (tmp) {
dst.y += ((WINDOW_TITLE_HEIGHT - tmp->h) / 2);
alphablit(tmp, NULL, pwindow->dst->surface, &dst, 255);
FREESURFACE(tmp);
}
dst = pwindow->area;
client/gui-sdl2/wldlg.c
/* count: without production */
if (count <= editor->pWork->scroll->active + 1) {
if (count > 0) {
struct widget *pTmp = last;
struct widget *tmp = last;
do {
pTmp = pTmp->prev;
clear_wflag(pTmp, WF_HIDDEN);
} while (pTmp != buf);
tmp = tmp->prev;
clear_wflag(tmp, WF_HIDDEN);
} while (tmp != buf);
}
hide_scrollbar(editor->pWork->scroll);
}
......
editor->pGlobal->scroll->up_left_button->size.w = adj_size(122);
editor->pGlobal->scroll->down_right_button->size.w = adj_size(122);
} else {
struct widget *pTmp = last;
struct widget *tmp = last;
do {
pTmp = pTmp->prev;
clear_wflag(pTmp, WF_HIDDEN);
} while (pTmp != buf);
tmp = tmp->prev;
clear_wflag(tmp, WF_HIDDEN);
} while (tmp != buf);
}
last = editor->pGlobal->begin_widget_list;
    (1-1/1)