Ported Animator, UnwrappedGraphicalApi and MoveFactory.
[tagua/yd.git] / src / hlvariant / movefactory.h
blob86ad9b023a61f101c6c5d6373bd5378bad846964
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 HLVARIANT__MOVEFACTORY_H
12 #define HLVARIANT__MOVEFACTORY_H
14 #include "tagua.h"
15 #include "usermove.h"
16 #include "variantdata.h"
18 namespace HLVariant {
20 template <typename GameState>
21 class MoveFactory {
22 typedef typename GameState::Move Move;
23 typedef typename GameState::Board::Piece Piece;
24 public:
25 virtual ~MoveFactory() { }
27 virtual Move createNormalMove(const NormalUserMove& move) {
28 return Move(move.from, move.to, static_cast<typename Piece::Type>(move.promotionType()));
31 virtual Move createDropMove(const DropUserMove& move) {
32 return Move();
35 virtual NormalUserMove toNormal(const Move& move) {
36 return NormalUserMove(move.from, move.to);
42 #endif // HLVARIANT__MOVEFACTORY_H