-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboard.h
More file actions
95 lines (88 loc) · 2.54 KB
/
Copy pathboard.h
File metadata and controls
95 lines (88 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef BOARD_HPP
#define BOARD_HPP
#include <SFML/Graphics.hpp>
#include <string>
#include <vector>
#include <sstream>
#include <chrono>
#include "boardsettings.h"
#include "connection.h"
using namespace std;
class Tile;
class Piece;
class Move;
class Player;
enum GameResult;
class PromotionTile;
class EndScreen;
class Timer;
class Button;
class Connection;
class Board {
public:
Tile*** tiles;
vector<Piece*> pieces;
bool running = true;
vector<Move*> moveHistory;
Player** players;
int turn;
int me;
Tile* selected_tile = NULL;
vector<Piece*> deadPieces;
vector<Move*>** move_cache;
bool enabled = true;
GameResult game_result;
string winner;
bool waiting_promotion = false;
Tile* promotion_destination;
PromotionTile*** promotion_tiles;
Piece* promotion_piece;
Move* promotion_move;
int dullMoves = 0;
vector<string> boardHistory;
Timer** timers;
vector<Button*> buttons;
EndScreen* end_screen;
bool message_waiting = false;
string message;
chrono::time_point<chrono::high_resolution_clock> start_time;
int game_tick = 0;
int last_reported_game_tick = 0;
shared_ptr<Connection> connection;
mutex end_screen_mutex;
Board(shared_ptr<Connection> c, int m, string wp, string bp);
void updateClocks();
void draw(sf::RenderWindow& window);
Tile*** createTiles();
vector<Piece*> createPieces(Tile*** tiles, Player** players);
Tile* getTileAtPosition(int x, int y, bool flipped);
bool noMoves(Player* player);
bool checkCheck(Player* player);
void makeDubiousMove(Move* move);
void undoDubiousMove();
vector<Move*>** createMoveCache();
void loadMoveCache(vector<Move*>** move_cache);
void calculateAllAvailableMoves();
void endGame(GameResult result);
void endGame(GameResult result, int player);
bool checkEndGame();
void exitGame();
void changeTurn();
void killPiece(Piece* piece);
void revivePiece(Piece* piece);
string boardFEN();
void addLogs();
void makeMove(Move* move, bool report);
//void undoMove();
void selectTile(Tile* tile);
void deselectTile(Tile* tile);
void displayPromotion(Move* move);
void handlePress(int x, int y);
void appendCPNP(string data);
string moveToCPNP(Move* move);
string getNotationFromTile(Tile* tile);
Tile* getTileFromNotation(string notation);
void decodeCPNP(string message);
string popMessage();
};
#endif