Freeciv21
Develop your civilization from humble roots to a global empire
view_research_reqtree.h File Reference
#include "canvas.h"
#include <QRect>
+ Include dependency graph for view_research_reqtree.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tree_node
 
struct  reqtree
 
class  req_tooltip_help
 

Functions

struct reqtreecreate_reqtree (struct player *pplayer, bool show_all)
 Generate optimized tech_tree from current ruleset. More...
 
void destroy_reqtree (struct reqtree *tree)
 Free all memory used by tech_tree struct. More...
 
void get_reqtree_dimensions (struct reqtree *tree, int *width, int *height)
 Give the dimensions of the reqtree. More...
 
QList< req_tooltip_help * > * draw_reqtree (struct reqtree *tree, QPixmap *pcanvas, int canvas_x, int canvas_y, int tt_x, int tt_y, int w, int h)
 Draw the reqtree diagram! More...
 
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). More...
 
bool get_position_on_reqtree (struct reqtree *tree, Tech_type_id tech, int *x, int *y)
 Find the center of a node, identified by tech id in a given reqtree and return true if the node was found; false otherwise. More...
 

Function Documentation

◆ create_reqtree()

struct reqtree* create_reqtree ( struct player pplayer,
bool  show_all 
)

Generate optimized tech_tree from current ruleset.

You should free it by destroy_reqtree.

If pplayer is not nullptr, techs unreachable to that player are not shown.

Definition at line 789 of file view_research_reqtree.cpp.

Referenced by research_diagram::reset().

◆ destroy_reqtree()

void destroy_reqtree ( struct reqtree tree)

Free all memory used by tech_tree struct.

Definition at line 433 of file view_research_reqtree.cpp.

Referenced by create_reqtree(), research_diagram::reset(), and research_diagram::~research_diagram().

◆ draw_reqtree()

QList<req_tooltip_help *>* draw_reqtree ( struct reqtree tree,
QPixmap *  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 984 of file view_research_reqtree.cpp.

Referenced by research_diagram::update_reqtree().

◆ get_position_on_reqtree()

bool get_position_on_reqtree ( struct reqtree tree,
Tech_type_id  tech,
int *  x,
int *  y 
)

Find the center of a node, identified by tech id in a given reqtree and return true if the node was found; false otherwise.

If a node is found, x and y are filled with the center of the node in reqtrees coordinate system.

Definition at line 1193 of file view_research_reqtree.cpp.

Referenced by research_diagram::get_tech_position().

◆ get_reqtree_dimensions()

void get_reqtree_dimensions ( struct reqtree tree,
int *  width,
int *  height 
)

Give the dimensions of the reqtree.

Definition at line 820 of file view_research_reqtree.cpp.

Referenced by research_diagram::reset().

◆ get_tech_on_reqtree()

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 1168 of file view_research_reqtree.cpp.

Referenced by research_diagram::mousePressEvent().