summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-10 22:30:38 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-10 22:30:38 +0900
commit2ebdd6789550b4e4f35cb976464e28982cd5fb41 (patch)
treee2d0c2819f8fc010c1de27358bc0b3c513b502cc /src
parent:v: (diff)
downloadsharkey-2ebdd6789550b4e4f35cb976464e28982cd5fb41.tar.gz
sharkey-2ebdd6789550b4e4f35cb976464e28982cd5fb41.tar.bz2
sharkey-2ebdd6789550b4e4f35cb976464e28982cd5fb41.zip
othello/games/show にボードの状態やターン情報を含めるように
Diffstat (limited to 'src')
-rw-r--r--src/api/endpoints/othello/games/show.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/api/endpoints/othello/games/show.ts b/src/api/endpoints/othello/games/show.ts
index 9dc8f24900..2b0db4dd00 100644
--- a/src/api/endpoints/othello/games/show.ts
+++ b/src/api/endpoints/othello/games/show.ts
@@ -1,5 +1,6 @@
import $ from 'cafy';
import Game, { pack } from '../../../models/othello-game';
+import Othello from '../../../../common/othello/core';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'game_id' parameter
@@ -12,5 +13,20 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
return rej('game not found');
}
- res(await pack(game, user));
+ const o = new Othello(game.settings.map, {
+ isLlotheo: game.settings.is_llotheo,
+ canPutEverywhere: game.settings.can_put_everywhere,
+ loopedBoard: game.settings.looped_board
+ });
+
+ game.logs.forEach(log => {
+ o.put(log.color, log.pos);
+ });
+
+ const packed = await pack(game, user);
+
+ res(Object.assign({
+ board: o.board,
+ turn: o.turn
+ }, packed));
});