Debian Codegraph @

Data_Generators/makedata/crewmake.pas

raw
1 program makecrew;
2 (********************************************************************
3 This file is part of Ironseed.
4
5 Ironseed is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ironseed is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ironseed. If not, see <https://www.gnu.org/licenses/>.
17 ********************************************************************)
18
19 {*********************************************
20 Data Generator: Crew
21
22 Copyright:
23 1994 Channel 7, Destiny: Virtual
24 2020 Matija Nalis <[email protected]>
25 **********************************************}
26
27 {$PACKRECORDS 1}
28
29 uses crt;
30
31 type
32 crewtype=
33 record
34 name: string[20];
35 phy,men,emo,level,jobtype: integer;
36 desc: array[0..9] of string[52];
37 end;
38 var
39 fs: text;
40 ft: file of crewtype;
41 i,j,a,b: integer;
42 crew: crewtype;
43 done: boolean;
44 c: char;
45 { buffer: array[1..640] of char;
46
47 procedure breakupbuffer(size: integer);
48 var head,tail,index: integer;
49 begin
50 head:=1;
51 for index:=0 to 10 do
52 begin
53 crew.desc[index,0]:=chr(52);
54 fillchar(crew.desc[index,1],52,ord(' '));
55 tail:=head+51;
56 if tail>size then tail:=size;
57 while (buffer[tail]<>' ') and (buffer[tail]<>'.') do dec(tail);
58 move(buffer[head],crew.desc[index,1],tail-head+1);
59 writeln(crew.desc[index]);
60 head:=tail+1;
61 end;
62 end;
63 }
64 begin
65 assign(fs,'Data_Generators/makedata/crew.txt');
66 reset(fs);
67 assign(ft,'data/crew.dta');
68 rewrite(ft);
69 clrscr;
70 for a:=1 to 30 do
71 begin
72 done:=false;
73 readln(fs,crew.name); writeln(crew.name);
74 if length(crew.name)<20 then
75 fillchar(crew.name[length(crew.name)+1],20-length(crew.name),ord(' '));
76 crew.name[0]:=chr(20);
77 read(fs,crew.phy); read(fs,crew.men);
78 read(fs,crew.emo);
79 read(fs,crew.level); crew.level:=1;
80 read(fs,c);
81 j:=128;
82 b:=0;
83 for i:=0 to 7 do
84 begin
85 read(fs,c);
86 if c='1' then b:=b+j;
87 j:=j div 2;
88 end;
89 crew.jobtype:=b;
90 readln(fs);
91 writeln(crew.phy:3,crew.men:3,crew.emo:3,crew.level:3,crew.jobtype:3);
92 i:=0;
93 repeat
94 readln(fs,crew.desc[i]);
95 if length(crew.desc[i])=0 then done:=true;
96 if length(crew.desc[i])<52 then
97 for j:=length(crew.desc[i])+1 to 52 do
98 crew.desc[i,j]:=' ';
99 crew.desc[i,0]:=chr(52);
100 writeln(crew.desc[i]);
101 inc(i);
102 until done;
103 if i<10 then
104 for j:=i to 9 do
105 begin
106 crew.desc[j]:=' ';
107 writeln(crew.desc[j]);
108 end;
109 write(ft,crew);
110 end;
111 close(fs);
112 close(ft);
113 halt(0);
114 end.