game engine implementation, rendering tasks offloaded to Board from Game
This commit is contained in:
59
Chinczyk188/Pawn.cpp
Normal file
59
Chinczyk188/Pawn.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#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() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user