- // TODO: vname is unknown before game is loaded (vname is a field in memory)
- launchGame: async function() {
- const vModule = await import("@/variants/" + this.vname + ".js");
- window.V = vModule.VariantRules;
- this.loadGame(this.gid);
- },
- loadGame: function(gid) {
- // TODO: ask game to remote peer if this.remoteId is set
- // (or just if game not found locally)
- // NOTE: if it's a corr game, ask it from server
- const game = getGameFromStorage(gid); //, this.gameRef.uid); //uid may be blank
- this.opponent.id = game.oppid; //opponent ID in case of running HH game
- this.opponent.name = game.oppname; //maye be blank (if anonymous)
+ // 4 cases for loading a game:
+ // - from localStorage (one running game I play)
+ // - from indexedDB (one completed live game)
+ // - from server (one correspondance game I play[ed] or not)
+ // - from remote peer (one live game I don't play, finished or not)
+ loadGame: async function() {
+ const game = getGameFromStorage(this.gameRef);
+ this.players = game.players;