a88fef26334d105373bad1c495f688327212423c
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.
11 #include <core/defaultpolicy.h>
12 #include <core/repository.h>
13 #include <core/variantloader.h>
16 #include "behaviour.h"
17 #include "castlingrules.h"
19 #include "moveserializer.h"
23 #include "validator.h"
25 using namespace Chess
;
27 extern "C" KDE_EXPORT Repository
* taguachess_initrepo(IVariantLoader
*) {
28 Repository
* repo
= new Repository
;
30 repo
->addComponent("player/0", dynamic_cast<Component
*>(COLORS
[0]));
31 repo
->addComponent("player/1", dynamic_cast<Component
*>(COLORS
[1]));
33 repo
->addComponent("type/king", King::self());
34 repo
->addComponent("type/queen", Queen::self());
35 repo
->addComponent("type/rook", Rook::self());
36 repo
->addComponent("type/bishop", Bishop::self());
37 repo
->addComponent("type/knight", Knight::self());
38 repo
->addComponent("type/pawn", Pawn::self());
40 CastlingRules
* castling_rules
= new CastlingRules
;
41 repo
->addComponent("extra/castling_rules", castling_rules
);
43 repo
->addComponent("state", new State(new Behaviour
, castling_rules
, Point(8, 8)));
44 Validator
* validator
= new Validator
;
45 repo
->addComponent("validator", validator
);
46 repo
->addComponent("animator_factory", new AnimatorFactory
);
47 repo
->addComponent("namer", new Namer
);
48 repo
->addComponent("policy", new DefaultPolicy
);
50 repo
->addComponent("move_serializer/simple",
51 new MoveSerializer("simple", validator
));
52 repo
->addComponent("move_serializer/decorated",
53 new MoveSerializer("decorated", validator
));
54 MoveSerializer
* san
= new MoveSerializer("compact", validator
);
55 repo
->addComponent("move_serializer/san", san
);
56 repo
->addComponent("move_serializer/compact", san
);
57 King::self()->setCastlingRules(castling_rules
);