Rename delegate members, trying to avoid confusion.
[tagua/yd.git] / src / variants / crazyhouse / behaviour.cpp
blobd2be9a2095855fa16a3088443fd81bb61af801d7
1 /*
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.
8 */
10 #include "behaviour.h"
12 #include <core/board.h>
13 #include <core/piece.h>
14 #include <core/poolcollection.h>
15 #include <core/pool.h>
16 #include <core/state.h>
17 #include "global.h"
19 namespace Crazyhouse {
21 Behaviour::Behaviour(const IBehaviour* behaviour)
22 : Delegators::Behaviour(behaviour) { }
24 void Behaviour::captureOn(IState* state, const Point& square) const {
25 Piece captured = state->board()->get(square);
26 if (captured != Piece()) {
27 if (captured.get("promoted").toBool()) {
28 captured.setType(pawn);
30 state->pools()->pool(opponent(captured.color()))->insert(-1, captured);
32 m_dgate_behaviour->captureOn(state, square);
35 } // namespace Crazyhouse