2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
10 #include "moveserializer.h"
11 #include <core/board.h>
12 #include <core/state.h>
13 #include <core/type.h>
15 namespace Crazyhouse
{
17 MoveSerializer::MoveSerializer(IMoveSerializer
* serializer
)
18 : Delegators::MoveSerializer(serializer
) { }
20 QString
MoveSerializer::serialize(const Move
& move
, const IState
* ref
) const {
21 if (move
.drop() == Piece())
22 return m_serializer
->serialize(move
, ref
);
25 if (type() == "decorated") {
26 const IType
* type
= move
.drop().type();
28 res
= "{" + move
.drop().type()->name() + '}';
33 res
= symbol(move
.drop().type()).toUpper();
38 move
.dst().toString(ref
->board()->size().y
) +
42 } // namespace Crazyhouse