initial commit
This commit is contained in:
parent
99d725ef3e
commit
f5c6fd76a1
0
src/chessmen.cpp
Executable file
0
src/chessmen.cpp
Executable file
28
src/chessmen.hpp
Executable file
28
src/chessmen.hpp
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef _CHESSMEN_HPP_
|
||||||
|
#define _CHESSMEN_HPP_
|
||||||
|
|
||||||
|
/*=== LIBRARIES ==============================================================*/
|
||||||
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
/*=== LIBRARY FORWARD ========================================================*/
|
||||||
|
|
||||||
|
|
||||||
|
/*=== MAIN ===================================================================*/
|
||||||
|
class chessmen{
|
||||||
|
public:
|
||||||
|
chessmen(std::string & Name, unsigned Colour);
|
||||||
|
chessmen(std::string && Name, unsigned Colour);
|
||||||
|
|
||||||
|
std::string name();
|
||||||
|
unsigned colour();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _Name;
|
||||||
|
unsigned _Colour;
|
||||||
|
};
|
||||||
|
#endif
|
16
src/field.cpp
Executable file
16
src/field.cpp
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#include "field.hpp"
|
||||||
|
|
||||||
|
field::field(): _CoordX(0),_CoordY(0), _Figure(NULL){
|
||||||
|
}
|
||||||
|
|
||||||
|
field::field(unsigned CoordX, unsigned CoordY): _CoordX(CoordX),_CoordY(CoordY){
|
||||||
|
_Figure = std::make_shared<chessmen>(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
field::field(unsigned CoordX, unsigned CoordY, int & Figure): _CoordX(CoordX),_CoordY(CoordY){
|
||||||
|
_Figure = std::make_shared<chessmen>(Figure);
|
||||||
|
}
|
||||||
|
|
||||||
|
field::field(unsigned CoordX, unsigned CoordY, int && Figure): _CoordX(CoordX),_CoordY(CoordY){
|
||||||
|
_Figure = std::make_shared<chessmen>(Figure);
|
||||||
|
}
|
30
src/field.hpp
Executable file
30
src/field.hpp
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef _FIELD_HPP_
|
||||||
|
#define _FIELD_HPP_
|
||||||
|
|
||||||
|
|
||||||
|
/*=== LIBRARIES ==============================================================*/
|
||||||
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
/*=== LIBRARY FORWARD ========================================================*/
|
||||||
|
class chessmen;
|
||||||
|
|
||||||
|
/*=== MAIN ===================================================================*/
|
||||||
|
class field{
|
||||||
|
public:
|
||||||
|
field();
|
||||||
|
field(unsigned CoordX, unsigned CoordY);
|
||||||
|
field(unsigned CoordX, unsigned CoordY, int & Figure);
|
||||||
|
field(unsigned CoordX, unsigned CoordY, int && Figure);
|
||||||
|
|
||||||
|
bool has_figure();
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned _CoordX;
|
||||||
|
unsigned _CoordY;
|
||||||
|
|
||||||
|
std::shared_ptr<chessmen> _Figure;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user