home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
093.BUSTED.INC
< prev
next >
Wrap
Text File
|
1992-07-01
|
3KB
|
101 lines
{routines for dealing with busts}
procedure UpdateBusts;
{ run through the ports, clearing any outdated busts }
const
ExpireTime = 14; { ports forget you after 2 weeks }
var
FreeDate : word;
p : portIndex;
numFreed : integer;
begin
writeln('Updating port records...');
NumFreed := 0;
FreeDate := DateWord - ExpireTime;
for p := 1 to space.ports.top do
with space.ports.data[ p ] do
if (bustdate > 0) and (bustdate < FreeDate) then
begin {clear port record of bust}
bustdate := 0;
numFreed := numFreed + 1;
space.sectors[ where ].etc :=
space.sectors[ where ].etc and (not Busted);
end; {for with if}
writeln( Numfreed, ' criminal records wiped.');
if NumFreed > 0 then
BaseChanged := true; { force update of data base }
end;
procedure RecordBust;
{ record being busted at sector}
var
s : sectorindex;
p : portindex;
begin
write('Pity about being busted... ');
s := GetSector;
if s <> 0 then
with space.sectors[s] do
if etc and IsPort = Nothing then
writeln('error: sector ', s, ' is not a port ')
else
begin
BaseChanged := true;
etc := etc or Busted;
p := PortNumber( s );
if p <> 0 then
with space.ports.data[p] do
bustDate := DateWord;
end;
end;
procedure ClearBust;
{ clear record of being busted at sector}
var
s : sectorindex;
p : portindex;
begin
write('Clear Which ');
s := GetSector;
if s <> 0 then
with space.sectors[s] do
if etc and IsPort = Nothing then
writeln('error: sector ', s, ' is not a port ')
else if etc and Busted = Nothing then
writeln('I have no record you you being busted at that port!')
else
begin
BaseChanged := true;
etc := etc and (not Busted);
p := PortNumber( s );
if p <> 0 then
with space.ports.data[p] do
bustDate := 0;
end;
end;
function HardLuckMenu : char;
var
ch : char;
begin
repeat
writeln('record <B>usted sector');
writeln('<C>lear bust');
writeln('<U>pdate all bust flags');
writeln;
write('Your choice? ');
readln( ch );
ch := upcase( ch );
until ch in ['B','C','U'];
HardLuckMenu := ch;
end;
procedure HardLuck;
{ busted at port manipulation }
begin
case HardLuckMenu of
'B' : RecordBust;
'C' : ClearBust;
'U' : UpdateBusts;
end;
end;