diff --git a/xtrn/dicewarz/dice.js b/xtrn/dicewarz/dice.js index 26af6530f30cc249cacbed2f7c79c461cd92eb66..2d38dce576181447fb4cb7e878847379c3437f14 100644 --- a/xtrn/dicewarz/dice.js +++ b/xtrn/dicewarz/dice.js @@ -13,6 +13,7 @@ load("sbbsdefs.js"); load("graphic.js"); + load("logging.js"); var game_dir; try { barfitty.barf(barf); } catch(e) { game_dir = e.fileName; } game_dir = game_dir.replace(/[^\/\\]*$/,''); @@ -45,27 +46,16 @@ //######################### DO NOT CHANGE THIS SECTION ########################## - var log_list=[]; if(!file_isdir(game_dir+"logs")) mkdir(game_dir+"logs"); - else log_list=directory(game_dir + "logs/*.log"); - var logfile=new File(game_dir + "logs/dice" + log_list.length + ".log"); - logfile.open('w+',false); - logfile.writeln("######DICE WARZ LOG DATA####### " + system.datestr() +" - "+ system.timestr()); - - - //TODO: MAKE BETTER USER OF THE USER FILES. CAN BE USED FOR REALTIME MULTIPLAYER, AND FOR USER PRESENCE DETECTION - // IN THE EVENT A USER IS BEING NOTIFIED OF HIS OR HER TURN IN A GAME, THE TELEGRAMS WILL BE SUPPRESSED IF THE USER IS ALREADY RUNNING THE PROGRAM + var gamelog=new Logger(game_dir + "logs/","dice"); var userFileName=game_dir + user.alias + ".usr"; var userFile=new File(userFileName); userFile.open('a'); userFile.close(); - //TODO: MAKE REALTIME MULTIPLAYER FEATURES POSSIBLY USING THE EXISTING FILE LOCK SYSTEM OR QUEUES - // var dataQueue= new Queue(dice); - const daySeconds= 86400; const startRow= 4; - const startColumn= 3; + const startColumn= 3; const menuRow= 1; const menuColumn= 50; const columns= 9; @@ -1592,7 +1582,7 @@ function GameStatusInfo() } function GameLog(data) { - logfile.writeln(data); + gamelog.Log(data); } SplashScreen(); diff --git a/xtrn/dicewarz/maps.js b/xtrn/dicewarz/maps.js index e9af7f1dc419f7cc3bc54069e59d1b00797463fc..9632b1c1b2d0515524f62bb2f50bd79091b70c6b 100644 --- a/xtrn/dicewarz/maps.js +++ b/xtrn/dicewarz/maps.js @@ -195,8 +195,9 @@ function Map(c,r,p,gn) } else { - scores[this.winner].score+=2; - GameLog("giving 2 points to user " + this.winner); + var points=this.players.length<5?1:2; + scores[this.winner].score+=points; + GameLog("giving " + points + " points to user " + this.winner); } games.StoreRankings(); } @@ -217,8 +218,9 @@ function Map(c,r,p,gn) } else { - pointBuffer=7-this.maxPlayers; - pts=points[pointBuffer+(this.eliminated.length-1)]; + var pointBuffer=7-this.maxPlayers; + var offset=(this.players.length<5?2:1); + pts=points[pointBuffer+(this.eliminated.length-offset)]; scores[dead.user].score+=pts; GameLog("giving " + pts + " points to user " + system.username(dead.user)); }