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", gold),
967 name, turns,
PL_(
"turn",
"turns", turns));
978 editor->production_name->size.x =
editor->end_widget_list->area.x +
982 area.x =
editor->end_widget_list->area.x;
983 area.y =
editor->production_name->size.y;
985 area.h =
editor->production_name->size.h;
996 editor->production_progress->theme =
1024 PL_(
"( %d entry )",
"( %d entries )",
len),
len);
1030 editor->worklist_counter->size.x =
editor->end_widget_list->area.x +
1040 area.x =
editor->end_widget_list->area.x;
1041 area.y =
editor->worklist_counter->size.y;
1043 area.h =
editor->worklist_counter->size.h;
1059 int count = 0, turns;
1084 editor->global_worklist_id = -1;
1119 editor->end_widget_list = pwindow;
1121 area = pwindow->area;
1141 PL_(
"( %d entry )",
"( %d entries )",
len),
len);
1163 PL_(
"%s\n%d gold per turn",
1164 "%s\n%d gold per turn", gold),
1176 name, turns,
PL_(
"turn",
"turns", turns));
1249 editor->work->scroll->count = 0;
1251 editor->work->scroll->step = 1;
1274 editor->work->end_active_widget_list =
editor->work->end_widget_list;
1275 editor->work->begin_active_widget_list =
editor->work->begin_widget_list;
1276 editor->work->scroll->count++;
1292 prod.value.building),
1303 *((
int *)
buf->data.ptr) = count;
1309 if (count >
editor->work->scroll->active - 1) {
1317 editor->work->end_widget_list = last->prev;
1318 editor->work->end_active_widget_list =
editor->work->end_widget_list;
1321 editor->work->begin_active_widget_list =
editor->work->begin_widget_list;
1324 editor->work->end_widget_list = last;
1326 editor->work->begin_widget_list = last;
1331 editor->work->active_widget_list =
editor->work->end_active_widget_list;
1351 editor->work->scroll->count += count;
1352 last =
editor->work->begin_widget_list;
1379 editor->global->end_widget_list = last->prev;
1380 editor->global->end_active_widget_list =
editor->global->end_widget_list;
1381 editor->global->begin_widget_list =
buf;
1382 editor->global->begin_active_widget_list =
editor->global->begin_widget_list;
1385 editor->global->active_widget_list =
editor->global->end_active_widget_list;
1389 editor->global->scroll->down_right_button->size.w =
adj_size(122);
1399 last =
editor->global->begin_widget_list;
1438 state =
_(
"Obsolete");
1443 state =
_(
"Destroyed");
1445 state =
_(
"Great Wonder");
1451 state =
_(
"Small Wonder");
1469 PL_(
"shield",
"shields",
cost),
1474 PL_(
"shield",
"shields",
cost),
_(
"never"));
1480 PL_(
"shield",
"shields",
cost),
1481 turns,
PL_(
"turn",
"turns", turns));
1485 PL_(
"shield",
"shields",
cost),
1486 turns,
PL_(
"turn",
"turns", turns));
1495 "%d gold per turn", gold),
1509 PL_(
"shield",
"shields",
cost));
1513 PL_(
"shield",
"shields",
cost));
1535 dst.x = (icon->w -
zoomed->w) / 2;
1536 dst.y = (icon->h/2 -
zoomed->h) / 2;
1542 dst.y += ((icon->h - dst.y) - (
text_name->h + text->h)) / 2;
1545 dst.x = (icon->w - text->w) / 2;
1559 buf->data.city = pcity;
1605 _(
"(%d/%d/%s)\n%d/%d %s\nnever"),
1610 PL_(
"shield",
"shields",
cost));
1613 _(
"(%d/%d/%s)\n%d/%d %s\n%d %s"),
1618 PL_(
"shield",
"shields",
cost),
1619 turns,
PL_(
"turn",
"turns", turns));
1625 _(
"(%d/%d/%s)\n%d %s"),
1630 PL_(
"shield",
"shields",
cost));
1639 dst.x = (icon->w -
zoomed->w) / 2;
1640 dst.y = (icon->h / 2 -
zoomed->h) / 2;
1645 dst.y = icon->h / 2 + (icon->h / 2 - (
text_name->h + text->h)) / 2;
1648 dst.x = (icon->w - text->w) / 2;
1662 buf->data.city = pcity;
1676 editor->targets->end_widget_list = last->prev;
1677 editor->targets->begin_widget_list =
buf;
1678 editor->targets->end_active_widget_list =
editor->targets->end_widget_list;
1679 editor->targets->begin_active_widget_list =
editor->targets->begin_widget_list;
1680 editor->targets->active_widget_list =
editor->targets->end_active_widget_list;
1691 editor->begin_widget_list =
editor->targets->begin_widget_list;
1699 (pwindow->size.w - pwindow->area.w) + area.w,
1700 (pwindow->size.h - pwindow->area.h) + area.h)) {
1704 area = pwindow->area;
1717 dst.x, dst.y, dst.w - 1, dst.h - 1,
1720 dst.x + 2, dst.y + 2, dst.w - 5, dst.h - 5,
1730 dst.x, dst.y, dst.w - 1, dst.h - 1,
1737 dst.h = pwindow->size.h - dst.y -
adj_size(4);
1744 dst.x, dst.y, dst.w - 1, dst.h - 1,
1757 buf = pwindow->prev;
1764 buf->size.y =
buf->next->size.y +
buf->next->size.h;
1774 buf->size.y =
buf->next->size.y +
buf->next->size.h;
1801 editor->work->end_widget_list);
1814 (
editor->global->scroll ?
1815 editor->global->scroll->up_left_button->size.h + 1 : 0),
1817 editor->global->end_widget_list);
1819 if (
editor->global->scroll) {
1831 0, 0,
editor->targets->begin_widget_list,
1832 editor->targets->end_widget_list);
1834 if (
editor->targets->scroll) {
1857 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 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 universal production
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)