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.run(
Async.bind( Async.bind(
getSavedState(gameID), getSavedState(gameID),
function(state) { function(o) {
return Async.sequence( return Async.sequence(
startSession(), startSession(),
setGame({tag: "Game", state: state, logs: []}) setGame(o)
); );
} }
) )
@ -48,7 +48,7 @@ function fail(errorCode) {
} }
function getSavedState(gameID) { 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'); return gameState != undefined ? Async.wrap(gameState) : fail('gameNotFound');
} }

View File

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