From ba10c1cb7377c046dd28be5a4f80939c87248f10 Mon Sep 17 00:00:00 2001
From: Paolo Capriotti
Date: Sun, 15 Jul 2007 15:05:39 +0200
Subject: [PATCH] Restored Shogi.
The animator is broken.
---
src/CMakeLists.txt | 1 +
src/variants/shogi.cpp | 24 ++++++++++++++----------
src/variants/variants-autogen | 2 +-
src/variants/variants.cpp | 2 +-
4 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4f1cb2a..cda6863 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -27,6 +27,7 @@ set(kboard_SRC
variants/chess.cpp
variants/crazyhouse.cpp
+ variants/shogi.cpp
animationfactory.cpp
movelist.cpp
diff --git a/src/variants/shogi.cpp b/src/variants/shogi.cpp
index 23d80d5..9290641 100644
--- a/src/variants/shogi.cpp
+++ b/src/variants/shogi.cpp
@@ -271,6 +271,15 @@ public:
Piece::Color previousTurn() const { return Piece::oppositeColor(m_turn); }
void switchTurn() { m_turn = Piece::oppositeColor(m_turn); }
+ InteractionType movable(const Point& p) const {
+ if(!valid(p) || !m_board[p])
+ return NoAction;
+ return m_board[p].color() == m_turn ? Moving : Premoving;
+ }
+ InteractionType droppable(int p) const {
+ ShogiPiece::Color c = static_cast(p);
+ return c == m_turn ? Moving : Premoving;
+ }
void move(const ShogiMove& m);
void fromFEN(const QString&, bool& ok) { ok = false; }
@@ -591,17 +600,12 @@ VariantInfo* ShogiVariant::info() {
return static_shogi_variant;
}
-class ShogiAnimator {
- typedef UnwrappedGraphicalPosition::Ptr API;
-
- API m_api;
+class ShogiAnimator : public BaseAnimator {
+ typedef BaseAnimator Base;
+ typedef Base::API API;
public:
- ShogiAnimator(API api)
- : m_api(api) { }
-
- AnimationGroupPtr warp(const ShogiPosition& final) {
-
- }
+ ShogiAnimator(API cinterface)
+ : Base(cinterface) { }
};
template <>
diff --git a/src/variants/variants-autogen b/src/variants/variants-autogen
index dfe396e..3989592 100644
--- a/src/variants/variants-autogen
+++ b/src/variants/variants-autogen
@@ -8,5 +8,5 @@ register_variant();
// register_variant();
// register_variant();
// register_variant();
-// register_variant();
+register_variant();
// register_variant();
diff --git a/src/variants/variants.cpp b/src/variants/variants.cpp
index dea8116..e3fadea 100644
--- a/src/variants/variants.cpp
+++ b/src/variants/variants.cpp
@@ -12,6 +12,7 @@
#include "kboard.h"
#include "variants/chess.h"
#include "variants/crazyhouse.h"
+#include "variants/shogi.h"
#if 0
#include "variants/atomic.h"
@@ -21,7 +22,6 @@
#include "variants/connect4.h"
#include "variants/chainreaction.h"
#include "variants/dummy.h"
-#include "variants/shogi.h"
#include "variants/xiangqi.h"
#endif
--
2.11.4.GIT