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 #895133 ยป 0021-sdl2-Rename-pImprove-to-lower-case.patch

Marko Lindqvist, 2020-11-09 06:46 AM

View differences:

client/gui-sdl2/action_dialog.c
/* ------------------ */
n = 0;
city_built_iterate(pCity, pImprove) {
if (pImprove->sabotage > 0) {
city_built_iterate(pCity, pimprove) {
if (pimprove->sabotage > 0) {
create_active_iconlabel(pBuf, pwindow->dst, pstr,
(char *) city_improvement_name_translation(pCity, pImprove),
(char *) city_improvement_name_translation(pCity, pimprove),
sabotage_impr_callback);
pBuf->data.cont = pCont;
set_wstate(pBuf, FC_WS_NORMAL);
add_to_gui_list(MAX_ID - improvement_number(pImprove), pBuf);
add_to_gui_list(MAX_ID - improvement_number(pimprove), pBuf);
area.w = MAX(area.w , pBuf->size.w);
imp_h += pBuf->size.h;
client/gui-sdl2/citydlg.c
**************************************************************************/
struct impr_type *get_building_for_effect(enum effect_type effect_type)
{
improvement_iterate(pImprove) {
if (building_has_effect(pImprove, effect_type)) {
return pImprove;
improvement_iterate(pimprove) {
if (building_has_effect(pimprove, effect_type)) {
return pimprove;
}
} improvement_iterate_end;
......
pBuf = pLast = pAdd_Dock;
/* allock new */
city_built_iterate(pCity, pImprove) {
pstr = create_utf8_from_char(city_improvement_name_translation(pCity, pImprove), adj_font(10));
city_built_iterate(pCity, pimprove) {
pstr = create_utf8_from_char(city_improvement_name_translation(pCity, pimprove), adj_font(10));
pstr->fgcol = *get_theme_color(COLOR_THEME_CITYDLG_IMPR);
pstr->style |= TTF_STYLE_BOLD;
pLogo = get_building_surface(pImprove);
pLogo = get_building_surface(pimprove);
pLogo = ResizeSurfaceBox(pLogo, adj_size(22), adj_size(22), 1, TRUE, TRUE);
pBuf = create_iconlabel(pLogo, pwindow->dst, pstr,
......
pBuf->action = sell_imprvm_dlg_callback;
if (!pcity_dlg->pCity->did_sell
&& !is_wonder(pImprove) && (pOwner == client.conn.playing)) {
&& !is_wonder(pimprove) && (pOwner == client.conn.playing)) {
set_wstate(pBuf, FC_WS_NORMAL);
}
pBuf->ID = MAX_ID - improvement_number(pImprove) - 3000;
pBuf->ID = MAX_ID - improvement_number(pimprove) - 3000;
DownAdd(pBuf, pAdd_Dock);
pAdd_Dock = pBuf;
client/gui-sdl2/helpdlg.c
struct UNITS_BUTTONS *pStore;
struct widget *pCloseButton = NULL;
struct widget *pListToggleButton = NULL;
struct widget *pImprovementButton = NULL;
struct widget *improvement_button = NULL;
struct widget *pImprNameLabel = NULL;
struct widget *pCostLabel = NULL;
struct widget *pUpkeepLabel = NULL;
......
get_theme_color(COLOR_THEME_HELPDLG_FRAME));
impr_type_count = 0;
improvement_iterate(pImprove) {
improvement_iterate(pimprove) {
/* copy background surface */
pBackground = copy_surface(pBackgroundTmpl);
/* blit improvement name */
copy_chars_to_utf8_str(pstr, improvement_name_translation(pImprove));
copy_chars_to_utf8_str(pstr, improvement_name_translation(pimprove));
pText = create_text_surf_smaller_than_w(pstr, adj_size(100 - 4));
dst.x = adj_size(40) + (pBackground->w - pText->w - adj_size(40)) / 2;
dst.y = (pBackground->h - pText->h) / 2;
......
FREESURFACE(pText);
/* blit improvement icon */
pIcon = ResizeSurfaceBox(get_building_surface(pImprove),
pIcon = ResizeSurfaceBox(get_building_surface(pimprove),
adj_size(36), adj_size(36), 1, TRUE, TRUE);
dst.x = adj_size(5);
dst.y = (pBackground->h - pIcon->h) / 2;
alphablit(pIcon, NULL, pBackground, &dst, 255);
FREESURFACE(pIcon);
pImprovementButton = create_icon2(pBackground, pwindow->dst,
improvement_button = create_icon2(pBackground, pwindow->dst,
WF_FREE_THEME | WF_RESTORE_BACKGROUND);
set_wstate(pImprovementButton, FC_WS_NORMAL);
pImprovementButton->action = change_impr_callback;
add_to_gui_list(MAX_ID - improvement_number(pImprove), pImprovementButton);
set_wstate(improvement_button, FC_WS_NORMAL);
improvement_button->action = change_impr_callback;
add_to_gui_list(MAX_ID - improvement_number(pimprove), improvement_button);
if (impr_type_count++ >= 10) {
set_wflag(pImprovementButton, WF_HIDDEN);
set_wflag(improvement_button, WF_HIDDEN);
}
} improvement_iterate_end;
......
FREESURFACE(pBackgroundTmpl);
pHelpDlg->pEndActiveWidgetList = pDock->prev;
pHelpDlg->pBeginWidgetList = pImprovementButton ? pImprovementButton : pCloseButton;
pHelpDlg->pBeginWidgetList = improvement_button ? improvement_button : pCloseButton;
pHelpDlg->pBeginActiveWidgetList = pHelpDlg->pBeginWidgetList;
if (impr_type_count > 10) {
......
/* target improvements */
imp_count = 0;
improvement_iterate(pImprove) {
improvement_iterate(pimprove) {
/* FIXME: this should show ranges and all the MAX_NUM_REQS reqs.
* Currently it's limited to 1 req. Remember MAX_NUM_REQS is a compile-time
* definition. */
requirement_vector_iterate(&(pImprove->reqs), preq) {
requirement_vector_iterate(&(pimprove->reqs), preq) {
if (VUT_ADVANCE == preq->source.kind
&& advance_number(preq->source.value.advance) == tech) {
pSurf = get_building_surface(pImprove);
pSurf = get_building_surface(pimprove);
pwidget = create_iconlabel_from_chars(
ResizeSurfaceBox(pSurf, adj_size(48), adj_size(48), 1, TRUE, TRUE),
pwindow->dst,
improvement_name_translation(pImprove),
improvement_name_translation(pimprove),
adj_font(14),
WF_RESTORE_BACKGROUND | WF_SELECT_WITHOUT_BAR);
set_wstate(pwidget, FC_WS_NORMAL);
if (is_wonder(pImprove)) {
if (is_wonder(pimprove)) {
pwidget->string_utf8->fgcol = *get_theme_color(COLOR_THEME_CITYDLG_LUX);
}
pwidget->action = change_impr_callback;
pwidget->ID = MAX_ID - improvement_number(pImprove);
pwidget->ID = MAX_ID - improvement_number(pimprove);
DownAdd(pwidget, pDock);
pDock = pwidget;
imp_count++;
client/gui-sdl2/repodlgs.c
for (i = 0; i < entries_used; i++) {
struct improvement_entry *p = &entries[i];
struct impr_type *pImprove = p->type;
struct impr_type *pimprove = p->type;
pSurf = crop_rect_from_surface(pBackground, NULL);
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pImprove));
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pimprove));
copy_chars_to_utf8_str(pstr, cbuf);
pstr->style |= TTF_STYLE_BOLD;
......
/*-----------------*/
pZoom = get_building_surface(pImprove);
pZoom = get_building_surface(pimprove);
pZoom = zoomSurface(pZoom, DEFAULT_ZOOM * ((float)54 / pZoom->w), DEFAULT_ZOOM * ((float)54 / pZoom->w), 1);
dst.x = (pSurf->w - pZoom->w) / 2;
......
}
} else {
if (!is_wonder(pImprove)) {
if (!is_wonder(pimprove)) {
copy_chars_to_utf8_str(pstr, _("Nation"));
} else {
copy_chars_to_utf8_str(pstr, _("Wonder"));
......
/* fill array with iprvm. icons */
w = 0;
improvement_iterate(pImprove) {
requirement_vector_iterate(&pImprove->reqs, preq) {
improvement_iterate(pimprove) {
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);
pTmp2 = get_building_surface(pimprove);
Surf_Array[w++] = zoomSurface(pTmp2, DEFAULT_ZOOM * ((float)36 / pTmp2->w), DEFAULT_ZOOM * ((float)36 / pTmp2->w), 1);
}
} requirement_vector_iterate_end;
......
dest.x = pChangeResearchButton->size.x + pChangeResearchButton->size.w + adj_size(10);
/* buildings */
improvement_iterate(pImprove) {
requirement_vector_iterate(&pImprove->reqs, preq) {
improvement_iterate(pimprove) {
requirement_vector_iterate(&pimprove->reqs, preq) {
if (VUT_ADVANCE == preq->source.kind
&& (advance_number(preq->source.value.advance)
== presearch->researching)) {
pSurf = adj_surf(get_building_surface(pImprove));
pSurf = adj_surf(get_building_surface(pimprove));
alphablit(pSurf, NULL, pwindow->dst->surface, &dest, 255);
dest.x += pSurf->w + 1;
}
......
FREESURFACE(pSurf);
/* buildings */
improvement_iterate(pImprove) {
requirement_vector_iterate(&pImprove->reqs, preq) {
improvement_iterate(pimprove) {
requirement_vector_iterate(&pimprove->reqs, preq) {
if (VUT_ADVANCE == preq->source.kind
&& (advance_number(preq->source.value.advance)
== presearch->tech_goal)) {
pSurf = adj_surf(get_building_surface(pImprove));
pSurf = adj_surf(get_building_surface(pimprove));
alphablit(pSurf, NULL, pwindow->dst->surface, &dest, 255);
dest.x += pSurf->w + 1;
}
client/gui-sdl2/wldlg.c
pstr->style |= (SF_CENTER|TTF_STYLE_BOLD);
pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
improvement_iterate(pImprove) {
can_build = can_player_build_improvement_now(client.conn.playing, pImprove);
improvement_iterate(pimprove) {
can_build = can_player_build_improvement_now(client.conn.playing, pimprove);
can_eventually_build =
can_player_build_improvement_later(client.conn.playing, pImprove);
can_player_build_improvement_later(client.conn.playing, pimprove);
/* If there's a city, can the city build the improvement? */
if (pCity) {
can_build = can_build && can_city_build_improvement_now(pCity, pImprove);
can_build = can_build && can_city_build_improvement_now(pCity, pimprove);
can_eventually_build = can_eventually_build
&& can_city_build_improvement_later(pCity, pImprove);
&& can_city_build_improvement_later(pCity, pimprove);
}
if ((advanced_tech && can_eventually_build)
......
pIcon = crop_rect_from_surface(pMain, NULL);
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pImprove));
fc_snprintf(cbuf, sizeof(cbuf), "%s", improvement_name_translation(pimprove));
copy_chars_to_utf8_str(pstr, cbuf);
pstr->style |= TTF_STYLE_BOLD;
if (pCity && is_improvement_redundant(pCity, pImprove)) {
if (pCity && is_improvement_redundant(pCity, pimprove)) {
pstr->style |= TTF_STYLE_STRIKETHROUGH;
}
pText_Name = create_text_surf_smaller_than_w(pstr, pIcon->w - 4);
if (is_wonder(pImprove)) {
if (improvement_obsolete(client.conn.playing, pImprove, pCity)) {
if (is_wonder(pimprove)) {
if (improvement_obsolete(client.conn.playing, pimprove, pCity)) {
state = _("Obsolete");
} else if (is_great_wonder(pImprove)) {
if (great_wonder_is_built(pImprove)) {
} else if (is_great_wonder(pimprove)) {
if (great_wonder_is_built(pimprove)) {
state = _("Built");
} else if (great_wonder_is_destroyed(pImprove)) {
} else if (great_wonder_is_destroyed(pimprove)) {
state = _("Destroyed");
} else {
state = _("Great Wonder");
}
} else if (is_small_wonder(pImprove)) {
if (small_wonder_is_built(client.conn.playing, pImprove)) {
} else if (is_small_wonder(pimprove)) {
if (small_wonder_is_built(client.conn.playing, pimprove)) {
state = _("Built");
} else {
state = _("Small Wonder");
......
}
if (pCity) {
if (!improvement_has_flag(pImprove, IF_GOLD)) {
struct universal univ = cid_production(cid_encode_building(pImprove));
int cost = impr_build_shield_cost(pCity, pImprove);
if (!improvement_has_flag(pimprove, IF_GOLD)) {
struct universal univ = cid_production(cid_encode_building(pimprove));
int cost = impr_build_shield_cost(pCity, pimprove);
turns = city_turns_to_build(pCity, &univ, TRUE);
......
}
} else {
/* non city mode */
if (!improvement_has_flag(pImprove, IF_GOLD)) {
int cost = impr_build_shield_cost(NULL, pImprove);
if (!improvement_has_flag(pimprove, IF_GOLD)) {
int cost = impr_build_shield_cost(NULL, pimprove);
if (state) {
fc_snprintf(cbuf, sizeof(cbuf), _("(%s)\n%d %s"),
......
/*-----------------*/
pZoom = get_building_surface(pImprove);
pZoom = get_building_surface(pimprove);
pZoom = zoomSurface(pZoom, DEFAULT_ZOOM * ((float)54 / pZoom->w), DEFAULT_ZOOM * ((float)54 / pZoom->w), 1);
dst.x = (pIcon->w - pZoom->w) / 2;
dst.y = (pIcon->h/2 - pZoom->h) / 2;
......
widget_h = MAX(widget_h, pBuf->size.h);
pBuf->data.city = pCity;
add_to_gui_list(MAX_ID - improvement_number(pImprove), pBuf);
add_to_gui_list(MAX_ID - improvement_number(pimprove), pBuf);
pBuf->action = worklist_editor_targets_callback;
if (count > (TARGETS_ROW * TARGETS_COL - 1)) {
    (1-1/1)