Use Validator in chess MoveSerializer.
[tagua/yd.git] / src / variants / chess / chess.cpp
blob5c0e6fb64077e6391ebeef8603a252ba7acfc520
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2007 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 #include <core/defaultpolicy.h>
12 #include <core/repository.h>
13 #include <core/variantloader.h>
15 #include "animator.h"
16 #include "behaviour.h"
17 #include "colors.h"
18 #include "moveserializer.h"
19 #include "namer.h"
20 #include "types.h"
21 #include "statefactory.h"
22 #include "validator.h"
24 using namespace Chess;
26 extern "C" KDE_EXPORT Repository* taguachess_initrepo(IVariantLoader*) {
27 Repository* repo = new Repository;
29 repo->addComponent("player/0", White::self());
30 repo->addComponent("player/1", Black::self());
32 repo->addComponent("type/king", King::self());
33 repo->addComponent("type/queen", Queen::self());
34 repo->addComponent("type/rook", Rook::self());
35 repo->addComponent("type/bishop", Bishop::self());
36 repo->addComponent("type/knight", Knight::self());
37 repo->addComponent("type/pawn", Pawn::self());
39 repo->addComponent("state_factory", new StateFactory(new Behaviour, Point(8, 8)));
40 Validator* validator = new Validator;
41 repo->addComponent("validator", validator);
42 repo->addComponent("animator_factory", new AnimatorFactory);
43 repo->addComponent("namer", new Namer);
44 repo->addComponent("policy", new DefaultPolicy);
46 repo->addComponent("move_serializer/simple",
47 new MoveSerializer("simple", validator));
48 repo->addComponent("move_serializer/decorated",
49 new MoveSerializer("decorated", validator));
50 MoveSerializer* san = new MoveSerializer("compact", validator);
51 repo->addComponent("move_serializer/san", san);
52 repo->addComponent("move_serializer/compact", san);
54 return repo;