From 043edfcc20c4110eb3decd2ef4e42c1c5c223031 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Mon, 8 Dec 2008 23:48:57 +0000 Subject: [PATCH] Removed vote prompt for games with fixed number of players. Fixed game status menu to show your turn if appropriate in a newly started game. --- xtrn/dicewarz/dice.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xtrn/dicewarz/dice.js b/xtrn/dicewarz/dice.js index 08571eebd1..3713e44457 100644 --- a/xtrn/dicewarz/dice.js +++ b/xtrn/dicewarz/dice.js @@ -513,9 +513,8 @@ function ViewGameInfo(gameNumber) } function StartGame(gameNumber) { - g=games.gameData[gameNumber]; - var maxPlayers=g.maxPlayers; - var players=g.players; + var maxPlayers=games.gameData[gameNumber].maxPlayers; + var players=games.gameData[gameNumber].players; games.gameData[gameNumber]=new Map(columns,rows,maxPlayers,gameNumber); games.gameData[gameNumber].players=players; games.inProgress.push(gameNumber); @@ -523,6 +522,12 @@ function StartGame(gameNumber) games.gameData[gameNumber].singlePlayer=g.singlePlayer; games.gameData[gameNumber].fileName=g.fileName; games.gameData[gameNumber].lastModified=time(); + + //TODO: simplify game menu status updating + g=games.gameData[gameNumber]; + if(g.players[g.turnOrder[g.nextTurn]].user==user.number) games.yourTurn.push(gameNumber); + + QueueMessage("\1r\1hGame " + gameNumber + " Initialized!",30,20); games.gameData[gameNumber].Notify(); /* Set up computer players */ @@ -552,11 +557,12 @@ function StartGame(gameNumber) } function JoinGame(gameNumber) { + var vote=-1; g=games.gameData[gameNumber]; if(console.noyes("\1n\1gJoin this game?")); else { - vote=GetVote(); + if(g.maxPlayers>g.minPlayers) vote=GetVote(); g.addPlayer(user.number,vote); if(g.players.length>=g.minPlayers) { @@ -1137,6 +1143,8 @@ function Quit(err) //#######################MAIN GAME CLASS################################### function GameStatusInfo() { + this.gameData=[]; //master game data array + this.inProgress=[]; this.notFull=[]; this.completed=[]; @@ -1144,7 +1152,6 @@ function GameStatusInfo() this.yourGames=[]; this.yourTurn=[]; this.eliminated=[]; - this.gameData=[]; this.singleGames=[]; -- GitLab