aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts
diff options
context:
space:
mode:
authorMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-26 14:43:25 +0200
committerMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-26 14:43:25 +0200
commit6baaa14bde032afa363dbdd50119a20e9f47df1c (patch)
tree82e7ba81f36e725e282eadd5c8c61f4304b1bf85 /backend/ts
parent013319d7a4651d1708280f556e39c2f03839426a (diff)
downloadfia-6baaa14bde032afa363dbdd50119a20e9f47df1c.tar.gz
fia-6baaa14bde032afa363dbdd50119a20e9f47df1c.tar.zst
fia-6baaa14bde032afa363dbdd50119a20e9f47df1c.zip
Bugfixes: to home, [40] -> [1], not destroying old chequer
Diffstat (limited to 'backend/ts')
-rw-r--r--backend/ts/api/login.ts2
-rw-r--r--backend/ts/api/saveGameBoard.ts2
-rw-r--r--backend/ts/gameBoard.ts8
3 files changed, 6 insertions, 6 deletions
diff --git a/backend/ts/api/login.ts b/backend/ts/api/login.ts
index b21a506..4b5ff87 100644
--- a/backend/ts/api/login.ts
+++ b/backend/ts/api/login.ts
@@ -27,7 +27,7 @@ export default async function apiLogin(req: Request, res: Response) {
id: req.session.uid,
index: 0,
ready: false,
- color: color,
+ color: Color.red,
name: req.body.name,
}];
req.session.color = color;
diff --git a/backend/ts/api/saveGameBoard.ts b/backend/ts/api/saveGameBoard.ts
index da31bdf..df2b7a0 100644
--- a/backend/ts/api/saveGameBoard.ts
+++ b/backend/ts/api/saveGameBoard.ts
@@ -7,7 +7,7 @@ export default async function saveGameBoard(req: Request, res: Response) {
res.send(API_RES.failure);
return;
}
-
+ console.log("saving gameBoard");
let query = "UPDATE `fia` SET `currentPlayer` = IF(`currentPlayer` + 1 = `playersCount`, 0, `currentPlayer` + 1), "
+ "`gameBoard` = ?, `timeTillTurnEnd` = ? WHERE `id` = ?"
await makeQuery(query, [req.body.gameBoard, nextTurnEndsAt(), req.session.gid]);
diff --git a/backend/ts/gameBoard.ts b/backend/ts/gameBoard.ts
index 314c874..0edbae1 100644
--- a/backend/ts/gameBoard.ts
+++ b/backend/ts/gameBoard.ts
@@ -71,25 +71,25 @@ export const gameBoard: GameBoard = {
},
// @ts-ignore
homes: {
- [Color.red]: [
+ [Color.blue]: [
{ x: 5, y: 1, chequer: -1 },
{ x: 5, y: 2, chequer: -1 },
{ x: 5, y: 3, chequer: -1 },
{ x: 5, y: 4, chequer: -1 },
],
- [Color.blue]: [
+ [Color.red]: [
{ x: 1, y: 5, chequer: -1 },
{ x: 2, y: 5, chequer: -1 },
{ x: 3, y: 5, chequer: -1 },
{ x: 4, y: 5, chequer: -1 },
],
- [Color.green]: [
+ [Color.yellow]: [
{ x: 5, y: 9, chequer: -1 },
{ x: 5, y: 8, chequer: -1 },
{ x: 5, y: 7, chequer: -1 },
{ x: 5, y: 6, chequer: -1 },
],
- [Color.yellow]: [
+ [Color.green]: [
{ x: 9, y: 5, chequer: -1 },
{ x: 8, y: 5, chequer: -1 },
{ x: 7, y: 5, chequer: -1 },