Store all of game message, to get the log, why drop it and have to generate a fake message ?

This commit is contained in:
Tissevert 2020-01-15 18:06:53 +01:00
parent d3d8ca8816
commit 8cfcd419ef
2 changed files with 4 additions and 4 deletions

View file

@ -26,10 +26,10 @@ function init(gameID) {
Async.run(
Async.bind(
getSavedState(gameID),
function(state) {
function(o) {
return Async.sequence(
startSession(),
setGame({tag: "Game", state: state, logs: []})
setGame(o)
);
}
)
@ -48,7 +48,7 @@ function fail(errorCode) {
}
function getSavedState(gameID) {
var gameState = Save.get('games.state.Game#' + gameID);
var gameState = Save.get('games.message.Game#' + gameID);
return gameState != undefined ? Async.wrap(gameState) : fail('gameNotFound');
}

View file

@ -33,7 +33,7 @@ function initMessageHandlers() {
Messaging.addEventListener(["Game"], function(o) {
var gameID = o.state.public.gameState.gameID;
var entry = makeEntry(o.state);
Save.set("games.state." + gameID, o.state);
Save.set("games.message." + gameID, o);
Save.set("games.entry." + gameID, entry);
entries.insert(gameID, entry);
});