remove __createGameObject
This commit is contained in:
parent
cc6eb8ebbc
commit
382853c097
2 changed files with 17 additions and 28 deletions
|
|
@ -13,17 +13,6 @@ function exists(gameId) {
|
|||
return (!!GAMES[gameId]) || false
|
||||
}
|
||||
|
||||
function __createGameObject(id, rng, puzzle, players, evtInfos, scoreMode) {
|
||||
return {
|
||||
id: id,
|
||||
rng: rng,
|
||||
puzzle: puzzle,
|
||||
players: players,
|
||||
evtInfos: evtInfos,
|
||||
scoreMode: scoreMode,
|
||||
}
|
||||
}
|
||||
|
||||
function __createPlayerObject(id, ts) {
|
||||
return {
|
||||
id: id,
|
||||
|
|
@ -39,7 +28,14 @@ function __createPlayerObject(id, ts) {
|
|||
}
|
||||
|
||||
function newGame({id, rng, puzzle, players, evtInfos, scoreMode}) {
|
||||
const game = __createGameObject(id, rng, puzzle, players, evtInfos, scoreMode)
|
||||
const game = {
|
||||
id: id,
|
||||
rng: rng,
|
||||
puzzle: puzzle,
|
||||
players: players,
|
||||
evtInfos: evtInfos,
|
||||
scoreMode: scoreMode,
|
||||
}
|
||||
setGame(id, game)
|
||||
return game
|
||||
}
|
||||
|
|
@ -743,7 +739,6 @@ function handleInput(gameId, playerId, input, ts) {
|
|||
}
|
||||
|
||||
export default {
|
||||
__createGameObject,
|
||||
__createPlayerObject,
|
||||
newGame,
|
||||
exists,
|
||||
|
|
|
|||
|
|
@ -57,17 +57,14 @@ const changedGames = {}
|
|||
async function createGameObject(gameId, targetTiles, image, ts, scoreMode) {
|
||||
const seed = Util.hash(gameId + ' ' + ts)
|
||||
const rng = new Rng(seed)
|
||||
return GameCommon.__createGameObject(
|
||||
gameId,
|
||||
{
|
||||
type: 'Rng',
|
||||
obj: rng,
|
||||
},
|
||||
await createPuzzle(rng, targetTiles, image, ts),
|
||||
[],
|
||||
{},
|
||||
scoreMode
|
||||
)
|
||||
return {
|
||||
id: gameId,
|
||||
rng: { type: 'Rng', obj: rng },
|
||||
puzzle: await createPuzzle(rng, targetTiles, image, ts),
|
||||
players: [],
|
||||
evtInfos: {},
|
||||
scoreMode,
|
||||
}
|
||||
}
|
||||
async function createGame(gameId, targetTiles, image, ts, scoreMode) {
|
||||
GameLog.create(gameId)
|
||||
|
|
@ -77,10 +74,7 @@ async function createGame(gameId, targetTiles, image, ts, scoreMode) {
|
|||
const rng = new Rng(seed)
|
||||
GameCommon.newGame({
|
||||
id: gameId,
|
||||
rng: {
|
||||
type: 'Rng',
|
||||
obj: rng,
|
||||
},
|
||||
rng: { type: 'Rng', obj: rng },
|
||||
puzzle: await createPuzzle(rng, targetTiles, image, ts),
|
||||
players: [],
|
||||
evtInfos: {},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue