28#ifdef SDL2_PLAIN_INCLUDE
135 &&
editor->worklist_copy.entries[
i].value.building ==
136 editor->worklist_copy.entries[j].value.building) {
148 &&
editor->worklist_copy.entries[
i].value.building ==
149 editor->currently_building.value.building) {
259 if (
editor->work->begin_active_widget_list) {
260 dock =
editor->work->begin_active_widget_list;
272 editor->work->scroll->up_left_button->size.h + 1,
274 editor->work->end_widget_list);
306 if (
one->kind !=
two->kind) {
338 editor->currently_building = *prod;
461 if (
item->data.ptr) {
465 if (
buf !=
editor->work->begin_active_widget_list) {
468 *((
int *)
buf->data.ptr) = *((
int *)
buf->data.ptr) - 1;
469 }
while (
buf !=
editor->work->begin_active_widget_list);
485 if (
buf !=
editor->work->begin_active_widget_list) {
488 *((
int *)
buf->data.ptr) = *((
int *)
buf->data.ptr) - 1;
489 }
while (
buf !=
editor->work->begin_active_widget_list);
502 editor->work->end_widget_list);
534 bool changed =
FALSE;
537 if (
item ==
editor->work->begin_active_widget_list) {
542 text =
item->string_utf8->text;
546 if (
item->data.ptr) {
548 int row = *((
int *)
item->data.ptr);
563 item->string_utf8->text =
item->prev->string_utf8->text;
566 item->prev->string_utf8->text = text;
589 char *text =
item->string_utf8->text;
591 bool changed =
FALSE;
595 if (
item ==
editor->work->end_active_widget_list) {
602 if (
item->data.ptr && *((
int *)
item->data.ptr) > 0) {
604 int row = *((
int *)
item->data.ptr);
621 item->string_utf8->text =
item->next->string_utf8->text;
624 item->next->string_utf8->text = text;
712 pworklist->entries[count].value.building),
726 buf,
editor->work->begin_active_widget_list,
783 if (
buf !=
editor->work->begin_active_widget_list) {
785 if (
buf !=
editor->work->begin_active_widget_list) {
789 }
while (
buf !=
editor->work->begin_active_widget_list);
824 *((
int *)
buf->data.ptr) = count;
909 *progress = ((
float)stock /
cost) * 100.0;
910 if (!
width && stock) {
953 PL_(
"%s\n%d gold per turn",
954 "%s\n%d gold per turn", output),
959 PL_(
"%s\n%d infrapoint per turn",
960 "%s\n%d infrapoints per turn", output),
973 name, turns,
PL_(
"turn",
"turns", turns));
984 editor->production_name->size.x =
editor->end_widget_list->area.x +
988 area.x =
editor->end_widget_list->area.x;
989 area.y =
editor->production_name->size.y;
991 area.h =
editor->production_name->size.h;
1002 editor->production_progress->theme =
1030 PL_(
"( %d entry )",
"( %d entries )",
len),
len);
1036 editor->worklist_counter->size.x =
editor->end_widget_list->area.x +
1046 area.x =
editor->end_widget_list->area.x;
1047 area.y =
editor->worklist_counter->size.y;
1049 area.h =
editor->worklist_counter->size.h;
1065 int count = 0, turns;
1090 editor->global_worklist_id = -1;
1125 editor->end_widget_list = pwindow;
1127 area = pwindow->area;
1147 PL_(
"( %d entry )",
"( %d entries )",
len),
len);
1169 PL_(
"%s\n%d gold per turn",
1170 "%s\n%d gold per turn", output),
1174 PL_(
"%s\n%d infrapoint per turn",
1175 "%s\n%d infrapoints per turn", output),
1181 if (
pcity->shield_stock < count) {
1187 name, turns,
PL_(
"turn",
"turns", turns));
1260 editor->work->scroll->count = 0;
1262 editor->work->scroll->step = 1;
1285 editor->work->end_active_widget_list =
editor->work->end_widget_list;
1286 editor->work->begin_active_widget_list =
editor->work->begin_widget_list;
1287 editor->work->scroll->count++;
1303 prod.value.building),
1314 *((
int *)
buf->data.ptr) = count;
1320 if (count >
editor->work->scroll->active - 1) {
1328 editor->work->end_widget_list = last->prev;
1329 editor->work->end_active_widget_list =
editor->work->end_widget_list;
1332 editor->work->begin_active_widget_list =
editor->work->begin_widget_list;
1335 editor->work->end_widget_list = last;
1337 editor->work->begin_widget_list = last;
1342 editor->work->active_widget_list =
editor->work->end_active_widget_list;
1362 editor->work->scroll->count += count;
1363 last =
editor->work->begin_widget_list;
1390 editor->global->end_widget_list = last->prev;
1391 editor->global->end_active_widget_list =
editor->global->end_widget_list;
1392 editor->global->begin_widget_list =
buf;
1393 editor->global->begin_active_widget_list =
editor->global->begin_widget_list;
1396 editor->global->active_widget_list =
editor->global->end_active_widget_list;
1400 editor->global->scroll->down_right_button->size.w =
adj_size(122);
1410 last =
editor->global->begin_widget_list;
1449 state =
_(
"Obsolete");
1454 state =
_(
"Destroyed");
1456 state =
_(
"Great Wonder");
1462 state =
_(
"Small Wonder");
1480 PL_(
"shield",
"shields",
cost),
1485 PL_(
"shield",
"shields",
cost),
_(
"never"));
1491 PL_(
"shield",
"shields",
cost),
1492 turns,
PL_(
"turn",
"turns", turns));
1496 PL_(
"shield",
"shields",
cost),
1497 turns,
PL_(
"turn",
"turns", turns));
1506 "%d gold per turn", output),
1510 "%d infrapoints per turn", output),
1524 PL_(
"shield",
"shields",
cost));
1528 PL_(
"shield",
"shields",
cost));
1552 dst.x = (icon->w -
zoomed->w) / 2;
1553 dst.y = (icon->h/2 -
zoomed->h) / 2;
1559 dst.y += ((icon->h - dst.y) - (
text_name->h + text->h)) / 2;
1562 dst.x = (icon->w - text->w) / 2;
1622 _(
"(%d/%d/%s)\n%d/%d %s\nnever"),
1627 PL_(
"shield",
"shields",
cost));
1630 _(
"(%d/%d/%s)\n%d/%d %s\n%d %s"),
1635 PL_(
"shield",
"shields",
cost),
1636 turns,
PL_(
"turn",
"turns", turns));
1642 _(
"(%d/%d/%s)\n%d %s"),
1647 PL_(
"shield",
"shields",
cost));
1656 dst.x = (icon->w -
zoomed->w) / 2;
1657 dst.y = (icon->h / 2 -
zoomed->h) / 2;
1662 dst.y = icon->h / 2 + (icon->h / 2 - (
text_name->h + text->h)) / 2;
1665 dst.x = (icon->w - text->w) / 2;
1693 editor->targets->end_widget_list = last->prev;
1694 editor->targets->begin_widget_list =
buf;
1695 editor->targets->end_active_widget_list =
editor->targets->end_widget_list;
1696 editor->targets->begin_active_widget_list =
editor->targets->begin_widget_list;
1697 editor->targets->active_widget_list =
editor->targets->end_active_widget_list;
1708 editor->begin_widget_list =
editor->targets->begin_widget_list;
1716 (pwindow->size.w - pwindow->area.w) + area.w,
1717 (pwindow->size.h - pwindow->area.h) + area.h)) {
1721 area = pwindow->area;
1734 dst.x, dst.y, dst.w - 1, dst.h - 1,
1737 dst.x + 2, dst.y + 2, dst.w - 5, dst.h - 5,
1747 dst.x, dst.y, dst.w - 1, dst.h - 1,
1754 dst.h = pwindow->size.h - dst.y -
adj_size(4);
1761 dst.x, dst.y, dst.w - 1, dst.h - 1,
1774 buf = pwindow->prev;
1781 buf->size.y =
buf->next->size.y +
buf->next->size.h;
1791 buf->size.y =
buf->next->size.y +
buf->next->size.h;
1818 editor->work->end_widget_list);
1831 (
editor->global->scroll ?
1832 editor->global->scroll->up_left_button->size.h + 1 : 0),
1834 editor->global->end_widget_list);
1836 if (
editor->global->scroll) {
1848 0, 0,
editor->targets->begin_widget_list,
1849 editor->targets->end_widget_list);
1851 if (
editor->targets->scroll) {
1874 editor->end_widget_list);
SDL_Surface * zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth)
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
struct canvas int int struct sprite int int int width
int city_turns_to_build(const struct city *pcity, const struct universal *target, bool include_shield_stock)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
int city_production_build_shield_cost(const struct city *pcity)
const char * city_name_get(const struct city *pcity)
bool can_city_build_later(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
bool can_city_build_improvement_now(const struct city *pcity, const struct impr_type *pimprove)
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
int city_change_production_penalty(const struct city *pcity, const struct universal *target)
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool city_production_is_genus(const struct city *pcity, enum impr_genus_id genus)
bool can_city_build_improvement_later(const struct city *pcity, const struct impr_type *pimprove)
bool can_city_build_unit_later(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
const char * city_production_name_translation(const struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
int city_change_production(struct city *pcity, struct universal *target)
cid cid_encode_building(const struct impr_type *pimprove)
cid cid_encode(struct universal target)
struct universal cid_decode(cid id)
cid cid_encode_unit(const struct unit_type *punittype)
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 const struct action *paction struct unit struct city * pcity
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
static struct editor_state * editor
#define PL_(String1, String2, n)
struct global_worklist * global_worklist_by_id(int id)
bool global_worklist_set(struct global_worklist *pgwl, const struct worklist *pwl)
const char * global_worklist_name(const struct global_worklist *pgwl)
int global_worklist_id(const struct global_worklist *pgwl)
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
void global_worklist_set_name(struct global_worklist *pgwl, const char *name)
#define global_worklists_iterate(pgwl)
#define global_worklists_iterate_end
bool city_dialog_is_open(struct city *pcity)
void update_worklist_report_dialog(void)
void enable_city_dlg_widgets(void)
SDL_Color * get_theme_color(enum theme_color themecolor)
int main_window_width(void)
void layer_rect_to_screen_rect(struct gui_layer *gui_layer, SDL_Rect *dest_rect)
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, 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)
#define PRESSED_EVENT(event)
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 FREEUTF8STR(pstr)
#define create_utf8_from_char_fonto(string_in, fonto)
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)
void popup_impr_info(Impr_type_id impr)
void popup_unit_info(Unit_type_id type_id)
void dirty_sdl_rect(SDL_Rect *Rect)
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
@ COLOR_THEME_WLDLG_FRAME
struct theme * active_theme
static void get_target_help_data(struct widget *target)
static void add_target_to_worklist(struct widget *target)
static void set_global_worklist(struct widget *pwidget)
static bool are_prods_same_class(const struct universal *one, const struct universal *two)
static const char * get_production_name(struct city *pcity, struct universal prod, int *cost)
static int window_worklist_editor_callback(struct widget *pwidget)
static void add_target_to_production(struct widget *target)
static void swap_item_down_from_worklist(struct widget *item)
static int popdown_worklist_editor_callback(struct widget *pwidget)
static int ok_worklist_editor_callback(struct widget *pwidget)
static SDL_Surface * get_progress_icon(int stock, int cost, int *progress)
void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
static void remove_item_from_worklist(struct widget *item)
static void refresh_worklist_count_label(void)
static int worklist_editor_item_callback(struct widget *pwidget)
static int global_worklist_callback(struct widget *pwidget)
void popdown_worklist_editor(void)
static int worklist_editor_targets_callback(struct widget *pwidget)
static void add_global_worklist(struct widget *pwidget)
static void swap_item_up_from_worklist(struct widget *item)
static int rename_worklist_editor_callback(struct widget *pwidget)
static void change_production(struct universal *prod)
static void refresh_production_label(int stock)
bool great_wonder_is_built(const struct impr_type *pimprove)
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
bool can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
bool great_wonder_is_destroyed(const struct impr_type *pimprove)
bool can_player_build_improvement_now(const struct player *p, struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool small_wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
int impr_build_shield_cost(const struct city *pcity, const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
bool is_convert_improvement(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
#define fc_calloc(n, esz)
const char * move_points_text(int mp, bool reduce)
int universal_build_shield_cost(const struct city *pcity, const struct universal *target)
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
struct widget * worklist_counter
struct worklist worklist_copy
struct widget * production_name
struct advanced_dialog * global
char worklist_name[MAX_LEN_NAME]
struct universal currently_building
struct widget * production_progress
struct advanced_dialog * targets
struct advanced_dialog * work
struct widget * begin_widget_list
struct widget * end_widget_list
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
#define sz_strlcpy(dest, src)
const struct unit_type * utype
const struct impr_type * building
Unit_type_id utype_number(const struct unit_type *punittype)
bool can_player_build_unit_later(const struct player *p, const struct unit_type *punittype)
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
bool can_player_build_unit_now(const struct player *p, const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
#define unit_type_iterate(_p)
#define unit_type_iterate_end
void worklist_advance(struct worklist *pwl)
void worklist_copy(struct worklist *dst, const struct worklist *src)
void worklist_init(struct worklist *pwl)
bool worklist_peek_ith(const struct worklist *pwl, struct universal *prod, int idx)
bool worklist_is_empty(const struct worklist *pwl)
bool worklist_append(struct worklist *pwl, const struct universal *prod)
void worklist_remove(struct worklist *pwl, int idx)
int worklist_length(const struct worklist *pwl)
#define worklist_iterate_end
#define worklist_iterate(_list, _p)