|
Freeciv-3.2
|
#include <stdarg.h>#include <string.h>#include "log.h"#include "government.h"#include "improvement.h"#include "research.h"#include "tech.h"#include "client_main.h"#include "options.h"#include "tilespec.h"#include "reqtree.h"#include "colors_g.h"#include "sprite_g.h"Go to the source code of this file.
Data Structures | |
| struct | tree_node |
| struct | reqtree |
| struct | node_and_float |
Enumerations | |
| enum | reqtree_edge_type { REQTREE_EDGE = 0 , REQTREE_READY_EDGE , REQTREE_KNOWN_EDGE , REQTREE_ACTIVE_EDGE , REQTREE_GOAL_EDGE } |
Create new tree which has dummy nodes added. The source tree is completely copied, you can freely deallocate it.
Definition at line 549 of file reqtree.c.
Referenced by create_reqtree().
Add requirement edge to node and provide edge to req
Definition at line 121 of file reqtree.c.
Referenced by add_dummy_nodes(), and create_dummy_reqtree().
Simple heuristic: Sort nodes on the given layer by the average x-value of its parents.
Definition at line 707 of file reqtree.c.
Referenced by create_reqtree().
Calculate rectangles position and size from the tree. Logical order should already be calculated.
Definition at line 297 of file reqtree.c.
Referenced by create_reqtree().
Comparison function used by barycentric_sort.
Definition at line 690 of file reqtree.c.
Referenced by barycentric_sort().
Create a "dummy" tech tree from current ruleset. This tree is then fleshed out further (see create_reqtree() ). This tree doesn't include dummy edges. Layering and ordering isn't done also.
If pplayer is given, add only techs reachable by that player to tree.
Definition at line 395 of file reqtree.c.
Referenced by create_reqtree().
Generate optimized tech_tree from current ruleset. You should free it by destroy_reqtree().
If pplayer is not NULL, techs unreachable to that player are not shown.
Definition at line 841 of file reqtree.c.
Referenced by research_diagram::reset(), and science_diagram_data().
Free all memory used by tech_tree struct
Definition at line 475 of file reqtree.c.
Referenced by create_reqtree(), research_diagram::reset(), science_diagram_data(), and research_diagram::~research_diagram().
| 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 | ||
| ) |
Draw the reqtree diagram!
This draws the given portion of the reqtree diagram (given by (tt_x,tt_y) and (w,h) onto the canvas at position (canvas_x, canvas_y).
Definition at line 1038 of file reqtree.c.
Referenced by science_diagram_update(), science_diagram_update(), and research_diagram::update_reqtree().
Return a stroke color for an edge between two nodes if node is a dummy, dest_node can be NULL
Definition at line 1012 of file reqtree.c.
Referenced by draw_reqtree().
| bool find_tech_on_reqtree | ( | struct reqtree * | tree, |
| Tech_type_id | tech, | ||
| int * | x, | ||
| int * | y, | ||
| int * | w, | ||
| int * | h | ||
| ) |
Return the position of the given tech on the reqtree. Return TRUE iff it was found.
Definition at line 1203 of file reqtree.c.
Referenced by science_diagram_center().
|
static |
Return the type for an edge between two nodes if node is a dummy, dest_node can be NULL
Definition at line 942 of file reqtree.c.
Referenced by edge_color(), and get_edge_type().
Give the dimensions of the reqtree.
Definition at line 872 of file reqtree.c.
Referenced by research_diagram::reset(), science_diagram_center(), science_diagram_data(), science_diagram_update(), and science_diagram_update().
| Tech_type_id get_tech_on_reqtree | ( | struct reqtree * | tree, |
| int | x, | ||
| int | y | ||
| ) |
Return the tech ID at the given position of the reqtree (or A_NONE).
Definition at line 1180 of file reqtree.c.
Referenced by research_diagram::mousePressEvent(), science_diagram_button_release_callback(), science_diagram_left_button_up(), and science_diagram_right_button_up().
Try to reduce the number of crossings by swapping two nodes and checking if it improves the situation.
Definition at line 786 of file reqtree.c.
Referenced by create_reqtree().
Compute the longest path from this tree_node to the node with no requirements. Store the result in node->layer.
Definition at line 500 of file reqtree.c.
Referenced by longest_path(), and longest_path_layering().
Compute longest_path for all nodes, thus prepare longest path layering
Definition at line 518 of file reqtree.c.
Referenced by create_reqtree().
Find the largest value of layer amongst children of the given node
Definition at line 532 of file reqtree.c.
Referenced by add_dummy_nodes().
Allocate and initialize new tree node
Definition at line 142 of file reqtree.c.
Referenced by add_dummy_nodes(), and create_dummy_reqtree().
Return a background color of node's rectangle
Definition at line 886 of file reqtree.c.
Referenced by draw_reqtree().
|
static |
Return minimum size of the rectangle in pixels on the diagram which corresponds to the given node
Definition at line 159 of file reqtree.c.
Referenced by calculate_diagram_layout().
Calculate layers[] and layer_size[] fields of tree. There should be layer value calculated for each node. Nodes will be put into layers in no particular order.
Definition at line 642 of file reqtree.c.
Referenced by create_reqtree().