summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-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));
});