From 7f33c82b6e9ddfcabe5b6a84fc57d155e25b6b08 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Wed, 14 Mar 2012 01:10:02 +0000 Subject: [PATCH] Add a separate menu for enntering a guarded sector, and fix calculations of captured holds when destroying an enemy. --- xtrn/tw2/enter.ans | 8 ++++++++ xtrn/tw2/players.js | 8 ++++---- xtrn/tw2/sectors.js | 9 +++++---- xtrn/tw2/tw2.js | 4 ++-- 4 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 xtrn/tw2/enter.ans diff --git a/xtrn/tw2/enter.ans b/xtrn/tw2/enter.ans new file mode 100644 index 0000000000..ab58934971 --- /dev/null +++ b/xtrn/tw2/enter.ans @@ -0,0 +1,8 @@ +[2J[1;35mɹForward View������ͻ[0;34m�[1;34mTradeWars2/JavaScript Sector Invasion[0;34m���������������ͻ +[1;35m� [30m.[3C[0;37m� [1;37m.[3C[0;37m�[4C[1;30m. [35m�[0;34m�[55C� +[1;35m�[0;37m� � [1;37m. [0;37m� [1;30m. [0;37m�[3C[1;37m. [35m�[0;34m� [1;36mA[0;36mttack[10C[35C[3C[34m� +[1;35m� [37m. [30m.[3C[37m.[6C[30m.[4C[35m�[0;34m� [1;36mI[0;36mnfo on you[37C[6C[34m� +[1;35m�[3C[0;37m�[3C�[3C[1;30m. [37m. [0;37m� [1;35m�[0;34m� [1;36mQ[0;36muit the Game[39C[37m [34m� +[1;35m� [30m. [37m� [30m.[6C[0;37m�[3C[1;30m. [35m�[0;34m� [36mRe[1;36mD[0;36misplay Sector[31C[7C[34m� +[1;35m�[3C[0;37m� [1;37m. [0;37m�[3C�[6C[1;35m�[0;34m�[37m [1;36mR[0;36metreat[47C[34m� +[1;35m��������������������ͼ[0;34m�������������������������������������������������������ͼ[0m diff --git a/xtrn/tw2/players.js b/xtrn/tw2/players.js index 0480bed879..ef1f937abd 100644 --- a/xtrn/tw2/players.js +++ b/xtrn/tw2/players.js @@ -195,8 +195,8 @@ function AttackPlayer() var j; console.writeln("You destroyed the ship and salvaged these cargo holds:"); - var holds=new Array(Commodities.length+1); - for(i=0; i<holds.length+1; i++) + var holds=new Array(Commodities.length); + for(i=0; i<holds.length; i++) holds[i]=0; for(i=0; i<otherplayer.Holds; i++) { var limit=0; @@ -549,9 +549,9 @@ function DoBattle(opp, otherteam) console.writeln("You lost "+lost+" fighter(s), "+player.Fighters+" remain."); if(opp.Fighters > 0) - console.write("You destroyed "+killed+" enemy fighters, "+opp.Fighters+" remain."); + console.writeln("You destroyed "+killed+" enemy fighters, "+opp.Fighters+" remain."); else - console.write("You destroyed all of the enemy fighters."); + console.writeln("You destroyed all of the enemy fighters."); return(killed); } } diff --git a/xtrn/tw2/sectors.js b/xtrn/tw2/sectors.js index b2f505c61b..f4e2092b20 100644 --- a/xtrn/tw2/sectors.js +++ b/xtrn/tw2/sectors.js @@ -79,13 +79,13 @@ function EnterSector() /* 20000 */ console.attributes="Y"; sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ); - DisplaySector(sector,player.Sector,false); if(sector.FighterOwner > 0) { otherplayer=players.Get(sector.FighterOwner); if(otherplayer.TeamNumber > 0) fighterteam=otherplayer.TeamNumber; } while(sector.FighterOwner != player.Record && sector.Fighters > 0 && fighterteam != player.TeamNumber) { + DisplaySector(sector,player.Sector,false,'enter.ans'); console.writeln("You have to destroy the fighters before you can enter this sector."); console.writeln("Fighters: "+player.Fighters+" / "+sector.Fighters); console.write("Option? (A,D,I,Q,R,?):? "); @@ -111,7 +111,7 @@ function EnterSector() /* 20000 */ case 'D': console.writeln("<Display>"); sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ); - DisplaySector(sector,player.Sector,false); + DisplaySector(sector,player.Sector,false,'enter.ans'); break; case 'I': console.writeln("<Info>"); @@ -198,10 +198,11 @@ function EnterSector() /* 20000 */ console.writeln("Invalid command. ? = Help"); } } + DisplaySector(sector,player.Sector,false,'main.ans'); return(true); } -function DisplaySector(sector, secnum, helponly) +function DisplaySector(sector, secnum, helponly, mainfname) { var i; var count=0; @@ -215,7 +216,7 @@ function DisplaySector(sector, secnum, helponly) } if(user.settings&USER_ANSI) { - console.printfile(fname("main.ans")); + console.printfile(fname(mainfname)); if(sector.Port > 0) console.printfile(fname("port.ans")); if(sector.Planet > 0) diff --git a/xtrn/tw2/tw2.js b/xtrn/tw2/tw2.js index a8deaa7456..6e98ada5f6 100644 --- a/xtrn/tw2/tw2.js +++ b/xtrn/tw2/tw2.js @@ -85,7 +85,7 @@ function Menu(sector) case 'D': console.writeln("<Display>"); sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ); - DisplaySector(sector,player.Sector,false); + DisplaySector(sector,player.Sector,false,'main.ans'); continue; case 'E': if(user.level < 90) @@ -138,7 +138,7 @@ function Menu(sector) console.crlf(); if(user.settings&USER_ANSI) { sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ); - DisplaySector(sector,player.Sector,true); + DisplaySector(sector,player.Sector,true,'main.ans'); } else console.printfile(fname("main.asc")); -- GitLab