59 lines
712 B
C++
59 lines
712 B
C++
#include "Pawn.hpp"
|
|
|
|
// Konstruktor
|
|
Pawn::Pawn() {
|
|
|
|
this->position = -1;
|
|
this->grid_x = -1;
|
|
this->grid_y = -1;
|
|
|
|
}
|
|
|
|
// Gettery i settery
|
|
int Pawn::getRelativePosition() const {
|
|
|
|
return this->position;
|
|
|
|
}
|
|
|
|
void Pawn::setRelativePosition(int position) {
|
|
|
|
this->position = position;
|
|
|
|
}
|
|
|
|
int Pawn::move(int fields) {
|
|
|
|
switch (fields) {
|
|
|
|
case -1:
|
|
// Przenieś do bazy
|
|
// 0 = ok
|
|
return 0;
|
|
|
|
case 0:
|
|
// Wstaw na planszę
|
|
// 0 = ok
|
|
return 0;
|
|
|
|
default:
|
|
// Sprawdź:
|
|
// a) czy da się wejść na to miejsce
|
|
// b) czy są pionki do zbicia
|
|
// c) czy są inne pionki tego samego gracza
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool Pawn::isAtBase() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
void Pawn::sendToBase() {
|
|
|
|
} |