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

25 lines
572 B
C++
Raw Permalink Normal View History

// #include "PieceFactory.h"
2016-03-08 20:06:36 +00:00
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 << " [+] " << p->gett() << " at (" << p->getx() << "," << p->gety() << ")";
2016-03-08 18:23:35 +00:00
setfont();
cout << endl;
2016-03-06 21:51:07 +00:00
return *p;
}