81 for (time_to_build = 0; time_to_build <
U_LAST; time_to_build++) {
99 if (VUT_UTYPE == pcity->production.kind) {
100 const struct unit_type *punittype = pcity->production.value.utype;
107 num_units =
MAX(num_units, 1);
108 (
entries[uti].building_count) += num_units;
110 entries[uti].soonest_completions =
188 char tBuf[128], cbuf[128];
212 "Treasury contains %d gold.",
218 PL_(
"Upgrade as many %s to %s as possible for %d gold each?\n%s",
219 "Upgrade as many %s to %s as possible for %d gold each?\n%s",
255 pwindow->dst,
_(
"No"),
276 buf->next->size.w =
buf->size.w;
286 (pwindow->size.w - pwindow->area.w) +
area.w,
287 (pwindow->size.h - pwindow->area.h) +
area.h);
310 buf->size.y =
buf->next->size.y;
361 struct widget *pwindow, *last;
367 bool upgrade =
FALSE;
919 if (
pbuf->prev->prev->prev->prev->prev->prev->prev ==
925 pbuf =
pbuf->prev->prev->prev->prev->prev->prev->prev->prev;
937 if (pwidget !=
NULL) {
954 pbuf->string_utf8->fgcol
1000 pwidget =
pbuf->prev;
1018 pwidget =
pbuf->prev;
1041 pwidget =
pbuf->prev;
1228 x =
motion->horiz_src->size.x;
1229 if (((x + dir) <=
motion->max) && ((x + dir) >=
motion->min)) {
1232 x =
motion->horiz_dst->size.x;
1233 if (((x + (-1 * dir)) >
motion->max) || ((x + (-1 * dir)) <
motion->min)) {
1265 motion->horiz_src->size.x += dir;
1267 motion->horiz_dst->size.x -= dir;
1386 gui_event_loop((
void *)(&motion), NULL, NULL, NULL, NULL, NULL, NULL,
1391 SDL_SetEventFilter(NULL, NULL);
1412 int science, luxury, tax;
1420 science = *(
int *)
buf->data.ptr;
1423 buf =
buf->next->next->next;
1424 luxury = *(
int *)
buf->data.ptr;
1427 tax = 100 - luxury - science;
1542 if (!pcity->did_sell
1619 if (!pcity->did_sell
1628 _(
"We have %d of %s\n(total value is : %d)\n"
1629 "We can sell %d of them for %d gold."),
1635 _(
"We can't sell any %s in this turn."),
1651 area = pwindow->area;
1668 pwindow->dst,
_(
"No"),
1686 buf->data.ptr = (
void *)pwidget;
1690 buf->next->size.w =
buf->size.w;
1700 (pwindow->size.w - pwindow->area.w) +
area.w,
1701 (pwindow->size.h - pwindow->area.h) +
area.h);
1703 area = pwindow->area;
1719 buf = pwindow->prev;
1726 buf->size.y =
buf->next->size.y;
1780 fc_snprintf(cbuf,
sizeof(cbuf),
"%d", tax - total);
1783 if (tax - total < 0) {
1816#define TARGETS_ROW 2
1817#define TARGETS_COL 4
1824 SDL_Color bg_color = {255,255,255,128};
1825 SDL_Color bg_color2 = {255,255,255,136};
1826 SDL_Color bg_color3 = {255,255,255,64};
1828 struct widget *pwindow , *last;
1832 int i, count ,
h = 0;
1842 SDL_Surface *treasury_text;
1843 SDL_Surface *tax_rate_text;
1844 SDL_Surface *total_income_text;
1845 SDL_Surface *total_cost_text;
1846 SDL_Surface *net_income_text;
1847 SDL_Surface *max_rate_text;
1865 pstr->
style |= TTF_STYLE_BOLD;
1874 area = pwindow->
area;
1881 pstr2->
style |= TTF_STYLE_BOLD;
1883 w3 =
MAX(w3, treasury_text->w);
1902 w3 =
MAX(w3, tax_rate_text->w);
1921 w3 =
MAX(w3, total_income_text->w);
1926 pstr->
style |= TTF_STYLE_BOLD;
1943 pstr->
style |= TTF_STYLE_BOLD;
1956 w3 =
MAX(w3, net_income_text->w);
1959 fc_snprintf(cbuf,
sizeof(cbuf),
"%d", tax - total);
1963 if (tax - total < 0) {
1975 fc_snprintf(cbuf,
sizeof(cbuf),
_(
"%s max rate : %d%%"),
1989 pstr->
style |= TTF_STYLE_BOLD;
2022 pstr->
style |= TTF_STYLE_BOLD;
2036 pstr->
style |= TTF_STYLE_BOLD;
2067 pstr->
style |= TTF_STYLE_BOLD;
2087 fc_snprintf(cbuf,
sizeof(cbuf),
_(
"Close Dialog (Esc)"));
2094 buf->
key = SDLK_ESCAPE;
2107 SDL_FillRect(background, NULL,
map_rgba(background->format, bg_color));
2110 0, 0, background->w - 1, background->h - 1,
2115 pstr->
bgcol = (SDL_Color) {0, 0, 0, 0};
2127 pstr->
style |= TTF_STYLE_BOLD;
2133 pstr->
style &= ~TTF_STYLE_BOLD;
2140 zoomed = zoomSurface(zoomed,
DEFAULT_ZOOM * ((
float)54 / zoomed->w),
2143 dst.x = (surf->w - zoomed->w) / 2;
2144 dst.y = (surf->h / 2 - zoomed->h) / 2;
2145 alphablit(zoomed, NULL, surf, &dst, 255);
2149 dst.x = (surf->w - text_name->w)/2;
2150 dst.y += ((surf->h - dst.y) -
2152 alphablit(text_name, NULL, surf, &dst, 255);
2154 dst.y += text_name->h;
2157 for (count = 0; count < p->
cost; count++) {
2172 dst.x = (surf->w - zoomed->w) / 2;
2173 alphablit(zoomed, NULL, surf, &dst, 255);
2178 dst.x = (surf->w - text->w) / 2;
2232 (pwindow->
size.w - pwindow->
area.w) + area.w,
2233 (pwindow->
size.h - pwindow->
area.h) + area.h)) {
2237 area = pwindow->
area;
2244 buf = pwindow->
prev;
2245 buf->
size.x = area.x +
adj_size(10) + treasury_text->w;
2248 w = treasury_text->w + buf->
size.w;
2253 buf->
size.x = area.x +
adj_size(10) + tax_rate_text->w;
2256 w =
MAX(w, tax_rate_text->w + buf->
size.w);
2261 buf->
size.x = area.x +
adj_size(10) + total_income_text->w;
2264 w =
MAX(w, total_income_text->w + buf->
size.w);
2269 buf->
size.x = area.x +
adj_size(10) + total_cost_text->w;
2272 w =
MAX(w, total_cost_text->w + buf->
size.w);
2277 buf->
size.x = area.x +
adj_size(10) + net_income_text->w;
2280 w =
MAX(w, net_income_text->w + buf->
size.w);
2293 dst.x, dst.y, dst.w - 1, dst.h - 1,
2302 dst.y += treasury_text->h;
2307 dst.y += tax_rate_text->h;
2312 dst.y += total_income_text->h;
2317 dst.y += total_cost_text->h;
2322 dst.y += net_income_text->h;
2326 dst.x = area.x +
adj_size(10) + w + ((area.w - (w +
adj_size(10)) - max_rate_text->w) / 2);
2330 dst.y += (max_rate_text->h + 1);
2341 dst.x, dst.y, dst.w - 1, dst.h - 1,
2352 buf->
size.y = dst.y -1;
2357 buf->
size.y = dst.y + 1;
2364 dst.x, dst.y, dst.w - 1, dst.h - 1,
2375 buf->
size.y = dst.y -1;
2380 buf->
size.y = dst.y + 1;
2384 buf->
size.x = dst.x + (dst.w - buf->
size.w) / 2;
2389 buf->
size.x = area.x + area.w - buf->
size.w - 1;
2401 area.x + area.w - 1,
2403 area.h - h - 1,
TRUE);
2427 SDL_Surface *surf, *text, *tmp, *tmp2;
2428 SDL_Surface *surf_array[10], **buf_array;
2462 0,0, surf->w - 1, surf->h - 1,
2470 dst.y = (surf->h - text->h) / 2;
2476 dst.x = (
adj_size(35) - text->w) / 2;
2477 dst.y = (surf->h - text->h) / 2;
2484 dst.x = (surf->w - text->w) / 2;
2491 dst.x = (surf->w - tmp->w) / 2;
2499 if (VUT_ADVANCE == preq->source.kind
2502 surf_array[w++] = zoomSurface(tmp2,
DEFAULT_ZOOM * ((
float)36 / tmp2->w),
2510 dst.x = (surf->w - 2 * surf_array[0]->w) / 2;
2512 dst.x = (surf->w - surf_array[0]->w) / 2;
2516 buf_array = surf_array;
2519 alphablit(*buf_array, NULL, surf, &dst, 255);
2520 dst.x += (*buf_array)->w;
2525 dst.x = (surf->w - 2 * (*buf_array)->w) / 2;
2527 dst.x = (surf->w - (*buf_array)->w) / 2;
2529 dst.y += (*buf_array)->h;
2534 dst.y += surf_array[0]->h +
adj_size(5);
2548 if (surf_array[0]->w > 64) {
2550 SDL_Surface *zoomed = zoomSurface(surf_array[0], zoom, zoom, 1);
2552 dst.x = (surf->w - zoomed->w) / 2;
2553 alphablit(zoomed, NULL, surf, &dst, 255);
2556 dst.x = (surf->w - surf_array[0]->w) / 2;
2557 alphablit(surf_array[0], NULL, surf, &dst, 255);
2568 dst.x = (surf->w - (surf_array[0]->w * 2) * zoom - 2) / 2;
2569 buf_array = surf_array;
2572 SDL_Surface *zoomed = zoomSurface((*buf_array), zoom, zoom, 1);
2575 alphablit(zoomed, NULL, surf, &dst, 255);
2576 dst.x += zoomed->w + 2;
2581 dst.x = (surf->w - 2 * zoomed->w - 2 ) / 2;
2583 dst.x = (surf->w - zoomed->w) / 2;
2585 dst.y += zoomed->h + 2;
2623 SDL_Color bg_color = {255, 255, 255, 136};
2724 dest.x - 1, dest.y - 1, dest.w, dest.h,
2753 dest.x +=
msurf->w + 1;
2831 dest.x +=
msurf->w + 1;
2999 if (
max_col * max_row < count) {
3054 count = (count + (
col - 1)) /
col;
3055 if (count > max_row) {
3188 if (
max_col * max_row < count) {
3224 PL_(
"step",
"steps", num));
3251 count = (count + (
col-1)) /
col;
3252 if (count > max_row) {
3371 struct widget *pwidget, *pwindow;
3411 pwindow->
size.h, 1);
3536 PL_(
"%2d: The %s ruler %s scored %d point\n",
3537 "%2d: The %s ruler %s scored %d points\n",
3544 _(
"The Greatest Civilizations in the world."),
struct @124::my_agent entries[MAX_AGENTS]
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
bool city_production_build_units(const struct city *pcity, bool add_production, int *num_units)
#define city_list_iterate(citylist, pcity)
#define output_type_iterate(output)
#define city_list_iterate_end
#define output_type_iterate_end
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
enum client_states client_state(void)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
#define PL_(String1, String2, n)
const char * government_name_translation(const struct government *pgovern)
struct government * government_of_player(const struct player *pplayer)
void units_report_dialog_popdown(void)
void science_report_dialog_popup(bool raise)
void endgame_report_dialog_start(const struct packet_endgame_report *packet)
void real_units_report_dialog_update(void *unused)
void real_economy_report_dialog_update(void *unused)
void economy_report_dialog_popdown(void)
void economy_report_dialog_popup(bool raise)
void units_report_dialog_popup(bool raise)
void science_report_dialog_redraw(void)
void science_report_dialog_popdown(void)
void real_science_report_dialog_update(void *unused)
SDL_Color * get_theme_color(enum theme_color themecolor)
SDL_Surface * resize_surface(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth)
int main_window_width(void)
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
SDL_Surface * crop_rect_from_surface(SDL_Surface *psource, SDL_Rect *prect)
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
struct sdl2_data main_data
SDL_Surface * create_surf(int width, int height, Uint32 flags)
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
int main_window_height(void)
#define map_rgba(format, color)
int FilterMouseMotionEvents(void *data, SDL_Event *event)
Uint16 gui_event_loop(void *data, void(*loop_action)(void *data), Uint16(*key_down_handler)(SDL_Keysym key, void *data), Uint16(*key_up_handler)(SDL_Keysym key, void *data), Uint16(*textinput_handler)(char *text, void *data), Uint16(*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_motion_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*mouse_button_down_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_button_up_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_motion_handler)(SDL_MouseMotionEvent *motion_event, void *data))
#define CF_CHANGE_TAXRATE_SCI_BLOCK
struct widget * selected_widget
#define DEFAULT_MOVE_STEP
#define PRESSED_EVENT(event)
#define CF_CHANGE_TAXRATE_LUX_BLOCK
void popup_tech_info(Tech_type_id tech)
struct widget * get_research_widget(void)
struct widget * get_tax_rates_widget(void)
static int popdown_science_dialog_callback(struct widget *pwidget)
static void popup_change_research_goal_dialog(void)
static int sell_impr_window_callback(struct widget *pwindow)
static int eg_player_count
static int eg_players_received
static struct advanced_dialog * units_dlg
static int exit_economy_dialog_callback(struct widget *pwidget)
static int ok_sell_impr_callback(struct widget *pwidget)
static int cancel_sell_impr_callback(struct widget *pwidget)
static int horiz_taxrate_callback(struct widget *horiz_src)
SDL_Surface * create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id, enum tech_info_mode mode)
static int ok_upgrade_unit_window_callback(struct widget *pwidget)
void science_report_dialogs_popdown_all(void)
static struct small_dialog * science_dlg
static int change_research_goal_callback(struct widget *pwidget)
static int economy_dialog_callback(struct widget *pwindow)
static struct advanced_dialog * change_tech_dlg
static int apply_taxrates_callback(struct widget *button)
static int toggle_block_callback(struct widget *pcheckbox)
static void real_activeunits_report_dialog_update(struct units_entry *units, struct units_entry *total)
static void enable_economy_dlg(void)
static int cancel_upgrade_unit_callback(struct widget *pwidget)
static struct small_dialog * economy_sell_dlg
static int popup_change_research_goal_dialog_callback(struct widget *pwidget)
static char eg_buffer[150 *MAX_NUM_PLAYERS]
static void popup_change_research_dialog(void)
static int change_research_goal_dialog_callback(struct widget *pwindow)
static int exit_change_tech_dlg_callback(struct widget *pwidget)
static int exit_units_dlg_callback(struct widget *pwidget)
static void disable_science_dialog(void)
static void enable_science_dialog(void)
static int popup_change_research_dialog_callback(struct widget *pwidget)
static void get_units_report_data(struct units_entry *entries, struct units_entry *total)
static struct advanced_dialog * economy_dlg
static Uint16 report_scroll_mouse_button_up(SDL_MouseButtonEvent *button_event, void *data)
static int upgrade_unit_window_callback(struct widget *pwindow)
static int units_dialog_callback(struct widget *pwindow)
static int popup_upgrade_unit_callback(struct widget *pwidget)
static int popup_sell_impr_callback(struct widget *pwidget)
static Uint16 report_scroll_mouse_motion_handler(SDL_MouseMotionEvent *motion_event, void *data)
static int science_dialog_callback(struct widget *pwindow)
static int change_research_callback(struct widget *pwidget)
static struct small_dialog * units_upg_dlg
static void disable_economy_dlg(void)
@ ID_SCIENCE_CANCEL_DLG_BUTTON
@ ID_CHANGE_TAXRATE_DLG_SCI_SCROLLBAR
@ ID_SCIENCE_DLG_CHANGE_GOAL_CANCEL_BUTTON
@ ID_SCIENCE_DLG_CHANGE_GOAL_WINDOW
@ ID_CHANGE_TAXRATE_DLG_LUX_BLOCK_CHECKBOX
@ ID_ECONOMY_DIALOG_WINDOW
@ ID_TERRAIN_ADV_DLG_EXIT_BUTTON
@ ID_SCIENCE_DLG_CHANGE_REASARCH_WINDOW
@ ID_CHANGE_TAXRATE_DLG_SCI_LABEL
@ ID_CHANGE_TAXRATE_DLG_LUX_SCROLLBAR
@ ID_CHANGE_TAXRATE_DLG_OK_BUTTON
@ ID_SCIENCE_DLG_CHANGE_REASARCH_BUTTON
@ ID_CHANGE_TAXRATE_DLG_LUX_LABEL
@ ID_CHANGE_TAXRATE_DLG_SCI_BLOCK_CHECKBOX
@ ID_SCIENCE_DLG_CHANGE_GOAL_BUTTON
@ ID_CHANGE_TAXRATE_DLG_CANCEL_BUTTON
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
SDL_Surface * create_text_surf_smaller_than_w(utf8_str *pstr, int w)
#define create_utf8_from_char(string_in, ptsize)
#define FREEUTF8STR(pstr)
#define create_utf8_from_char_fonto(string_in, fonto)
SDL_Color * get_tech_color(Tech_type_id tech_id)
SDL_Surface * get_tech_icon(Tech_type_id tech)
static SDL_Surface * get_building_surface(const struct impr_type *pimprove)
static SDL_Surface * get_unittype_surface(const struct unit_type *punittype, enum direction8 facing)
struct impr_type * improvement_by_number(const Impr_type_id id)
int impr_sell_gold(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_calloc(n, esz)
const char * nation_adjective_for_player(const struct player *pplayer)
int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
int dsend_packet_player_tech_goal(struct connection *pc, int tech)
int dsend_packet_player_research(struct connection *pc, int tech)
int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
const char * science_dialog_text(void)
struct player * player_by_number(const int player_id)
const char * player_name(const struct player *pplayer)
void get_economy_report_data(struct improvement_entry *entries, int *num_entries_used, int *total_cost, int *total_income)
endgame_report_dialog_player
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
struct widget * active_widget_list
struct widget * end_widget_list
struct widget * begin_widget_list
struct widget * begin_active_widget_list
struct widget * end_active_widget_list
struct scroll_bar * scroll
struct city_list * cities
struct player_economic economic
struct widget * label_dst
struct widget * horiz_src
struct widget * label_src
struct widget * horiz_dst
struct widget * begin_widget_list
struct widget * end_widget_list
int fc_snprintf(char *str, size_t n, const char *format,...)
int cat_snprintf(char *str, size_t n, const char *format,...)
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
const char * advance_name_translation(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
const char * get_science_target_text(double *percent)
const char * get_science_goal_text(Tech_type_id goal)
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
@ BACKGROUND_CHANGERESEARCHDLG
@ COLOR_THEME_ECONOMYDLG_TEXT
@ COLOR_THEME_SCIENCEDLG_MED_TECHICON_BG
@ COLOR_THEME_UNITUPGRADE_TEXT
@ COLOR_THEME_UNITSREP_FRAME
@ COLOR_THEME_ECONOMYDLG_FRAME
@ COLOR_THEME_SELLIMPR_TEXT
@ COLOR_THEME_UNITSREP_TEXT
@ COLOR_THEME_ECONOMYDLG_NEG_TEXT
@ COLOR_THEME_SCIENCEDLG_FRAME
@ COLOR_THEME_SCIENCEDLG_TEXT
struct theme * active_theme
int tileset_full_tile_width(const struct tileset *t)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
struct unit_type * utype_by_number(const Unit_type_id id)
Unit_type_id utype_number(const struct unit_type *punittype)
Unit_type_id utype_index(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
#define unit_type_iterate(_p)
#define unit_type_iterate_end