initial commit

This commit is contained in:
Lars Hahn 2024-08-10 20:25:17 +02:00
parent 99d725ef3e
commit f5c6fd76a1
4 changed files with 74 additions and 0 deletions

0
src/chessmen.cpp Executable file
View File

28
src/chessmen.hpp Executable file
View 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
View 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
View 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