home *** CD-ROM | disk | FTP | other *** search
- function FindPortSlot( var top : PortIndex; which : sector ) : PortIndex;
- {If which is already in the data base, return that location. If not, then if
- we are full, return 0; otherwise add one to top and return it. }
- var
- i : portIndex;
- found : boolean;
- begin
- found := false;
- if top > 0 then
- for i := 1 to top do
- if space.ports.data[ i ].where = which then
- begin
- FindPortSlot := i;
- found := true;
- end;
- if not found then
- if top = MaxPorts then
- FindPortSlot := 0
- else
- begin
- top := top + 1;
- FindPortSlot := top;
- end; {else}
- end; {FindPortSlot}
-
- function ComputePortType( g : GoodsArray ) : stuff;
- { look at the goods array, and assign the approprate port type. }
- var
- return : stuff;
- begin
- if g[Fuel] > 0 then
- return := 1
- else
- return := 0;
- if g[Organics] > 0 then
- return := return + 2;
- if g[Equipment] > 0 then
- return := return + 4;
- ComputePortType := return;
- end;