Finished chess animator.
[tagua/yd.git] / src / movefactory.h
bloba1f7237e3bc40acb67a24f922ec2327db0e4d941
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef MOVEFACTORY_H
12 #define MOVEFACTORY_H
14 #include "kboard.h"
15 #include "usermove.h"
16 template <typename V> class WrappedPiece;
18 template <typename Variant>
19 struct MoveFactory {
20 static typename Variant::Move createNormalMove(const NormalUserMove& move) {
21 return typename Variant::Move(move.from, move.to,
22 static_cast<typename Variant::Piece::PromotionType>(move.promotionType));
24 static typename Variant::Move createDropMove(const typename Variant::Piece& piece, const Point& to) {
25 return Variant::Move::createDropMove(piece, to);
28 static NormalUserMove toNormal(const typename Variant::Move& move) {
29 return NormalUserMove(move.from, move.to);
33 #endif // MOVEFACTORY_H