243 for (layer = 0; layer <
tree->num_layers; layer++) {
244 for (
i = 0;
i <
tree->layer_size[layer];
i++) {
252 for (j = 0; j < node->
nrequire; j++) {
300 for (
i = 0;
i <
tree->num_nodes;
i++) {
310 tree->diagram_height = 0;
381 for (
i = 0;
i <
tree->diagram_height;
i++) {
408 if (pplayer && !show_all
427 if (nodes[tech] ==
NULL) {
461 tree->nodes[j++] = nodes[tech];
477 for (
i = 0;
i <
tree->num_nodes;
i++) {
484 for (
i = 0;
i <
tree->num_layers;
i++) {
487 if (
tree->layer_size) {
502 if (node->
layer != -1) {
509 node->
layer = max + 1;
520 for (
i = 0;
i <
tree->num_nodes;
i++) {
521 if (
tree->nodes[
i]) {
533 int max = node->
layer;
554 for (
i = 0;
i <
tree->num_nodes;
i++) {
561 if (
mpl >
tree->nodes[
i]->layer + 1) {
574 for (
i = 0;
i <
tree->num_nodes;
i++) {
579 tree->nodes[
i]->number =
i;
590 for (
i = 0;
i <
tree->num_nodes;
i++) {
601 for (j = node->
layer + 2; j <
mpl; j++) {
605 for (j = node->
layer + 1; j <
mpl; j++) {
611 for (j = 0; j < node->
nprovide; j++) {
646 for (
i = 0;
i <
tree->num_nodes;
i++) {
647 num_layers =
MAX(num_layers,
tree->nodes[
i]->layer);
650 tree->num_layers = num_layers;
658 for (
i = 0;
i < num_layers;
i++) {
660 tree->layer_size[
i] = 0;
662 for (
i = 0;
i <
tree->num_nodes;
i++) {
663 tree->layer_size[
tree->nodes[
i]->layer]++;
666 for (
i = 0;
i < num_layers;
i++) {
670 for (
i = 0;
i <
tree->num_nodes;
i++) {
692 if (a->
value > b->value) {
695 if (a->
value < b->value) {
707 if (
tree->layer_size[layer] > 0) {
712 for (
i = 0;
i <
tree->layer_size[layer];
i++) {
717 for (j = 0; j < node->
nrequire; j++) {
730 T[
i].node->order =
i;
753 for (j = 0; j < node->
nprovide; j++) {
756 for (j = 0; j < node->
nprovide; j++) {
786 int layers =
tree->num_layers;
790 for (
i = 0;
i < layers - 1;
i++) {
795 int layer_size =
tree->layer_size[
layer];
801 if (
layer < layers - 1) {
805 for (
x1 = 0;
x1 < layer_size;
x1++) {
806 for (
x2 =
x1 + 1;
x2 < layer_size;
x2++) {
814 if (
layer < layers - 1) {
824 if (
layer < layers - 1) {
851 for (j = 0; j < 20; j++) {
852 for (
i = 0;
i <
tree2->num_layers;
i++) {
858 for (j = 0; j < 20; j++) {
1046 for (
i = 0;
i <
tree->num_layers;
i++) {
1047 for (j = 0; j <
tree->layer_size[
i]; j++) {
1151 for (k = 0; k < node->
nprovide; k++) {
1180 for (
i = 0;
i <
tree->num_nodes;
i++) {
1200 int *
x,
int *
y,
int *w,
int *h)
1204 for (
i = 0;
i <
tree->num_nodes;
i++) {
struct canvas int int struct sprite int int int int height
struct canvas int int int int struct sprite *sprite canvas_put_rectangle
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int int int struct sprite *sprite struct canvas struct color int int int int height canvas_put_line
struct canvas int int struct sprite int int int width
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
void canvas_put_sprite_full(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite)
void get_text_size(int *width, int *height, enum client_font font, const char *text)
void canvas_put_curved_line(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_action(condition, action)
#define fc_calloc(n, esz)
#define fc_realloc(ptr, sz)
struct client_options gui_options
static int max_provide_layer(struct tree_node *node)
static int longest_path(struct tree_node *node)
static void barycentric_sort(struct reqtree *tree, int layer)
static int cmp_func(const void *_a, const void *_b)
void draw_reqtree(struct reqtree *tree, struct canvas *pcanvas, int canvas_x, int canvas_y, int tt_x, int tt_y, int w, int h)
void get_reqtree_dimensions(struct reqtree *reqtree, int *width, int *height)
static void node_rectangle_minimum_size(struct tree_node *node, int *width, int *height)
static void add_requirement(struct tree_node *node, struct tree_node *req)
static enum color_std node_color(struct tree_node *node)
static int count_crossings(struct reqtree *tree, int layer)
static void improve(struct reqtree *tree)
static void symmetrize(struct reqtree *tree)
static struct reqtree * add_dummy_nodes(struct reqtree *tree)
static void set_layers(struct reqtree *tree)
static void longest_path_layering(struct reqtree *tree)
static void calculate_diagram_layout(struct reqtree *tree)
Tech_type_id get_tech_on_reqtree(struct reqtree *tree, int x, int y)
bool find_tech_on_reqtree(struct reqtree *tree, Tech_type_id tech, int *x, int *y, int *w, int *h)
static void swap(struct reqtree *tree, int layer, int order1, int order2)
static enum reqtree_edge_type get_edge_type(struct tree_node *node, struct tree_node *dest_node)
static enum color_std edge_color(struct tree_node *node, struct tree_node *dest_node)
static struct tree_node * new_tree_node(void)
void destroy_reqtree(struct reqtree *tree)
struct reqtree * create_reqtree(struct player *pplayer, bool show_all)
static struct reqtree * create_dummy_reqtree(struct player *pplayer, bool show_all)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
bool research_goal_tech_req(const struct research *presearch, Tech_type_id goal, 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 sprite int int int int struct sprite int int float bool smooth get_sprite_dimensions
bool reqtree_curved_lines
struct tree_node ** nodes
struct tree_node *** layers
struct tree_node ** provide
struct tree_node ** require
struct advance * advance_by_number(const Tech_type_id atype)
struct advance * valid_advance_by_number(const Tech_type_id id)
Tech_type_id advance_required(const Tech_type_id tech, enum tech_req require)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_max(_start, _index, _max)
#define advance_index_iterate_max_end
static Tech_type_id advance_count(void)
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
#define unit_type_iterate(_p)
#define unit_type_iterate_end