Skip to content
Snippets Groups Projects
Commit 448cb41a authored by mcmlxxix's avatar mcmlxxix
Browse files

don't attempt to run maintenenace, load players, display rank, or anything...

don't attempt to run maintenenace, load players, display rank, or anything else that you cant do if the game hasnt been initialized by the sysop (display message to user urging them yell at the sysop).
parent 870570c2
Branches
Tags
No related merge requests found
...@@ -126,7 +126,7 @@ function GameSettings_Save() ...@@ -126,7 +126,7 @@ function GameSettings_Save()
else else
f.iniRemoveKey(null, 'DB'); f.iniRemoveKey(null, 'DB');
for(i=3; i<GameSettingProperties.length; i++) { for(var i=3; i<GameSettingProperties.length; i++) {
s[GameSettingProperties[i].prop]=this[GameSettingProperties[i].prop]; s[GameSettingProperties[i].prop]=this[GameSettingProperties[i].prop];
} }
db.write(Settings.DB,'settings',s,LOCK_WRITE); db.write(Settings.DB,'settings',s,LOCK_WRITE);
...@@ -150,7 +150,6 @@ function GameSettings() ...@@ -150,7 +150,6 @@ function GameSettings()
} }
} }
db=new JSONClient(this.Server,this.Port); db=new JSONClient(this.Server,this.Port);
db.connect();
var s=db.read(this.DB,'settings',LOCK_READ); var s=db.read(this.DB,'settings',LOCK_READ);
for(i in s) { for(i in s) {
this[i]=s[i]; this[i]=s[i];
......
...@@ -29,6 +29,7 @@ var Commodities=[ ...@@ -29,6 +29,7 @@ var Commodities=[
var Settings; var Settings;
var player=null; var player=null;
var sector=null; var sector=null;
var initialized=null;
var exit_tw2=false; var exit_tw2=false;
load("json-client.js"); load("json-client.js");
...@@ -37,6 +38,7 @@ load(fname("gamesettings.js")); ...@@ -37,6 +38,7 @@ load(fname("gamesettings.js"));
var db; var db;
var LOCK_WRITE=2; var LOCK_WRITE=2;
var LOCK_READ=1; var LOCK_READ=1;
Settings=new GameSettings(); Settings=new GameSettings();
load(fname("ports.js")); load(fname("ports.js"));
...@@ -226,7 +228,9 @@ function do_exit() ...@@ -226,7 +228,9 @@ function do_exit()
player.Put(); player.Put();
} }
console.writeln("Returning to Door monitor..."); console.writeln("Returning to Door monitor...");
TWRank(); if(initialized != undefined) {
TWRank();
}
} }
function Instructions() function Instructions()
...@@ -276,7 +280,7 @@ function Production(place) ...@@ -276,7 +280,7 @@ function Production(place)
function ShowOpeng() function ShowOpeng()
{ {
var len=db.read(Settings.DB,'twopeng.lengh',LOCK_READ); var len=db.read(Settings.DB,'twopeng.length',LOCK_READ);
var i; var i;
var msg; var msg;
...@@ -286,6 +290,7 @@ function ShowOpeng() ...@@ -286,6 +290,7 @@ function ShowOpeng()
console.writeln(msg.Message); console.writeln(msg.Message);
console.crlf(); console.crlf();
} }
return len;
} }
function main() function main()
...@@ -294,10 +299,6 @@ function main() ...@@ -294,10 +299,6 @@ function main()
try { try {
js.on_exit("do_exit()"); js.on_exit("do_exit()");
/* Run maintenance */
if(Settings.MaintLastRan < today) {
RunMaint();
}
console.attributes="C"; console.attributes="C";
console.crlf(); console.crlf();
...@@ -310,7 +311,20 @@ try { ...@@ -310,7 +311,20 @@ try {
console.center("Sysop "+system.operator); console.center("Sysop "+system.operator);
console.crlf(); console.crlf();
console.crlf(); console.crlf();
ShowOpeng(); initialized = ShowOpeng();
/* Make sure game has been 'big-banged' */
if(initialized == undefined) {
console.attributes="R";
console.writeln("The game has not been initialized.");
console.writeln("Please notify the SysOp.");
exit(0);
}
/* Run maintenance */
if(Settings.MaintLastRan < today) {
RunMaint();
}
console.attributes="W"; console.attributes="W";
console.writeln("Initializing..."); console.writeln("Initializing...");
console.writeln("Searching my records for your name."); console.writeln("Searching my records for your name.");
...@@ -318,7 +332,6 @@ try { ...@@ -318,7 +332,6 @@ try {
exit(0); exit(0);
console.pause(); console.pause();
while(player.KilledBy==0 && exit_tw2==false) { while(player.KilledBy==0 && exit_tw2==false) {
if(EnterSector()) { if(EnterSector()) {
if(CheckSector()) if(CheckSector())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment