split Game and GameStorage
This commit is contained in:
parent
e83d3e8d61
commit
792f0d4c31
5 changed files with 108 additions and 93 deletions
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
import GameCommon from '../common/GameCommon.js'
|
||||
import { logger } from '../common/Util.js'
|
||||
import Game from '../server/Game.js'
|
||||
import GameStorage from '../server/GameStorage.js'
|
||||
|
||||
const log = logger('fix_image.js')
|
||||
|
||||
function fix(gameId) {
|
||||
Game.loadGameFromFile(gameId)
|
||||
GameStorage.loadGame(gameId)
|
||||
let changed = false
|
||||
|
||||
let imgUrl = GameCommon.getImageUrl(gameId)
|
||||
|
|
@ -18,7 +18,7 @@ function fix(gameId) {
|
|||
changed = true
|
||||
}
|
||||
if (changed) {
|
||||
Game.writeGameToFile(gameId)
|
||||
GameStorage.persistGame(gameId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import GameCommon from '../common/GameCommon.js'
|
||||
import { logger } from '../common/Util.js'
|
||||
import Game from '../server/Game.js'
|
||||
|
||||
import GameStorage from '../server/GameStorage.js'
|
||||
|
||||
const log = logger('fix_tiles.js')
|
||||
|
||||
function fix_tiles(gameId) {
|
||||
Game.loadGameFromFile(gameId)
|
||||
GameStorage.loadGame(gameId)
|
||||
let changed = false
|
||||
const tiles = GameCommon.getTilesSortedByZIndex(gameId)
|
||||
for (let tile of tiles) {
|
||||
|
|
@ -28,7 +27,7 @@ function fix_tiles(gameId) {
|
|||
}
|
||||
}
|
||||
if (changed) {
|
||||
Game.writeGameToFile(gameId)
|
||||
GameStorage.persistGame(gameId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue