lab.cpp/Chess/dep/Pieces/PieceFactory.cpp

25 lines
567 B
C++
Raw Normal View History

2016-03-08 20:06:36 +00:00
#include "PieceFactory.h"
2016-03-06 21:51:07 +00:00
Piece& PieceFactory::create(PIECE_TYPE t, int x, int y){
Piece *p;
switch(t){
case ROI: p = new Roi(x, y); break;
case REINE: p = new Reine(x, y); break;
case CAVALIER: p = new Cavalier(x, y); break;
case FOU: p = new Fou(x, y); break;
case TOUR: p = new Tour(x, y); break;
case PION: p = new Pion(x, y); break;
}
2016-03-08 18:23:35 +00:00
/* DEBUG */
setfont(SKYBLUE, NORMAL);
cout << "\t[+] " << p->gett() << " at (" << p->getx() << "," << p->gety() << ")";
setfont();
cout << endl;
2016-03-06 21:51:07 +00:00
return *p;
}