1 #include <core/repository.h>
2 #include <core/variantloader.h>
6 #include "moveserializer.h"
11 using namespace Shogi
;
13 extern "C" KDE_EXPORT Repository
*
14 taguashogi_initrepo(IVariantLoader
* loader
) {
15 Repository
* repo
= new Repository
;
16 Repository
* chess
= loader
->getRepository("chess");
18 // bail out if there is no chess variant
21 Repository
* crazyhouse
= loader
->getRepository("crazyhouse");
23 // bail out if there is no crazyhouse variant
27 repo
->addComponent("player/0", dynamic_cast<Component
*>(COLORS
[0]));
28 repo
->addComponent("player/1", dynamic_cast<Component
*>(COLORS
[1]));
30 repo
->addComponent("type/king", King::self());
31 repo
->addComponent("type/gold", Gold::self());
32 repo
->addComponent("type/silver", Silver::self());
33 repo
->addComponent("type/knight", Knight::self());
34 repo
->addComponent("type/lance", Lance::self());
35 repo
->addComponent("type/rook", Rook::self());
36 repo
->addComponent("type/bishop", Bishop::self());
37 repo
->addComponent("type/pawn", Pawn::self());
40 // create crazyhouse behaviour
41 IState
* crazyhouse_state
= requestInterface
<IState
>(crazyhouse
->getComponent("state"));
42 repo
->addComponent("state", new State(crazyhouse_state
->behaviour(), Point(9, 9)));
44 IState
* chess_state
= requestInterface
<IState
>(chess
->getComponent("state"));
45 repo
->addComponent("state", new State(new Behaviour(chess_state
->behaviour()), Point(9, 9)));
48 Validator
* validator
= new Validator
;
49 repo
->addComponent("validator", validator
);
50 repo
->addComponent("animator_factory", chess
->getComponent("animator_factory"));
51 repo
->addComponent("namer", chess
->getComponent("namer"));
52 repo
->addComponent("policy", chess
->getComponent("policy"));
54 repo
->addComponent("move_serializer/simple",
55 new MoveSerializer("simple", validator
));
56 repo
->addComponent("move_serializer/decorated",
57 new MoveSerializer("decorated", validator
));
58 MoveSerializer
* san
= new MoveSerializer("compact", validator
);
59 repo
->addComponent("move_serializer/san", san
);
60 repo
->addComponent("move_serializer/compact", san
);