refactor: removing some deprecated functions and removed array for c style array
This commit is contained in:
+13
-2
@@ -2,7 +2,18 @@
|
||||
#define ELEMENT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "point.hpp"
|
||||
#include "globals.hpp"
|
||||
|
||||
struct Point {
|
||||
int m_row;
|
||||
int m_col;
|
||||
int m_direction;
|
||||
Point() {}
|
||||
Point(int x, int y) : m_row(x), m_col(y) {}
|
||||
Point(int x, int y, int dir) : m_row(x), m_col(y), m_direction(dir) {}
|
||||
|
||||
void set_new_point(int row, int col, int dir);
|
||||
};
|
||||
|
||||
struct Head {
|
||||
Head();
|
||||
@@ -29,7 +40,7 @@ struct Body {
|
||||
struct Fruit {
|
||||
Fruit();
|
||||
Point m_point;
|
||||
void get_new_pos(std::array<std::array<char, COL>, ROW> &board, Head &head, int &score);
|
||||
void get_new_pos(char (&board)[ROW][COL], Head &head, int &score);
|
||||
};
|
||||
|
||||
#endif // ELEMENT_HPP
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
#ifndef GLOBALS_HPP
|
||||
#define GLOBALS_HPP
|
||||
|
||||
constexpr unsigned int ROW = 11;
|
||||
constexpr unsigned int COL = 11;
|
||||
#define ROW 10
|
||||
#define COL 10
|
||||
|
||||
#endif // GLOBALS_HPP
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef POINT_HPP
|
||||
#define POINT_HPP
|
||||
|
||||
#include <array>
|
||||
#include "globals.hpp"
|
||||
|
||||
struct Point {
|
||||
int m_row;
|
||||
int m_col;
|
||||
int m_direction;
|
||||
Point() {}
|
||||
Point(int x, int y) : m_row(x), m_col(y) {}
|
||||
Point(int x, int y, int dir) : m_row(x), m_col(y), m_direction(dir) {}
|
||||
|
||||
void clear(std::array<std::array<char, COL>, ROW> &board) const;
|
||||
void set_new_point(int row, int col, int dir);
|
||||
};
|
||||
|
||||
#endif // POINT_HPP
|
||||
+2
-3
@@ -1,12 +1,11 @@
|
||||
#ifndef WINDOW_HPP
|
||||
#define WINDOW_HPP
|
||||
#include <array>
|
||||
|
||||
#include "globals.hpp"
|
||||
#include "element.hpp"
|
||||
|
||||
struct Window {
|
||||
Window();
|
||||
std::array<std::array<char, COL>, ROW> m_board;
|
||||
char m_board[ROW][COL] = {};
|
||||
void update_display(Fruit &fruit, Head &head, Body &body);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user