Initial porting to the new component API.
[tagua/yd.git] / src / hlvariant / movefactory.h
blobf1762a601ba12b2507325adba2e027f3eb1f1f91
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
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 "usermove.h"
15 #include "variantdata.h"
17 namespace HLVariant {
19 template <typename GameState>
20 class MoveFactory {
21 public:
22 typedef typename GameState::Move Move;
23 typedef typename GameState::Board::Piece Piece;
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&) {
32 return Move();
35 virtual NormalUserMove toNormal(const Move& move) {
36 return NormalUserMove(move.from(), move.to());
42 #endif // HLVARIANT__MOVEFACTORY_H