15 lines
387 B
C++
15 lines
387 B
C++
|
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;
|
||
|
}
|
||
|
|
||
|
return *p;
|
||
|
}
|