home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
GAMES
/
STARSHIP.ARC
/
STARCHN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-09-27
|
5KB
|
165 lines
program starchain;
const
maxcargo=36;{most allowable cargo types}
forsalenum=5;{cargoes avail. at each port}
forsaleplus=10;
holdnum=20; {number of partitions}
complement=20; {starting crew}
probestart=2;
boatstart=1;
hullstart=3;
speedstart=10;
laserstart=2;
creditstart=2E5;
spacestart=200;
moralestart=100;
chance=10; {chance of encounter}
danger=10; {chance of meeting bandits}
starmax=10;{number of stars}
type
cargotype= record
cargoname: string[16];
rfactor,pfactor,ifactor,nifactor,afactor,nafactor: integer;
unitprice: real;
weight: byte;
end;
cargo= record
category: byte;
aunitnumber: byte;
acargoname: string[16];
aprice: real;
aweight: integer;
arfactor,apfactor,aifactor,anifactor,aafactor,anafactor: integer;
percent: real;
end;
startrade=record
starname: string[15];
r,p,i,ni,a,na: boolean;
end;
var
cargorange: array[1..maxcargo] of cargotype;
thiscargo: cargo;
availnow: array[1..forsaleplus] of cargo;
holdnow: array[1..holdnum] of cargo;
chnfile: file;
thiscargotype: cargotype;
filename: string[14]; {used for other jobs too}
index,jndex,kndex,mndex,cargonum,star,thistar,realstar,
triplength,gamelength: byte;{the 'indices' are used for all work}
speed,tspeed,cspeed,hull,thull,chull,probes,boats,laser,tlaser,claser,
crew: byte; {ship vars}
drivecrew, lasercrew, hullcrew, space,morale,moralebounce: integer;
num,trial,inp: integer;{input and calc}
yorn: char;
galaxytrade: array[1..starmax] of startrade;
distance: array[1..starmax] of byte;
angle: array[1..starmax] of integer;
been: array[1..starmax] of boolean;
t,dt,credits,realvar,salary: real;
name: string[25];
stringvar:string[16];
alienmatch: array[0..4] of byte;
probehere,boathere,navy,messageflag,autodoc,assignment,roll,
prize: boolean;
(*----------------------------------------------------*)
var
OrigEpower:byte;
Epower: integer;
action,battle,newship,nomessage,moraleflag,local6:boolean;
traderflag,quitter:boolean;
badguys:boolean; {not shared w/ starship}
objectcount,docks:byte; {"}
local1,local7,leave:boolean; {not shared with starship or e}
{$R+}
function fishrule(var numnum: integer):real;
begin {this untidy process converts an index to a multiplier}
case numnum of
1:fishrule:=40;
2:fishrule:=50;
3:fishrule:=70;
4:fishrule:=80;
5:fishrule:=90;
6:fishrule:=100;
7:fishrule:=110;
8:fishrule:=120;
9:fishrule:=130;
10:fishrule:=150;
11:fishrule:=170;
12:fishrule:=200;
13:fishrule:=300;
14:fishrule:=400;
end;
end;{function fishrule}
{$I estar.pro}{info routines, numeric input sub}
{$I star1.pro}{cargo subs}
{$I star2.pro}{arrival routines}
{$I star3.pro}{main menu}
begin{main}
ErrorPtr:=addr(error);
quitter:=false;
assign(chnfile,'E.CHN');
if traderflag=true then
begin
trader2;
chain(chnfile);
end;
arrive;
while (t>0) and (not quitter) do command;{play til time expires or player quits}
if (not quitter) and (crew>0) then writeln('Your lease has expired'); {then end}
for index:=1 to holdnum do
if holdnow[index].category<>0 then credits:=credits+holdnow[index].aprice;
write('after selling your remaining cargo you have ');
format(credits);
writeln;
credits:=credits-(gamelength*1E5+creditstart);
write('minus debt of ');
format(gamelength*1E5+creditstart);
writeln;
credits:=credits+(boats-boatstart)*4E4+(probes-probestart)*6E4;
if boats>boatstart then writeln('plus 40,000 for each extra small craft');
if probes>probestart then writeln('plus 60,000 for each extra probe');
if boats<boatstart then writeln('less 40,000 credits for each missing boat');
if probes<probestart then writeln('minus 60,000 credits each to replace probes');
if autodoc=true then
begin
writeln('plus one million for the autodoc');
credits:=credits+1E6;
end;{ifthen}
write('GRAND TOTAL ');
format(credits);
writeln(' credits');
realvar:=1E7*(gamelength-1);
if credits>realvar then
begin
writeln('You can''t fool me. You wrote this game.');
halt;
end;
if credits*1.4>realvar then
begin
writeln('How''d you do that?');
halt;
end;
if credits*1.7>realvar then
begin
writeln('An outstanding accomplishment');
halt;
end;
if credits*2>realvar then
begin
writeln('You''re becoming an expert trader');
halt;
end;
if credits*2.5>realvar then writeln('Now you can retire');
if credits<0 then writeln('You may have some trouble getting the next loan');
end.