Rename delegate members, trying to avoid confusion.
[tagua/yd.git] / src / core / delegators / validator.h
blob9e32c99596e10ba6218a64e945ee4ee5f9cb964d
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 #ifndef DELEGATORS_VALIDATOR_H
11 #define DELEGATORS_VALIDATOR_H
13 #include "../validator.h"
15 namespace Delegators {
17 class Validator : public IValidator {
18 protected:
19 IValidator* m_dgate_validator;
20 public:
21 Validator(IValidator* validator)
22 : m_dgate_validator(validator) {
23 m_dgate_validator->setDelegator(this);
25 virtual ~Validator() { delete m_dgate_validator; }
26 virtual bool pseudolegal(const IState* state, Move& move) const {
27 return m_dgate_validator->pseudolegal(state, move);
29 virtual bool legal(const IState* state, Move& move) const {
30 return m_dgate_validator->legal(state, move);
32 virtual bool attacks(const IState* state, const IColor* player,
33 const Point& square, const Piece& target = Piece()) const {
34 return m_dgate_validator->attacks(state, player, square, target);
36 virtual const IColor* mover(const IState* state, const Move& move) const {
37 return m_dgate_validator->mover(state, move);
39 virtual void setDelegator(IValidator* delegator) {
40 return m_dgate_validator->setDelegator(delegator);
46 #endif // DELEGATORS_VALIDATOR_H