home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl105 / delta2 < prev    next >
Encoding:
Text File  |  1992-12-05  |  43.2 KB  |  1,336 lines

  1. Newsgroups: vmsnet.sources.games
  2. Path: uunet!stanford.edu!agate!spool.mu.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!fuug!news.funet.fi!hydra!klaava!hurtta
  3. From: Kari.Hurtta@Helsinki.FI
  4. Subject: Delta: Monster Helsinki 1.05 to 1.06 (part 2/5)
  5. Message-ID: <1992Dec6.171340.19023@klaava.Helsinki.FI>
  6. Followup-To: vmsnet.sources.d
  7. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  8. Organization: University of Helsinki
  9. Date: Sun, 6 Dec 1992 17:13:40 GMT
  10. Lines: 1323
  11. Xref: uunet vmsnet.sources.games:558
  12.  
  13. Archive-name: monster_helsinki_105_to_106/part2
  14. Author: Kari.Hurtta@Helsinki.FI
  15. Package: Delta from Helsinki Monster 1.05 to Helsinki Monster 1.06
  16. Environment: VMS, Pascal
  17. Part: 2/5
  18.  
  19. -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
  20. X`09end; `7B pvar `7D
  21. X
  22. X    var i: integer;
  23. X`09tmp: string_t;
  24. X    begin
  25. X`09with pool`5E`5Bcurrent_buffer`5D.table`5Bpos`5D do begin
  26. X`09    case nametype of
  27. X`09`09n_function:
  28. X`09`09    for i := 1 to count_params(params) do
  29. X`09`09`09walk_tree(params`5Bi`5D,current_label,
  30. X`09`09`09`09  visited_labels,defined_vars);
  31. X`09`09n_head: begin
  32. X`09`09    writeln('%Error on walk_tree. Nodetype = n_head');
  33. X`09`09    writeln('%Notify Monster Manager.');
  34. X`09`09    goto OUT;
  35. X`09`09    end;
  36. X`09`09n_header: begin
  37. X`09`09`09if name = LABEL_ID then begin
  38. X`09`09`09    add_list(visited_labels,ns(long_name`5E));
  39. X`09`09`09    current_label := ns(long_name`5E);
  40. X`09`09`09end;
  41. X`09`09`09if name in define_var_headers then begin
  42. X`09`09`09    add_list(defined_vars,ns(long_name`5E));
  43. X`09`09`09end;
  44. X`09`09`09for i := 1 to count_params(params) do
  45. X`09`09`09    walk_tree(params`5Bi`5D,current_label,
  46. X`09`09`09`09  visited_labels,defined_vars);
  47. X`09`09    end;
  48. X`09`09n_const : ;
  49. X`09`09n_error : ;
  50. X`09`09n_comment : ;
  51. X`09`09n_variable : begin
  52. X`09`09    if not in_list(defined_vars,ns(long_name`5E)) then begin
  53. X`09`09`09writeln('Warning: Variable ' + ns(long_name`5E) +`20
  54. X`09`09`09`09' not defined');
  55. X`09`09`09writeln('         in LABEL ' + current_label +
  56. X`09`09`09        ' when called with following');
  57. X`09`09`09writeln('         path: ' + visited_labels + '.');
  58. X`09`09`09writeln;
  59. X`09`09    end;
  60. X`09`09end;
  61. X`09`09n_gosub: begin
  62. X`09`09    if not in_list(visited_labels,
  63. X`09`09`09ns(pool`5E`5Bcurrent_buffer`5D.table`5Bname`5D.long_name`5E)) then
  64. V begin
  65. X`09`09`09    tmp := defined_vars;
  66. X`09`09`09    add_list(tmp,pvar(1));
  67. X`09`09`09    add_list(tmp,pvar(2));
  68. X`09`09`09    add_list(tmp,pvar(3));
  69. X`09`09`09    for i := 4 to count_params(params) do`20
  70. X`09`09`09`09add_list(tmp,pvar(i));
  71. X`09`09`09    walk_tree(name,current_label,visited_labels,tmp);
  72. X`09`09    end;
  73. X`09`09    for i := 1 to count_params(params) do
  74. X`09`09`09walk_tree(params`5Bi`5D,current_label,
  75. X`09`09`09    visited_labels,defined_vars);
  76. X
  77. X`09`09end;
  78. X`09    end; `7B case `7D
  79. X`09end; `7B with `7D
  80. X`09OUT:
  81. X    end; `7B walk_tree `7D
  82. X`09`09`09`09
  83. X    procedure check_variables;
  84. X`09procedure check_one(atom: atom_t);
  85. X`09var loc: integer;
  86. X`09begin
  87. X`09    loc := locate_label(atom);
  88. X`09    if loc > 0 then walk_tree(labels`5Bloc`5D.loc,
  89. X`09`09`09`09      '',
  90. X`09`09`09`09      '',
  91. X`09`09`09`09      external_vars);
  92. X`09end; `7B check_one `7D
  93. X    begin
  94. X`09do_list(external_labels,check_one);
  95. X    end; `7B check_variables `7D
  96. X
  97. X    procedure write_comment; forward;
  98. X-  754,  766
  99. X`09`09if pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype =
  100. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.nametype `20
  101. X`09`09then if pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.name =
  102. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.name`20
  103. X`09`09then if (pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`2
  104. V0
  105. X`09`09`09= nil) =
  106. X`09`09    (pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.long_name = nil)`20
  107. X`09`09then begin
  108. X`09`09   if pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.long_name = nil then fl
  109. Vag`20
  110. X`09`09`09:= true
  111. X`09`09   else flag :=`20
  112. X`09`09    EQ(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E,
  113. X`09`09`09pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.long_name`5E);
  114. X-  770,  771
  115. X`09`09`09if pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params`5Bj`5D
  116. V <>
  117. X`09`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Bi`5D.params`5Bj`5D then
  118. X-  780,  780
  119. X`09`09    with pool`5E`5Bcurrent_buffer`5D.table `5B atom_count `5D do begin
  120. X-  804,  809
  121. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params`5B1`5D := p1
  122. V;
  123. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params`5B2`5D := p2
  124. V;
  125. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params`5B3`5D := p3
  126. V;
  127. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.name := 0;
  128. X            pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name := n
  129. Vil;
  130. X-  813,  831
  131. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype `20
  132. X`09`09`09:= n_variable;
  133. X`09`09    new(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name,
  134. X`09`09`09length(name)-1);
  135. X`09`09    as(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E
  136. X`09`09`09,substr(name,2,length(name)-1));
  137. X`09`09end;
  138. X`09`09'"': begin
  139. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype `20
  140. X`09`09`09:= n_const;
  141. X`09`09    if length(name) > 2 then begin
  142. X`09`09`09new(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name,
  143. X`09`09`09    length(name)-2);
  144. X`09`09`09as(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E,
  145. X`09`09`09    substr(name,2,length(name)-2));
  146. X`09`09    end else pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_na
  147. Vme
  148. X`09`09`09:= nil;
  149. X`09`09end;
  150. X`09`09'!':  begin
  151. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype :=`20
  152. X`09`09`09n_comment;
  153. X`09`09    new(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name,
  154. X`09`09`09length(name));
  155. X`09`09    as(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E,
  156. X`09`09`09name);
  157. X-  835,  836
  158. X`09`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype := n_he
  159. Vad;
  160. X`09`09    new(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name,
  161. X`09`09`09length(name));
  162. X`09`09    as(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E,
  163. X`09`09`09name);
  164. X-  863,  867
  165. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.name     := code;
  166. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype := n_heade
  167. Vr;
  168. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params   := params;
  169. X`09    new(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name,
  170. X`09`09length(atom)));
  171. X`09    as(pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.long_name`5E,ato
  172. Vm);
  173. X-  906,  908
  174. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.name := code;
  175. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.nametype := n_funct
  176. Vion;
  177. X`09    pool`5E`5Bcurrent_buffer`5D.table`5Batom_count`5D.params := params;
  178. X- 1126, 1126
  179. X`09    with pool`5E`5Bcurrent_buffer`5D do `09`09
  180. X- 1133, 1133
  181. X`09`09`09writeln(result,count:1,':0:0:0:',ns(long_name`5E))
  182. X- 1140, 1143
  183. X`09`09`09if long_name = nil then writeln(result,'"')
  184. X`09`09`09else writeln(result,ns(long_name`5E),'"');
  185. X`09`09    end;
  186. X`09`09    n_variable: begin
  187. X`09`09`09writeln(result,count:1,':0:0:0:_',ns(long_name`5E));
  188. X- 1155, 1155
  189. X`09`09`09writeln(result,':',ns(long_name`5E));
  190. X- 1177, 1177
  191. X- 1205
  192. X`09check_variables;
  193. X- 1213, 1213
  194. X- 1224, 1227
  195. X    for i := 1 to max_mdl_buffer do with pool`5E`5Bi`5D do begin
  196. X`09if used > 0 then begin
  197. X`09    if current_program = program_number then found := i;
  198. X`09    if pool`5E`5Bbiggest`5D.time < time then biggest := i;
  199. X- 1249, 1249
  200. X    with pool`5E`5Bbuffer`5D do begin
  201. X- 1368, 1369
  202. X`09`09`09    if length(atom) > 0 then begin
  203. X`09`09`09`09new(long_name,length(atom));
  204. X`09`09`09`09as(long_name`5E,atom);
  205. X`09`09`09    end else long_name := nil;
  206. X- 1426, 1426
  207. X    begin with pool`5E `5Bbuffer`5D do begin
  208. X- 1430, 1430
  209. X           else atom_name := ns(long_name`5E);
  210. X- 1489, 1489
  211. X`09`09    nice_print('GOSUB '+ns(table`5Bname`5D.long_name`5E));
  212. X- 1511, 1511
  213. X    with pool`5E`5Bbuffer`5D do begin
  214. X- 1520, 1520
  215. X`09    if table`5Bi`5D.long_name <> nil then line_i := ns(table`5Bi`5D.long_
  216. Vname`5E)
  217. X- 1567, 1570
  218. X`09 with pool`5E`5Bbuffer`5D do begin
  219. X`09    for i:= 1 to used do if table`5Bi`5D.nametype = n_header then
  220. X`09`09    if table`5Bi`5D.name = 6 `7B LABEL `7D then
  221. X`09`09`09if ns(table`5Bi`5D.long_name`5E) = label_name then`20
  222. X- 1596, 1596
  223. X      end; `7B eval_variable `7D                           `20
  224. X- 1609, 1609
  225. X      end; `7B set_variable `7D                                    `20
  226. X- 1640
  227. X      function e_boolean_and(params: paramtable): string_t;
  228. X      var result: string;
  229. X`09  bresult: boolean := true;
  230. X`09  i: integer;
  231. X      begin
  232. X`09write_debug('%e_boolean_and');
  233. X`09for i := 1 to count_params(params) do`20
  234. X`09    if clean_spaces(eval_atom (params`5Bi`5D)) = '' then`20
  235. X`09`09bresult := false;
  236. X`09if bresult then result := 'TRUE'
  237. X`09else result := '';
  238. X        write_debug ('%e_boolean_and result: ',result);
  239. X`09e_boolean_and := result;
  240. X      end; `7B e_boolean_and `7D
  241. X
  242. X      function e_boolean_or(params: paramtable): string_t;
  243. X      var result: string;
  244. X`09  bresult: boolean := false;
  245. X`09  i: integer;
  246. X      begin
  247. X`09write_debug('%e_boolean_or');
  248. X`09for i := 1 to count_params(params) do`20
  249. X`09    if clean_spaces(eval_atom (params`5Bi`5D)) > '' then`20
  250. X`09`09bresult := true;
  251. X`09if bresult then result := 'TRUE'
  252. X`09else result := '';
  253. X        write_debug ('%e_boolean_or result: ',result);
  254. X`09e_boolean_or := result;
  255. X      end; `7B e_boolean_or `7D
  256. X
  257. X      function e_or_else(params: paramtable): string_t;
  258. X      var result: string_t := '';
  259. X`09  i,n: integer;
  260. X`09  cont: boolean := true;
  261. X      begin
  262. X        write_debug('%e_or_else');
  263. X`09n := count_params(params);
  264. X`09i := 1;
  265. X`09while cont and (i <= n) do begin
  266. X`09    result := eval_atom (params`5Bi`5D);
  267. X`09    if result > '' then cont := false;
  268. X`09    i := i +1;
  269. X`09end;`20
  270. X`09write_debug('%e_or_else result: ',result);
  271. X`09e_or_else := result;
  272. X      end; `7B e_or_else `7D
  273. X
  274. X      function e_and_then(params: paramtable): string_t;
  275. X      var result: string_t := '';
  276. X`09  i,n: integer;
  277. X`09  cont: boolean := true;
  278. X      begin
  279. X        write_debug('%e_and_then');
  280. X`09n := count_params(params);
  281. X`09i := 1;
  282. X`09while cont and (i <= n) do begin
  283. X`09    result := eval_atom (params`5Bi`5D);
  284. X`09    if result = '' then cont := false;
  285. X`09    i := i +1;
  286. X`09end;`20
  287. X`09write_debug('%e_and_then result: ',result);
  288. X`09e_and_then := result;
  289. X      end; `7B e_and_then `7D
  290. X     `20
  291. X- 1828, 1828
  292. X`09`09    if read_global_flag(value) then action := atom
  293. X- 2017, 2017
  294. X         owner := x_monster_owner(pool`5E`5Bbuffer`5D.current_program);
  295. X- 2038, 2038
  296. X         owner := x_monster_owner(pool`5E`5Bbuffer`5D.current_program);
  297. X- 2063, 2063
  298. X         owner := x_monster_owner(pool`5E`5Bbuffer`5D.current_program);
  299. X- 2084, 2084
  300. X         owner := x_monster_owner(pool`5E`5Bbuffer`5D.current_program);
  301. X- 2103, 2103
  302. X         if int_poof(monster,line_i,x_monster_owner(pool`5E`5Bbuffer`5D.curr
  303. Vent_program),
  304. X- 2119, 2119
  305. X         if int_poof(myname,line_i,x_monster_owner(pool`5E`5Bbuffer`5D.curre
  306. Vnt_program),
  307. X- 2314, 2320
  308. X`09     if a`5Bindex`5D in `5B'0'..'9'`5D then
  309. X                result := result + a`5Bindex`5D
  310. X`09     else if chartable`5Ba`5Bindex`5D`5D.kind = ct_letter then
  311. X`09`09result := result + chartable`5Ba`5Bindex`5D`5D.lcase
  312. X`09     else if chartable`5Ba`5Bindex`5D`5D.kind = ct_none then `7B DISCARD
  313. V `7D
  314. X`09     else result := result + ' ';
  315. X- 2342, 2342
  316. X            else if (x_monster_owner(pool`5E`5Bbuffer`5D.current_program) <>
  317. V`20
  318. X- 2485, 2486
  319. X        owner  := x_monster_owner(pool`5E`5Bbuffer`5D.current_program); `7B
  320. V get owner of this `7D
  321. X        owner2 := x_monster_owner(pool`5E`5Bbuffer`5D.current_program,1); `7
  322. VB and code owner `7D
  323. X- 2502, 2502
  324. X         getheader(pool`5E`5Bbuffer`5D.current_program);
  325. X- 2515, 2515
  326. X         getheader(pool`5E`5Bbuffer`5D.current_program);
  327. X- 2537, 2537
  328. X`09`09x_monster_owner(pool`5E`5Bbuffer`5D.current_program))
  329. X- 2568, 2568
  330. X`09`09x_monster_owner(pool`5E`5Bbuffer`5D.current_program))
  331. X- 2759, 2759
  332. X`09`09pool`5E`5Bbuffer`5D.current_program,label_name,r1,r2) then
  333. X- 2936, 2936
  334. X`09    ((code = pool`5E`5Bbuffer`5D.current_program) and`20
  335. X- 3233
  336. X`09    78: `7B boolean and `7D result := e_boolean_and(params);
  337. X`09    79: `7B boolean or `7D result := e_boolean_or(params);
  338. X`09    80: `7B or else `7D result := e_or_else(params);
  339. X`09    81: `7B and then `7D result := e_and_then(params);
  340. X- 3343, 3343
  341. X         else with pool`5E`5Bbuffer`5D.table`5Bitem`5D do begin
  342. X- 3361, 3364
  343. X`09`09n_header:   eval_atom := eval_header(name,ns(long_name`5E),
  344. X`09`09`09    params);
  345. X`09`09n_variable: eval_atom := eval_variable(ns(long_name`5E));
  346. X`09`09n_gosub:    eval_atom := eval_gosub(name,params);
  347. X`09`09n_const:    if long_name = nil then eval_atom := ''
  348. X`09`09`09    else eval_atom := ns(long_name`5E);
  349. X- 3408, 3408
  350. X  else current_run := pool`5E`5Bcurrent_buffer`5D.current_program;
  351. X- 3575, 3575
  352. X`09    with pool`5E`5Bcurrent_buffer`5D do begin `20
  353. X- 3627, 3627
  354. X`09    end; `7B with pool`5E `7D
  355. X- 3746, 3746
  356. X    with pool`5E`5Bcurrent_buffer`5D do begin
  357. X- 3812, 3814
  358. X    s_terminal: terminal_t;
  359. X    count,i,errorcode,s_errorcode: integer;
  360. X
  361. X    function reader_file(var line: string_t): boolean;
  362. X    begin
  363. X`09write_debug('%reader_file');
  364. X`09if EOF(s_file) then reader_file := false
  365. X`09else begin
  366. X`09    readln(s_file,line);
  367. X`09    reader_file := true;
  368. X`09end;
  369. X    end; `7B reader_file `7D
  370. X
  371. X    function reader_terminal(var line: string_t): boolean;
  372. X    var eof_flag : boolean;
  373. X`09s: string;
  374. X`09procedure leave;
  375. X`09begin
  376. X`09    write_debug('%leave');
  377. X`09    eof_flag := true;
  378. X`09end; `7B leave `7D
  379. X    begin
  380. X`09write_debug('%reader_terminal');
  381. X`09eof_flag := false;
  382. X`09grab_line('MDL> ',s,eof_handler := leave, channel := s_terminal);
  383. X`09line := s;
  384. X`09reader_terminal := not eof_flag;
  385. X    end; `7B reader_terminal `7D
  386. X
  387. X    var read_from_terminal : boolean;
  388. Xbegin
  389. X    write_debug('%load');
  390. X    if open_terminal(source,s_terminal) then begin
  391. X`09read_from_terminal := true;
  392. X`09s_errorcode := 0;
  393. X    end else begin
  394. X`09read_from_terminal := false;
  395. X
  396. X- 3817
  397. X    end;
  398. X
  399. X- 3860, 3860
  400. X`09    if read_from_terminal then`09parse(reader_terminal,o_file)
  401. X`09    else begin
  402. X`09`09reset(s_file);
  403. X`09`09parse (reader_file,o_file);
  404. X`09    end;
  405. X- 3873
  406. X`09    if read_from_terminal then close_terminal(s_terminal)
  407. X`09    else close(s_file);
  408. X
  409. X- 3889, 3889
  410. X    new(pool,max_mdl_buffer); (* max_mdl_buffer asetetaan privusers.pas:issa
  411. V *)
  412. X    for i := 1 to max_mdl_buffer do with pool`5E`5Bi`5D do begin
  413. X/
  414. $ CALL UNPACK INTERPRETER.DIF;1 1548631039
  415. $ create 'f'
  416. X/
  417. $ CALL UNPACK KEYS.DIF;1 47
  418. $ create 'f'
  419. X-   57,   57
  420. XPARSER.OBJ + PARSER.PEN : PARSER.PAS,GLOBAL.PEN,DATABASE.PEN,GUTS.PEN
  421. X/
  422. $ CALL UNPACK MAKEFILE.DIF;1 174417888
  423. $ create 'f'
  424. X-   25,   25
  425. X    Create nice multiplayer game
  426. X-   29,   29
  427. X    Monster Helsinki 1.05u
  428. X-   44
  429. X     9.7.1992 `7C         `7C  Claim accepts now type argument (room, object
  430. V,`20
  431. X              `7C         `7C     monster, spell)
  432. X    17.7.1992 `7C         `7C  Disown and Public accepts now also type argum
  433. Vent
  434. X    18.8.1992 `7C         `7C  Functions obj_here, player_here, obj_hold and
  435. V`20
  436. X              `7C         `7C     parse_obj moved to module PARSER
  437. X    13.9.1992 `7C         `7C  Bug fix in disown_user
  438. X   24.10.1992 `7C`09`09`7C  You can't longer complete fill room with monster
  439. Vs
  440. X   28.10.1992 `7C`09`09`7C  Flag: allow_dcl_access
  441. X    5.12.1992 `7C`09`09`7C  chartable_charset, show charset -command
  442. X-  335,  389
  443. X`7B functions obj_here, player_here and obj_hold moved to module PARSER `7D
  444. X
  445. X`7B return the slot of an object that is HERE `7D
  446. Xfunction find_obj(objnum: integer): integer;
  447. Xvar
  448. X`09i: integer;
  449. X
  450. Xbegin
  451. X`09i := 1;
  452. X`09find_obj := 0;
  453. X`09while i <= maxobjs do begin
  454. X`09`09if here.objs`5Bi`5D = objnum then
  455. X`09`09`09find_obj := i;
  456. X`09`09i := i + 1;
  457. X-  393,  430
  458. X`7B function parse_obj moved to module PARSER `7D
  459. X
  460. X`7B functions parse_pers, is_owner, room_owner, can_alter and can_make moved
  461. V to`20
  462. X  module CUSTOM `7D
  463. X
  464. X`7B procedures nice_print, print_short print_line, print_desc and make_line
  465. X   moved to module CUSTOM `7D
  466. X
  467. X`7B
  468. XReturn n as the direction number if s is a valid alias for an exit
  469. X`7D
  470. Xfunction lookup_alias(var n: integer; s: string): boolean;
  471. Xvar
  472. X`09i,poss,maybe,num: integer;
  473. X
  474. Xbegin
  475. X`09gethere;
  476. X-  435,  466
  477. X`09for i := 1 to maxexit do begin
  478. X`09`09if s = here.exits`5Bi`5D.alias then
  479. X`09`09`09num := i
  480. X`7B`09`09else if index(here.exits`5Bi`5D.alias,s) = 1 then begin
  481. X`09`09`09maybe := maybe + 1;
  482. X`09`09`09poss := i;
  483. X`09`09end;`09`09`09`09`7D
  484. X`09end;
  485. X`09if num <> 0 then begin
  486. X`09`09n := num;
  487. X`09`09lookup_alias := true;
  488. X`7B`09end else if maybe = 1 then begin
  489. X`09`09n := poss;
  490. X`09`09lookup_alias := true;
  491. X`09end else if maybe > 1 then begin
  492. X`09`09lookup_alias := false;`09`09`7D
  493. X`09end else begin
  494. X`09`09lookup_alias := false;
  495. X-  470,  509
  496. X-  655,  655
  497. X`09if s = '?' then command_help('accept')
  498. X`09else if lookup_dir(dir,s,true) then begin
  499. X-  691,  691
  500. X`09if s = '?' then command_help('refuse')
  501. X`09else if not(is_owner) then
  502. X- 2642, 2642
  503. X`09if s = '?' then command_help('unlink')
  504. X`09else if checkhide then begin
  505. X- 2661, 2662
  506. X- 2764, 2764
  507. X`09`09lookup_cmd := error`09`7B "Ambiquous" `7D
  508. X- 2899
  509. X`09`09    n := -1;
  510. X- 2953, 2955
  511. X`09`09`20
  512. X`09    if n > 0 then begin  `7B resets counters to zero `7D
  513. X`09`09sub_counter(N_NUMROOMS,n,get_counter(N_NUMROOMS,n));
  514. X`09`09sub_counter(N_ACCEPT,n,get_counter(N_ACCEPT,n));
  515. X`09    end;`20
  516. X
  517. X- 4121
  518. X
  519. X`09if s = '?' then begin
  520. X`09    command_help('summon');
  521. X`09    goto exit_label;
  522. X`09end;
  523. X- 4127, 4127
  524. X`09else if not parse_pers(vslot,vname,true) then writeln('Victim isn''t here
  525. V.')
  526. X- 4362, 4362
  527. X`09`09`09log_event(targslot,E_HPOOFIN,0,0,log_name,loc);
  528. X- 4449, 4451
  529. X`09`09`09`09if lookup_room(loc,s,true) then
  530. X`09`09`09`09`09xpoof(loc)
  531. X`09`09`09`09else writeln('No room ',s,'.');
  532. X`09`09`09end else if parse_pers(n,s,true) then
  533. X- 4467, 4467
  534. X            else if lookup_room(loc,s,true) then begin
  535. X- 5832, 5933
  536. X`09procedure claim_room;
  537. X`09begin
  538. X`09    getroom;
  539. X`09    if not exact_user(oldowner,here.owner) then oldowner := 0;
  540. X`09    if (here.owner = disowned_id) or`20
  541. X`09`09(owner_priv and (here.owner <> system_id)) or
  542. X`09`09manager_priv then begin `7B minor change by leino@finuha `7D
  543. X`09`09`09`09`09`7B and hurtta@finuh `7D
  544. X`09`09here.owner := userid;
  545. X`09`09putroom;
  546. X`09`09change_owner(oldowner,mylog);
  547. X`09`09if here.hook > 0 then set_owner(here.hook,0,userid);
  548. X`09`09getown;
  549. X`09`09own.idents`5Blocation`5D := userid;
  550. X`09`09putown;
  551. X`09`09log_event(myslot,E_CLAIM,0,0);
  552. X`09`09writeln('You are now the owner of this room.');
  553. X`09    end else begin
  554. X`09`09freeroom;
  555. X`09`09if here.owner = public_id then
  556. X`09`09    writeln('This is a public room.  You may not claim it.')
  557. X`09`09else if here.owner = system_id then
  558. X`09`09    writeln('The system own this room.  You may not claim it.')
  559. X`09`09else
  560. X`09`09    writeln('This room has an owner.');
  561. X`09    end;
  562. X`09end; `7B claim_room `7D
  563. X
  564. X`09procedure claim_object(n: integer; s: string);
  565. X`09begin
  566. X`09    getobjown;
  567. X`09    freeobjown;
  568. X`09    `7B*** Let the MM claim any object ***`7D
  569. X`09    `7B jlaiho@finuh `7D
  570. X`09    if ( (objown.idents`5Bn`5D = public_id)`20
  571. X`09`09and (not owner_priv) ) then `7B minor change by leino@finuha `7D
  572. X`09`09writeln('That is a public object.  You may DUPLICATE it, but may not C
  573. VLAIM it.')
  574. X`09    else if ( (objown.idents`5Bn`5D = system_id)`20
  575. X`09`09and (not manager_priv) ) then `7B minor change by hurtta@finuha `7D
  576. X`09`09writeln('That is a system''s object. ')
  577. X`09    else if ( (objown.idents`5Bn`5D <> disowned_id)`20
  578. X`09`09and (not owner_priv) ) then `7B minor change by leino@finuha `7D
  579. X`09`09writeln('That object has an owner.')
  580. X`09    else begin
  581. X`09`09getobj(n);
  582. X`09`09freeobj;
  583. X`09`09if obj.numexist = 0 then
  584. X`09`09    ok := true
  585. X`09`09else begin
  586. X`09`09    if obj_hold(n) or obj_here(n) then
  587. X`09`09`09    ok := true
  588. X`09`09    else
  589. X`09`09`09    ok := false;
  590. X`09`09end;
  591. X                       `20
  592. X`09`09if ok then begin
  593. X`09`09    getobjown;
  594. X`09`09    objown.idents`5Bn`5D := userid;
  595. X`09`09    putobjown;
  596. X`09`09    if obj.actindx > 0 then
  597. X`09`09`09set_owner(obj.actindx,0,userid);
  598. X`09`09    tmp := obj.oname;
  599. X`09`09    log_event(myslot,E_OBJCLAIM,0,0,tmp);
  600. X`09`09    writeln('You are now the owner of ',tmp,'.');
  601. X`09`09end else
  602. X`09`09`09writeln('You must have one to claim it.');
  603. X`09`09end;
  604. X`09end; `7B claim_object `7D
  605. X
  606. X`09procedure claim_monster(n: integer; s: string);
  607. X`09begin
  608. X`09    if parse_pers(mslot,s) then begin   `7B parse_pers make gethere `7D
  609. X`09`09if here.people`5Bmslot`5D.kind = P_MONSTER then begin
  610. X`09`09    code := here.people`5Bmslot`5D.parm;
  611. X`09`09    if ( (monster_owner(code) = public_id)`20
  612. X`09`09`09and (not owner_priv) ) then`20
  613. X`09`09`09writeln('That is a public monster.')
  614. X`09`09    else if ( (monster_owner(code) = system_id)`20
  615. X`09`09`09and (not manager_priv) ) then
  616. X`09`09`09writeln('That is a system''s monster.')
  617. X`09`09    else if ( (monster_owner(code) <> disowned_id)`20
  618. X`09`09`09and (not owner_priv) ) then`20
  619. X`09`09`09writeln('That monster has an owner.')
  620. X`09`09    else begin
  621. X`09`09`09set_owner(code,0,userid);
  622. X`09`09`09tmp := here.people`5Bmslot`5D.name;
  623. X`09`09`09log_event(myslot,E_OBJCLAIM,0,0,tmp);
  624. X`09`09`09writeln('You are now the owner of ',tmp,'.');
  625. X`09`09    end;
  626. X`09`09end else writeln ('That isn''t a monster.');`09`09`09
  627. X`09    end else writeln ('That monster isn''t here.');
  628. X`09end; `7B claim_monster `7D
  629. X
  630. X`09procedure claim_spell(n: integer; s: string);
  631. X`09begin
  632. X`09    if ( (spell_owner(n) = public_id) and (not owner_priv) ) then`20
  633. X`09`09writeln('That is a public spell.')
  634. X`09    else if ( (spell_owner(n) = system_id) and (not manager_priv) ) then
  635. X`09`09writeln('That is a system''s spell.')
  636. X`09    else if ( (spell_owner(n) <> disowned_id) and (not owner_priv) ) then
  637. V`20
  638. X`09`09writeln('That spell has an owner.')
  639. X`09    else begin
  640. X`09`09getint(N_SPELL);
  641. X`09`09freeint;
  642. X`09`09code := anint.int`5Bn`5D;
  643. X`09`09set_owner(code,0,userid);
  644. X`09`09tmp := spell_name.idents`5Bn`5D;
  645. X`09`09log_event(myslot,E_OBJCLAIM,0,0,tmp);
  646. X`09`09writeln('You are now the owner of ',tmp,'.');
  647. X`09    end;
  648. X`09end; `7B claim_spell `7D
  649. Xlabel 0;
  650. X    procedure leave;
  651. X    begin
  652. X`09writeln('QUIT');
  653. X`09goto 0;
  654. X    end;
  655. X
  656. Xvar what: shortstring;
  657. X    ns: string;
  658. X    g: o_type;
  659. Xbegin
  660. X`09ns := s;
  661. X`09what := bite(ns);
  662. X`09if length(s) = 0 then begin`09`7B claim this room `7D
  663. X`09    claim_room;
  664. X`09end else if lookup_type(g,what,false,false) then begin
  665. X`09    if (g <> t_room) and (ns = '') then
  666. X`09`09grab_line('Claim '+what+' what? ',ns,eof_handler := leave);
  667. X`09    if (g <> t_room) and (ns = '') then goto 0;
  668. X`09    case g of
  669. X`09`09t_room: if ns = '' then claim_room
  670. X`09`09`09else writeln('You can only claim that room (no room name).');
  671. X`09`09t_object: if lookup_obj(n,ns,true) then claim_object(n,ns)
  672. X`09`09`09else writeln('No object ''',ns,'''.');
  673. X`09`09t_monster: if lookup_pers(n,ns,true) then claim_monster(n,ns)
  674. X`09`09`09else writeln('No monster ''',ns,'''.');
  675. X`09`09t_spell: if lookup_spell(n,ns,true) then claim_spell(n,ns)
  676. X`09`09`09else writeln('No spell ''',ns,'''.');
  677. X`09`09t_player: writeln('You can''t do that.');
  678. X`09    end; `7B case `7D
  679. X`09end else if lookup_obj(n,s) then begin
  680. X`09    claim_object(n,s);
  681. X`09end else if lookup_pers(n,s) then begin
  682. X`09    claim_monster(n,s);
  683. X`09end else if lookup_spell(n,s) then begin
  684. X`09    claim_spell(n,s);
  685. X`09end else writeln('There is nothing here by that name to claim.');
  686. X    0:
  687. X- 5940, 6020
  688. X
  689. X    procedure disown_room;
  690. X    begin
  691. X`09getroom;
  692. X`09if not exact_user(oldowner,here.owner) then oldowner := 0;
  693. X`09    if (here.owner = userid) or`20
  694. X`09    (owner_priv and (here.owner <> system_id)) or
  695. X`09    manager_priv then begin `7B minor change by leino@finuha `7D
  696. X`09    getroom;
  697. X`09    here.owner := disowned_id;
  698. X`09    putroom;
  699. X`09    change_owner(oldowner,0);
  700. X`09    if here.hook > 0 then set_owner(here.hook,0,disowned_id);
  701. X`09    getown;
  702. X`09    own.idents`5Blocation`5D := disowned_id;
  703. X`09    putown;
  704. X`09    log_event(myslot,E_DISOWN,0,0);
  705. X`09    writeln('You have disowned this room.');
  706. X`09end else begin
  707. X`09    freeroom;
  708. X`09    if here.owner = system_id then
  709. X`09`09writeln('Owner of this room is system.')
  710. X`09    else writeln('You are not the owner of this room.');
  711. X`09end;
  712. X    end; `7B disown_room `7D
  713. X
  714. X    procedure disown_object(n: integer; s: string);
  715. X    begin
  716. X`09getobj(n);
  717. X`09freeobj;
  718. X`09tmp := obj.oname;
  719. X
  720. X`09getobjown;
  721. X`09if (objown.idents`5Bn`5D = userid) or`20
  722. X`09    (owner_priv and ( objown.idents`5Bn`5D <> system_id))
  723. X`09    or manager_priv then begin
  724. X`09    objown.idents`5Bn`5D := disowned_id;
  725. X`09    putobjown;
  726. X`09    if obj.actindx > 0 then set_owner(obj.actindx,0,disowned_id);
  727. X`09    log_event(myslot,E_OBJDISOWN,0,0,tmp);
  728. X`09    writeln('You are no longer the owner of the ',tmp,'.');
  729. X`09end else begin
  730. X`09    freeobjown;
  731. X`09    if objown.idents`5Bn`5D = system_id then`20
  732. X`09`09writeln('System is owner of this.')
  733. X`09    else writeln('You are not the owner of any such thing.');
  734. X`09end;
  735. X    end; `7B disown_objects `7D
  736. X
  737. X    procedure disown_monster(n: integer; s: string);
  738. X    begin
  739. X`09if parse_pers(mslot,s) then begin   `7B parse_pers make gethere `7D
  740. X`09    if here.people`5Bmslot`5D.kind = P_MONSTER then begin
  741. X`09`09code := here.people`5Bmslot`5D.parm;
  742. X`09`09if (monster_owner(code) = system_id)
  743. X`09`09and not manager_priv then`20
  744. X`09`09    writeln('The owner of this monster is system.') `09
  745. X`09`09else if  (monster_owner(code) <> userid)`20
  746. X`09`09    and not owner_priv then`20
  747. X`09`09    writeln('You are not the owner of this monster')
  748. X`09`09else begin
  749. X`09`09    set_owner(code,0,disowned_id);
  750. X`09`09    tmp := here.people`5Bmslot`5D.name;
  751. X`09`09    log_event(myslot,E_OBJDISOWN,0,0,tmp);
  752. X`09`09    writeln('You are no longer the owner of the ',tmp,'.');
  753. X`09`09end;
  754. X`09    end else writeln ('That isn''t monster.');
  755. X`09end else writeln ('Here isn''t that monster.');
  756. X    end; `7B disown_monster `7D
  757. X
  758. X    procedure disown_spell(n: integer; s: string);
  759. X    begin
  760. X`09if (spell_owner(n) = system_id) and not manager_priv then
  761. X`09    writeln('The owner of this spell is system.') `09
  762. X`09else if (spell_owner(n) <> userid) and not owner_priv then`20
  763. X`09    writeln('You are not the owner of this spell')
  764. X`09else begin
  765. X`09    getint(N_SPELL);
  766. X`09    freeint;
  767. X`09    code := anint.int`5Bn`5D;
  768. X`09    set_owner(code,0,disowned_id);
  769. X`09    tmp := spell_name.idents`5Bn`5D;
  770. X`09    log_event(myslot,E_OBJDISOWN,0,0,tmp);
  771. X`09    writeln('You are no longer the owner of the ',tmp,'.');
  772. X`09end;
  773. X    end; `7B disown_spell `7D
  774. X
  775. Xlabel 0;
  776. X    procedure leave;
  777. X    begin
  778. X`09writeln('QUIT');
  779. X`09goto 0;
  780. X    end;
  781. Xvar what: shortstring;
  782. X    ns: string;
  783. X    g: o_type;
  784. Xbegin
  785. X`09ns := s;
  786. X`09what := bite(ns);
  787. X`09if length(s) = 0 then begin`09`7B disown this room `7D
  788. X`09    disown_room;
  789. X`09end else if lookup_type(g,what,false,false) then begin
  790. X`09    if (g <> t_room) and (ns = '') then
  791. X`09`09grab_line('Disown '+what+' what? ',ns,eof_handler := leave);
  792. X`09    if (g <> t_room) and (ns = '') then goto 0;
  793. X`09    case g of
  794. X`09`09t_room: if ns = '' then disown_room
  795. X`09`09`09else writeln('You can only disown that room (no room name).');
  796. X`09`09t_object: if lookup_obj(n,ns,true) then disown_object(n,ns)
  797. X`09`09`09else writeln('No object ''',ns,'''.');
  798. X`09`09t_monster: if lookup_pers(n,ns,true) then disown_monster(n,ns)
  799. X`09`09`09else writeln('No monster ''',ns,'''.');
  800. X`09`09t_spell: if lookup_spell(n,ns,true) then disown_spell(n,ns)
  801. X`09`09`09else writeln('No spell ''',ns,'''.');
  802. X`09`09t_player: writeln('You can''t do that.');
  803. X`09    end; `7B case `7D
  804. X`09end else if lookup_obj(n,s) then begin
  805. X`09    disown_object(n,s);
  806. X`09end else if lookup_pers(n,s) then begin
  807. X`09    disown_monster(n,s);
  808. X`09end else if lookup_spell(n,s) then begin
  809. X`09    disown_spell(n,s);
  810. X`09end else writeln('You are not the owner of any such thing.');
  811. X`090:
  812. Xend; `7B do_disown `7D
  813. X- 6030, 6086
  814. X    procedure public_room;
  815. X    begin
  816. X`09getroom;
  817. X`09if not exact_user(oldowner,here.owner) then oldowner := 0;
  818. X`09here.owner := public_id;
  819. X`09putroom;
  820. X`09change_owner(oldowner,0);
  821. X`09if here.hook > 0 then set_owner(here.hook,0,public_id);
  822. X`09getown;
  823. X`09own.idents`5Blocation`5D := public_id;
  824. X`09putown;
  825. X`09writeln('This room is now public.');
  826. X    end; `7B public_room `7D
  827. X
  828. X    procedure public_object(n: integer; s: string);
  829. X    begin
  830. X`09getobj(n);
  831. X`09freeobj;
  832. X`09if obj.numexist = 0 then ok := true
  833. X`09else begin
  834. X`09    if obj_hold(n) or obj_here(n) then ok := true
  835. X`09    else ok := false;
  836. X`09end;
  837. X
  838. X`09if ok then begin
  839. X`09    getobjown;
  840. X`09    objown.idents`5Bn`5D := public_id;
  841. X`09    putobjown;
  842. X`09    if obj.actindx > 0 then
  843. X`09`09set_owner(obj.actindx,0,public_id);
  844. X
  845. X`09    tmp := obj.oname;
  846. X`09    log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  847. X`09    writeln('The ',tmp,' is now public.');
  848. X`09end else writeln('You must have one to claim it.');
  849. X    end; `7B public_object `7D
  850. X
  851. X    procedure public_monster(n: integer; s: string);
  852. X    begin
  853. X`09if parse_pers(mslot,s) then begin   `7B parse_pers make gethere `7D`09`09
  854. V `20
  855. X`09    if here.people`5Bmslot`5D.kind = P_MONSTER then begin
  856. X`09`09code := here.people`5Bmslot`5D.parm;
  857. X`09`09set_owner(code,0,public_id);
  858. X`09`09tmp := here.people`5Bmslot`5D.name;
  859. X`09`09log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  860. X`09`09writeln('The ',tmp,' is now public.');
  861. X`09    end else writeln ('That isn''t monster.');
  862. X`09end else writeln ('Here isn''t that monster.');
  863. X    end; `7B public_monster `7D
  864. X
  865. X    procedure public_spell(n: integer; s: string);
  866. X    begin
  867. X`09getint(N_SPELL);
  868. X`09freeint;
  869. X`09code := anint.int`5Bn`5D;
  870. X`09set_owner(code,0,public_id);
  871. X`09tmp := spell_name.idents`5Bn`5D;
  872. X`09log_event(myslot,E_OBJPUBLIC,0,0,tmp);
  873. X`09writeln('The ',tmp,' is now public.');
  874. X    end; `7B public_spell `7D
  875. X
  876. Xlabel 0;
  877. X    procedure leave;
  878. X    begin
  879. X`09writeln('QUIT');
  880. X`09goto 0;
  881. X    end;
  882. Xvar what: shortstring;
  883. X    ns: string;
  884. X    g: o_type;
  885. Xbegin
  886. X    if manager_priv then begin `7B minor change by leino@finuha `7D
  887. X`09ns := s;
  888. X`09what := bite(ns);
  889. X`09if length(s) = 0 then begin
  890. X`09    public_room;
  891. X`09end else if lookup_type(g,what,false,false) then begin
  892. X`09    if (g <> t_room) and (ns = '') then
  893. X`09`09grab_line('Public '+what+' what? ',ns,eof_handler := leave);
  894. X`09    if (g <> t_room) and (ns = '') then goto 0;
  895. X`09    case g of
  896. X`09`09t_room: if ns = '' then public_room
  897. X`09`09`09else writeln('You can only public that room (no room name).');
  898. X`09`09t_object: if lookup_obj(n,ns,true) then public_object(n,ns)
  899. X`09`09`09else writeln('No object ''',ns,'''.');
  900. X`09`09t_monster: if lookup_pers(n,ns,true) then public_monster(n,ns)
  901. X`09`09`09else writeln('No monster ''',ns,'''.');
  902. X`09`09t_spell: if lookup_spell(n,ns,true) then public_spell(n,ns)
  903. X`09`09`09else writeln('No spell ''',ns,'''.');
  904. X`09`09t_player: writeln('You can''t do that.');
  905. X`09    end; `7B case `7D
  906. X`09end else if lookup_obj(n,s) then begin
  907. X`09    public_object(n,s);
  908. X`09end else if lookup_pers(n,s) then begin
  909. X`09    public_monster(n,s);
  910. X`09    end else if lookup_spell(n,s) then begin
  911. X`09`09public_spell(n,s);
  912. X`09end else writeln('There is nothing here by that name to make public.');
  913. X    end else
  914. X`09writeln('Only the Monster Manager may make things public.');
  915. X    0:
  916. X- 6413, 6413
  917. X`09`09if parse_pers(n,s,true) then begin
  918. X- 6667, 6668
  919. X`09if s = '?' then command_help('ping')
  920. X`09else if s <> '' then begin
  921. X`09`09if parse_pers(n,s,true) then begin
  922. X- 7436, 7436
  923. X`09else if not parse_pers(victim,s,true) then begin
  924. X- 7514, 7514
  925. X`09else if s = '?' then command_help('use')
  926. X`09else if parse_obj(n,s,true) then begin
  927. X- 7575, 7575
  928. X`09end else if parse_pers(n,s,true) then begin
  929. X- 7653, 7653
  930. X`09end else if parse_obj(n,s,true) then begin
  931. X- 7711, 7711
  932. X`09end else if parse_obj(n,s,true) then begin
  933. X- 8193
  934. X`09`09s_charset: writeln('Database charset is ',
  935. X`09`09`09    chartable_charset,'.');
  936. X- 8398, 8414
  937. X    if alloc_dcl_access then begin
  938. X`09log_action (c_dcl,0);
  939. X`09do_dcl (s);   `7B Spawn subprocess .. `7D
  940. X`09log_event (myslot,E_DCLDONE,0,0,'');
  941. X `20
  942. X`09`7B check database `7D
  943. X`09getindex (I_ASLEEP);        `20
  944. X`09freeindex;
  945. X`09if indx.free `5Bmylog`5D then `7B Oops ! I am in asleep ... `7D
  946. X`09begin
  947. X`09    WriteLn ('You are throw out from Monster-universe during your stay on
  948. V DCL-level.');
  949. X`09    finish_interpreter;
  950. X`09    halt;
  951. X`09end;
  952. X         `20
  953. X`09`7B Because only my process update my situation, I can suppose that
  954. X`09    datatabase and data in memory is valid - I hope so ...        `7D
  955. X    end else writeln('DCL access disabled !');
  956. X- 8482
  957. X`09    monster_count: integer;
  958. X- 8515
  959. X`09monster_count := 0;
  960. X- 8519, 8524
  961. X`09for j := 1 to maxpeople do begin
  962. X`09    if here.people`5Bj`5D.kind = 0 then begin
  963. X`09`09i := j;
  964. X`09`09found := true
  965. X`09    end else if here.people`5Bj`5D.kind <> P_PLAYER then
  966. X`09`09monster_count := monster_count + 1;
  967. X`09end; `7B for `7D
  968. X
  969. X`09`7B reserve last position for (interactive) player `7D
  970. X`09if monster_count >= maxpeople-1 then found := false;
  971. X
  972. X- 8583, 8583
  973. X               writeln('%begining to create monster');
  974. X- 8672, 8672
  975. X  else if parse_pers(mslot,s,true) then begin
  976. X- 8970, 8970
  977. X    if s = '?' then command_help('list')
  978. X    else if s > '' then begin
  979. X- 8995, 8995
  980. X    if s = '?' then command_help('create')
  981. X    else if s > '' then begin
  982. X- 9286, 9287
  983. X`09show`5Bs_charset`5D := 'charset';
  984. X`09
  985. X`09numshow := 13;
  986. X-10575,10577
  987. X
  988. X`09wait(1);`09`7B try fixing event problem - yes - that isn't good `7D
  989. X`09if not int_poof(name,nam.idents`5Bloc`5D,'',true,true) then begin
  990. X`09    `7B FAILED !! `7D
  991. X`09    log_event(n,E_POOFIN,0,0,name,location); `7B false event `7D
  992. X`09end;
  993. X`09writeln;
  994. X/
  995. $ CALL UNPACK MON.DIF;1 1661931861
  996. $ create 'f'
  997. X-   10
  998. Xdefine syntax MONSTER_REBUILD
  999. X   image MONSTER_IMAGE_:monster_rebuild
  1000. X-   17,   17
  1001. X      nonnegatable
  1002. X      syntax = MONSTER_REBUILD
  1003. X   qualifier FIX
  1004. X      nonnegatable
  1005. X      syntax = MONSTER_REBUILD
  1006. X-   25
  1007. X      nonnegatable
  1008. X      syntax = MONSTER_REBUILD
  1009. X-   37,   37
  1010. X   disallow (START and (BUILD or DUMP or REBUILD or FIX))
  1011. X/
  1012. $ CALL UNPACK MONSTER_CLD.DIF;2 1060059043
  1013. $ create 'f'
  1014. X-   29,   31
  1015. X    9.07.1992 `7C         `7C If reading of dump failed, mark it as invalid,
  1016. X              `7C         `7C added (incomplete) end of dump file check to e
  1017. Vnd
  1018. X   12.08.1992 `7C         `7C Dummy player_here removed (now defined in modu
  1019. Vle
  1020. X              `7C         `7C PARSER)
  1021. X    5.12.1992 `7C         `7C Warning about charset
  1022. X`7D
  1023. X
  1024. XCONST DVERSION = '1.04'; `7B DUMPER Version `7D
  1025. X-   38,   44
  1026. X    READ_vers_104: boolean;
  1027. X
  1028. X    READ_error: boolean;`20
  1029. X-  204
  1030. X    line: string;
  1031. X-  219,  220
  1032. X`09    freeline;
  1033. X`09    line := oneliner.theline;
  1034. X`09    if length(line) > 65 then begin
  1035. X`09`09    write_ITEM(f,'DESCLINEB%',substr(line,1,50));
  1036. X`09`09    line := substr(line,51,length(line)-50);
  1037. X`09    end;
  1038. X`09    write_ITEM(f,'DESCLINE%',line);
  1039. X-  229,  229
  1040. Xvar data,datab: string;
  1041. X    ok: boolean;
  1042. X-  237,  244
  1043. X    end else begin
  1044. X`09ok := false;
  1045. X`09if READ_vers_104 then`20
  1046. X`09    IF read_ITEM(f,'DESCLINEB%',datab) then ok := true;
  1047. X`09if read_ITEM(f,'DESCLINE%',data) then begin
  1048. X`09    if alloc_general(I_LINE,linenum) then begin
  1049. X`09`09if ok then data := datab + data;
  1050. X`09`09getline(linenum);
  1051. X`09`09oneliner.theline := data;
  1052. X`09`09putline;
  1053. X`09`09read_DESCLINE := true;
  1054. X`09    end else begin
  1055. X`09`09writeln('Can''t allocate space for desciption line!');
  1056. X`09`09READ_error := true;
  1057. X`09`09linenum := 0;
  1058. X`09`09read_DESCLINE := true;
  1059. X`09    end;
  1060. X`09end else begin
  1061. X`09    if ok then begin
  1062. X`09`09writeln('Partial description line readed !');
  1063. X`09`09read_ERROR := true;
  1064. X`09`09linenum := 0;
  1065. X`09`09read_DESCLINE := true;
  1066. X`09    end else read_DESCLINE := false;
  1067. X`09end;
  1068. X    end;
  1069. X-  251
  1070. X    line: string;
  1071. X-  267,  268
  1072. X`09    for i := 1 to block.desclen do begin
  1073. X`09`09line := block.lines`5Bi`5D;
  1074. X`09`09if length(line) > 70 then begin
  1075. X`09`09    write_ITEM(f,'BLOCKB%',substr(line,1,60));
  1076. X`09`09    line := substr(line,61,length(line)-60);
  1077. X`09`09end;
  1078. X`09`09write_ITEM(f,'BLOCK%',line);
  1079. X`09    end;
  1080. X-  277
  1081. X    function getit(var data: string): boolean;
  1082. X    var datab: string;
  1083. X    begin
  1084. X`09if READ_vers_104 then`20
  1085. X`09    if read_ITEM(f,'BLOCKB%',datab) then
  1086. X`09`09if read_ITEM(f,'BLOCK%',data) then begin
  1087. X`09`09    data := datab + data;
  1088. X`09`09    getit := true;
  1089. X`09`09end else begin
  1090. X`09`09    writeln('Partial block description line !');
  1091. X`09`09    read_ERROR := true;
  1092. X`09`09    data := datab;
  1093. X`09`09    getit := true;
  1094. X`09`09end
  1095. X`09    else getit := read_ITEM(f,'BLOCK%',data)
  1096. X`09else getit := read_ITEM(f,'BLOCK%',data);
  1097. X    end; `7B getit `7D
  1098. X-  293,  293
  1099. X`09    while getit(data) do begin
  1100. X-  299,  299
  1101. X`09end else begin
  1102. X`09    writeln('Can''t allocate space for description block !!');
  1103. X`09    READ_error := true;
  1104. X`09    while getit(data) do ;
  1105. X`09    code := 0;
  1106. X`09    read_BLOCK := true;
  1107. X`09end;
  1108. X-  381
  1109. X`09READ_error := READ_error or not flag;
  1110. X-  428
  1111. X`09    READ_error := true;
  1112. X-  439,  440
  1113. X`09    if name = 0 then begin
  1114. X`09`09READ_error := true;
  1115. X`09`09writeln('Reference error in class ',
  1116. X`09`09    class:1,'/',iclass:1, ' name ',data);
  1117. X`09    end;
  1118. X-  457
  1119. X`09    READ_error := true;
  1120. X-  469,  470
  1121. X`09    if name = 0 then begin
  1122. X`09`09READ_error := true;
  1123. X`09`09writeln('Overflow error in class ',
  1124. X`09`09    class:1,'/',iclass:1, ' name ',data)
  1125. X`09    end
  1126. X-  550,  551
  1127. X`09if code = 0 then begin
  1128. X`09    READ_error := true;
  1129. X`09    writeln('Overflow error in mdl store.')
  1130. X`09end else begin
  1131. X-  595
  1132. X`09READ_error := READ_error or not flag;
  1133. X-  652
  1134. X      READ_error := true;
  1135. X-  728
  1136. X      READ_error := READ_error or not flag;
  1137. X-  758
  1138. X`09READ_error := true;
  1139. X-  785
  1140. X`09READ_error := READ_error or not flag;
  1141. X-  828,  828
  1142. X`09if id = 0 then begin
  1143. X`09    READ_error := true;
  1144. X`09    writeln('Monster''s name ',data,' not found.');
  1145. X`09end;
  1146. X-  840,  847
  1147. X`09    if a = 0 then flag := false (* skip *)
  1148. X`09    else begin
  1149. X`09`09rec.holding`5Bi`5D := a;
  1150. X
  1151. X`09`09getobj(a);  `20
  1152. X`09`09obj.numexist := obj.numexist + 1;   `7B Update counter `7D
  1153. X`09`09putobj;
  1154. X
  1155. X
  1156. X`09`09i := i +1;
  1157. X`09    end;`20
  1158. X-  861
  1159. X`09READ_error := READ_error or not flag;
  1160. X-  941,  941
  1161. Xvar sp,i,owner,filler: integer;
  1162. X- 1015, 1015
  1163. X`09if sp = 0 then begin
  1164. X`09    read_INTEGER(f,'LEVEL%',filler); (* SKIP ! *)
  1165. X`09    flag := false;
  1166. X`09end
  1167. X`09else if not read_INTEGER(f,'LEVEL%',spell.level`5Bsp`5D) then flag := fal
  1168. Vse;
  1169. X- 1042
  1170. X`09READ_error := true;
  1171. X- 1064
  1172. X`09READ_error := READ_error or not flag;
  1173. X- 1095
  1174. X`09    READ_error := true;
  1175. X- 1098
  1176. X`09    READ_error := true;
  1177. X- 1126, 1126
  1178. X`09    READ_error := READ_error or not flag;
  1179. X- 1214
  1180. X`09    READ_error := true;
  1181. X- 1236
  1182. X`09READ_error := true;
  1183. X- 1320
  1184. X`09READ_error := true;
  1185. X- 1374, 1381
  1186. X`09    if intdata = 0 then begin
  1187. X`09`09read_INTEGER(f,'OBJHIDE%',intdata); (* skip ! *)
  1188. X`09`09flag := false;
  1189. X`09    end else begin
  1190. X`09`09here.objs`5Bi`5D := intdata;
  1191. X`09`09if not read_INTEGER(f,'OBJHIDE%',here.objhide`5Bi`5D) then flag := fal
  1192. Vse;
  1193. X
  1194. X`09`09getobj(here.objs`5Bi`5D);  `20
  1195. X`09`09obj.numexist := obj.numexist + 1;   `7B Update counter `7D
  1196. X`09`09putobj;
  1197. X
  1198. X`09`09i := i+1;
  1199. X`09    end;
  1200. X- 1415
  1201. X`09READ_error := READ_error or not flag;
  1202. X- 1447
  1203. X`09READ_error := true;
  1204. X- 1488
  1205. X`09READ_error := READ_error or not flag;
  1206. X- 1527
  1207. X`09READ_error := READ_error or not flag;
  1208. X- 1545
  1209. X    write_ITEM(f,'CHARSET%',chartable_charset);
  1210. X- 1611
  1211. X    dump_charset : string;
  1212. X- 1614
  1213. X    READ_error := false;
  1214. X- 1628, 1628
  1215. X    READ_vers_104 := ver >= '1.04';
  1216. X    if (ver > DVERSION) then writeln('WARNING: Unknown version!');
  1217. X
  1218. X    if not read_ITEM(f,'CHARSET%',dump_charset) then
  1219. X`09dump_charset := 'UNKNOWN';
  1220. X    if (dump_charset = 'UNKNOWN') or (chartable_charset = 'UNKNOWN') then be
  1221. Vgin
  1222. X`09writeln('WARNING: Dumped database''s charset is ',dump_charset,' and');
  1223. X`09writeln('         charset for building database is ',
  1224. X`09    chartable_charset,'.');
  1225. X    end else if (dump_charset <> chartable_charset) then begin
  1226. X`09writeln('WARNING: Dumped database''s charset is ',dump_charset,' and');
  1227. X`09writeln('         charset for building database is ',
  1228. X`09    chartable_charset,'.');
  1229. X`09writeln('         No conversions implemented.');
  1230. X    end;
  1231. X- 1775, 1775
  1232. X`09writeln(j:3,' real players and monsters readed.')
  1233. X- 1794, 1795
  1234. X    if READ_error then writeln('Error(s) detected during read !!!');
  1235. X
  1236. X    if not eof(f) then begin
  1237. X`09(* This not detect if end of dump file have one extra line,
  1238. X`09 * because read_ITEM will read it for next line check !!!!
  1239. X`09 *)
  1240. X`09writeln('Expected end of dump file NOT detected !');
  1241. X`09writeln('  (Reading of dump file out of sync ?)');
  1242. X`09error := true;
  1243. X    end;
  1244. X
  1245. X    if error or READ_error then begin
  1246. X`09writeln('Marking created database as invalid.');
  1247. X`09getglobal;
  1248. X`09global.int`5BGF_VALID`5D := 0;`09`7B FALSE `7D
  1249. X`09putglobal;
  1250. X`09writeln;
  1251. X    end;
  1252. X
  1253. Xloppu:
  1254. X    if error or READ_error then writeln('Dump file is invalid.')
  1255. X    else writeln('Database created.');
  1256. X/
  1257. $ CALL UNPACK MONSTER_DUMP.DIF;2 1633358184
  1258. $ create 'f'
  1259. X-   13,   15
  1260. X  This parameter specifies the text form equivalent of a database.  Default`
  1261. V20
  1262. X  extension is .DMP.  This parameter is required with the qualifiers /DUMP`2
  1263. V0
  1264. X  and /BUILD.`20
  1265. X `20
  1266. X-   21,   24
  1267. X  Shows the version text.  The /VERSION qualifier shows the same  text`20
  1268. X  when playing Monster.
  1269. X
  1270. X  Incompatible with /WHO.
  1271. X-   29,   32
  1272. X  Prevents or enables the start of playing after handling of other`20
  1273. X  qualifiers. Useful with /VERSION.
  1274. X
  1275. X  Incompatible with /WHO, /DUMP and /BUILD.
  1276. X-   37,   40
  1277. X  Redirects Monster's output to a file. Useful with /VERSION or`20
  1278. X  management qualifiers.
  1279. X
  1280. X  Incompatible with /FIX, /WHO, /DUMP and /BUILD.
  1281. X-   44,   44
  1282. X  These qualifiers are only for Monster Manager.
  1283. X-   48,   51
  1284. X  Builds a new database for Monster. Checks first the entries  of`20
  1285. X  MONSTER.INIT -file.
  1286. X
  1287. X  Incompatible with /FIX, /REAL_USERID, /USERID, /BATCH, /WHO, /DUMP
  1288. X-   56,   62
  1289. X  Activates the fixing system in the interactive mode. With it`20
  1290. X  Monster Manager can fix errors of database.
  1291. X
  1292. X  Incompatible with /OUTPUT, /REBUILD, /REAL_USERID, /USERID, /BATCH,`20
  1293. X  /WHO, /DUMP and /BUILD.
  1294. X
  1295. X  See also Fixing_Database.
  1296. X-   67,   70
  1297. X  Switches the debug mode on or off. Equivalent to the DEBUG command when
  1298. X  playing Monster.
  1299. X
  1300. X  Incompatible with /WHO.
  1301. X-   74,   76
  1302. X  Enables playing with another player's name.
  1303. X
  1304. X  Incompatible with /REBUILD, /FIX, /USERID, /BATCH, /WHO, /DUMP and`20
  1305. X-   81,   83
  1306. X  Runs the fixing system in the batch mode.`20
  1307. X
  1308. X  Incompatible with /REBUILD, /FIX,  /REAL_USERID,  /USERID, /BATCH,`20
  1309. X-   88,   93
  1310. X  Nearly the same as /REBUILD: reads the database from a special text`20
  1311. X  file. The dump_file parameter is required with this qualifier.
  1312. X
  1313. X  See also /DUMP.
  1314. X
  1315. X  Incompatible with /REBUILD, /FIX, /REAL_USERID,  /USERID,  /BATCH,`20
  1316. X-   98,  102
  1317. X   Creates a text form copy of the database for /BUILDing. The dump_file
  1318. X   parameter is required with this qualifier.
  1319. X
  1320. X   Incompatible with /REBUILD, /FIX, /REAL_USERID,  /USERID,  /BATCH,`20
  1321. X   /DUMP, /OUTPUT and /START.
  1322. X-  108,  111
  1323. X  Enables playing with a virtual userid. Virtual userids are independent`20
  1324. X  of real userids. They are protected with passwords.`20
  1325. X
  1326. X  Incompatible with   /REBUILD,  /FIX,  /REAL_USERID,  /BATCH,  /WHO,`20
  1327. X-  116,  119
  1328. X  Shows players currently playing Monster, but not those starting it.
  1329. X  Ideal for LOGIN.COM.                                       `20
  1330. X
  1331. X  Incompatible with other qualifiers.
  1332. +-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-
  1333. -- 
  1334. - K E H                                      /  El{m{ on monimutkaista
  1335.   Kari.Hurtta@Helsinki.FI
  1336.