home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
277.PART89.INC
< prev
next >
Wrap
Text File
|
1991-07-09
|
3KB
|
109 lines
{ part 8 and 9 }
procedure parseIReportLine( var f : text; var s : TheVoid );
{ parse one line of the sector report }
var
WhichSector, AdjacentSector : sectorIndex;
begin
WhichSector := readNumber( f );
if WhichSector <> 0 then
begin
read(f, AdjacentSector );
with space.sectors[WhichSector] do
if AdjacentSector = 0 then
number := 0
else
begin
number := 1;
data[1] := AdjacentSector;
while not eoln( f ) do
begin
read( f, AdjacentSector );
number := number + 1;
data[number] := AdjacentSector;
end; {while}
end; {if}
end; {if}
readln( f );
end; {Parse I Report Line}
procedure PartVIII( var data : text; var space : TheVoid );
{ read the sector report from the data file }
begin
while not eof( data ) do
parseIReportLine( data, space );
SaveData( g, space );
end;
procedure GetPercentage( var f : text; var p : percent );
var
ch : char;
begin
p := 0;
read( f, ch );
repeat
if ch in ['0'..'9'] then
begin
p := 10 * p + ord(ch) - ord('0');
end;
read( f, ch );
until (ch = '%') or eof( f );
end; {Get Percentage}
procedure ParseRReportLine( var f : text; var space : TheVoid );
{ Given a list of ports, figure out the relevant info }
var
WhichPort : PortIndex;
CurrSector : SectorIndex;
temp : char;
item : goods;
begin
CurrSector := readNumber( f );
read( f, temp );
if (CurrSector <> 0) then
if temp = '0' then
begin
WhichPort := PortNumber( CurrSector );
if WhichPort <> 0 then { scanner blocked }
for item := Fuel to Equipment do { so flag by with }
space.ports.data[WhichPort].usage[item] := 0;{ use set to 0 }
end
else
begin
space.sectors[CurrSector].etc := space.sectors[CurrSector].etc
or IsPort;
WhichPort := FindPortSlot( space.ports.top, CurrSector );
if WhichPort = 0 then
begin
writeln('Too many ports! Please recompile with a larger');
writeln('MAXPORTS value. Aborting...');
readln;
halt;
end; {if}
space.ports.data[WhichPort].where := CurrSector;
for item := Fuel to equipment do
with space.ports.data[WhichPort] do
begin
read( f, amts[item] );
if temp = '-' then
amts[item] := -amts[item];
GetPercentage( f, usage[item] );
read( f, temp );
if item <> equipment then
read( f, temp );
end; {for}
space.sectors[CurrSector].PortType :=
ComputePortType( space.ports.data[WhichPort].amts);
end; {if}
end; {Parse Report}
procedure PartIX( var data : text; var space : TheVoid );
{ read the ports report from the data file }
begin
{ FindFirstIReportLine( data ); ??? can we assume that it starts with
valid entries? }
while not eof( data ) do
parseRReportLine( data, space );
SaveData( g, space );
end;