Separated game-specific graph behavior into a subclass, implemented 2 players alternating turns
This commit is contained in:
21
graph.h
21
graph.h
@ -31,28 +31,29 @@ struct Edge
|
||||
class Graph
|
||||
{
|
||||
public:
|
||||
Graph();
|
||||
~Graph();
|
||||
|
||||
bool vertex_present(int x, int y, int size);
|
||||
Graph(bool planar);
|
||||
virtual ~Graph();
|
||||
|
||||
list<Vertex*> get_vertices() const { return vertices; }
|
||||
list<Edge> get_edges() const { return edges; }
|
||||
|
||||
void select_vertex(int x, int y);
|
||||
void do_vertex(int x, int y, int r, int colour);
|
||||
bool point_in_vertex(int x, int y, int size);
|
||||
Vertex * vertex_at(int x, int y);
|
||||
virtual bool add_vertex(int x, int y, int r, int colour, Vertex* src=NULL);
|
||||
|
||||
Vertex* get_current_vertex() const { return current_vertex; }
|
||||
void clear_current_vertex() { current_vertex = NULL; }
|
||||
bool is_planar() const { return planar; }
|
||||
void set_planar(bool planar) { this->planar = planar; }
|
||||
|
||||
private:
|
||||
void add_vertex(int x, int y, int r, int colour);
|
||||
bool vertex_would_overlap(int x, int y, int r);
|
||||
bool crosses_edge(Edge e);
|
||||
|
||||
Vertex* current_vertex;
|
||||
protected:
|
||||
list<Vertex*> vertices;
|
||||
list<Edge> edges;
|
||||
|
||||
private:
|
||||
bool planar;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user