minor nitpicks
This commit is contained in:
@@ -233,7 +233,7 @@ void Board::selectAField(short &pickStatus, short &field) {
|
|||||||
case sf::Event::Closed:
|
case sf::Event::Closed:
|
||||||
this->closeWindow();
|
this->closeWindow();
|
||||||
// Zamknięcie okna powinno wyjść z tej pętli
|
// Zamknięcie okna powinno wyjść z tej pętli
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case sf::Event::MouseButtonPressed:
|
case sf::Event::MouseButtonPressed:
|
||||||
// Informacje musimy pobrać przy naciśnięciu,
|
// Informacje musimy pobrać przy naciśnięciu,
|
||||||
@@ -257,7 +257,9 @@ void Board::selectAField(short &pickStatus, short &field) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case sf::Event::Resized:
|
case sf::Event::Resized:
|
||||||
std::cout << "resized triggered: " << currentEvent.size.width << " " << currentEvent.size.height << "\n";
|
#ifdef DEBUG
|
||||||
|
std::cout << "Resized event triggered: " << currentEvent.size.width << " " << currentEvent.size.height << "\n";
|
||||||
|
#endif
|
||||||
this->handleResize(currentEvent.size.width, currentEvent.size.height);
|
this->handleResize(currentEvent.size.width, currentEvent.size.height);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void Engine::nextTurn() {
|
|||||||
// Rysuj pionki
|
// Rysuj pionki
|
||||||
// ...
|
// ...
|
||||||
this->board.drawPawns();
|
this->board.drawPawns();
|
||||||
|
this->board.render();
|
||||||
|
|
||||||
// Rzut kostką
|
// Rzut kostką
|
||||||
if (dicerollLoaded) this->dicerollBuffer.play();
|
if (dicerollLoaded) this->dicerollBuffer.play();
|
||||||
@@ -187,6 +188,12 @@ void Engine::nextTurn() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isMovePossible) {
|
||||||
|
pickAPlace = false;
|
||||||
|
std::cout << "Niestety, nie mozna wykonac zadnego ruchu.\n";
|
||||||
|
this->board.smartSleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
if (pickAPlace) {
|
if (pickAPlace) {
|
||||||
std::cout << "Wybierz prosze pionek na planszy, ktorym chcesz wykonac ruch.\n";
|
std::cout << "Wybierz prosze pionek na planszy, ktorym chcesz wykonac ruch.\n";
|
||||||
}
|
}
|
||||||
@@ -196,9 +203,9 @@ void Engine::nextTurn() {
|
|||||||
short pickStatus = 0;
|
short pickStatus = 0;
|
||||||
short selectedField = -1;
|
short selectedField = -1;
|
||||||
if (!pickAPlace) pickStatus = 8; // pomiń pętlę
|
if (!pickAPlace) pickStatus = 8; // pomiń pętlę
|
||||||
while (!moveResult) {
|
while (!moveResult && this->board.running()) {
|
||||||
|
|
||||||
while (pickStatus != 8) {
|
while (pickStatus != 8 && this->board.running()) {
|
||||||
|
|
||||||
this->board.selectAField(pickStatus, selectedField);
|
this->board.selectAField(pickStatus, selectedField);
|
||||||
|
|
||||||
@@ -206,7 +213,7 @@ void Engine::nextTurn() {
|
|||||||
|
|
||||||
if (pickAPlace) {
|
if (pickAPlace) {
|
||||||
moveResult = this->movePiece(currentPlayer.getColor(), selectedField, diceRoll);
|
moveResult = this->movePiece(currentPlayer.getColor(), selectedField, diceRoll);
|
||||||
if (!moveResult) {
|
if (!moveResult && selectedField != -1) {
|
||||||
std::cout << "Nie mozesz wykonac tego ruchu.\n";
|
std::cout << "Nie mozesz wykonac tego ruchu.\n";
|
||||||
this->invalidBuffer.play();
|
this->invalidBuffer.play();
|
||||||
this->board.smartSleep(1000);
|
this->board.smartSleep(1000);
|
||||||
@@ -221,7 +228,10 @@ void Engine::nextTurn() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do debugowania zaznaczonego pola
|
||||||
|
#ifdef DEBUG
|
||||||
std::cout << "(Engine.cpp) selected: " << selectedField << "\n";
|
std::cout << "(Engine.cpp) selected: " << selectedField << "\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
// Jeżeli gracz się ruszył, odtwórz dźwięk ruchu
|
// Jeżeli gracz się ruszył, odtwórz dźwięk ruchu
|
||||||
if (selectedField != -1) {
|
if (selectedField != -1) {
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ class Engine {
|
|||||||
short getFirstPawnAtBase(short color);
|
short getFirstPawnAtBase(short color);
|
||||||
short getFirstPawnNotAtBase(short color);
|
short getFirstPawnNotAtBase(short color);
|
||||||
short fieldToFirstPawnId(short color, short field);
|
short fieldToFirstPawnId(short color, short field);
|
||||||
|
bool isMoveLegal(short color, short field, short steps);
|
||||||
short checkPossibleMoves(short color, short steps);
|
short checkPossibleMoves(short color, short steps);
|
||||||
|
short fieldToColor(short field);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
bool dicerollLoaded = true;
|
bool dicerollLoaded = true;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
CC = "C:\\msys64\\mingw64\\bin\\g++.exe"
|
CC = "C:\\msys64\\mingw64\\bin\\g++.exe"
|
||||||
DEPS = -lsfml-graphics-s -lsfml-window-s -lsfml-audio-s -lopenal32 -lfreetype -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -lpthread
|
DEPS = -lsfml-graphics-s -lsfml-window-s -lsfml-audio-s -lopenal32 -lfreetype -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -lpthread
|
||||||
LINK = -L. -Lres/SFML/lib-mingw/
|
LINK = -L. -Lres/SFML/lib-mingw/
|
||||||
FLAGS = -DSFML_STATIC # -DCHINCZYK188_IGNORE_USER_SEED
|
FLAGS = -DSFML_STATIC # -DCHINCZYK188_IGNORE_USER_SEED -DDEBUG
|
||||||
OUTPUT = output.exe
|
OUTPUT = output.exe
|
||||||
CPPSTD = c++17
|
CPPSTD = c++17
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Pawn.hpp"
|
#include "Pawn.hpp"
|
||||||
|
#include "Utils.hpp"
|
||||||
|
|
||||||
class Player {
|
class Player {
|
||||||
public:
|
public:
|
||||||
@@ -13,6 +14,7 @@ class Player {
|
|||||||
int getRollCount() const;
|
int getRollCount() const;
|
||||||
short getColor() const;
|
short getColor() const;
|
||||||
short* getRelativePawns();
|
short* getRelativePawns();
|
||||||
|
bool isPawnAtHome(short pawnId);
|
||||||
|
|
||||||
void incrementRollCount();
|
void incrementRollCount();
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ class Player {
|
|||||||
short pawnsAtBase = 4;
|
short pawnsAtBase = 4;
|
||||||
short pawnsActive = 0;
|
short pawnsActive = 0;
|
||||||
short pawnsAtHome = 0;
|
short pawnsAtHome = 0;
|
||||||
|
void recalculatePawnStates();
|
||||||
|
|
||||||
bool hasWon() const;
|
bool hasWon() const;
|
||||||
bool hasLeftBase = false;
|
bool hasLeftBase = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user