… | |
… | |
21 | * You should have received a copy of the GNU General Public License |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 | */ |
24 | */ |
25 | |
25 | |
26 | #include <EXTERN.h> |
|
|
27 | #include <perl.h> |
|
|
28 | #include <XSUB.h> |
|
|
29 | |
|
|
30 | #undef save_long // clashes with libproto.h |
|
|
31 | |
|
|
32 | #define PLUGIN_NAME "perl" |
26 | #define PLUGIN_NAME "perl" |
33 | #define PLUGIN_VERSION "cfperl 0.5" |
27 | #define PLUGIN_VERSION "cfperl 0.5" |
34 | |
|
|
35 | #ifndef __CEXTRACT__ |
|
|
36 | #include <plugin.h> |
|
|
37 | #endif |
|
|
38 | |
|
|
39 | #undef MODULEAPI |
|
|
40 | #ifdef WIN32 |
|
|
41 | #else |
|
|
42 | #define MODULEAPI |
|
|
43 | #endif |
|
|
44 | |
28 | |
45 | #include <plugin_common.h> |
29 | #include <plugin_common.h> |
46 | #include <sounds.h> |
30 | #include <sounds.h> |
47 | #include <cstdarg> |
31 | #include <cstdarg> |
48 | #include <sproto.h> |
32 | #include <sproto.h> |
49 | |
33 | |
50 | #include "cfperl.h" |
34 | #include "cfperl.h" |
51 | #include "shstr.h" |
35 | #include "shstr.h" |
52 | |
36 | |
|
|
37 | #include <EXTERN.h> |
|
|
38 | #include <perl.h> |
|
|
39 | #include <XSUB.h> |
|
|
40 | |
53 | #include "perlxsi.c" |
41 | #include "perlxsi.c" |
54 | |
42 | |
55 | extern sint64 *levels; // the experience table |
43 | extern sint64 *levels; // the experience table |
56 | |
44 | |
57 | typedef object object_ornull; |
45 | typedef object object_ornull; |
… | |
… | |
59 | |
47 | |
60 | typedef double val64; |
48 | typedef double val64; |
61 | #define newSVval64 newSVnv |
49 | #define newSVval64 newSVnv |
62 | #define SvVAL64 SvNV |
50 | #define SvVAL64 SvNV |
63 | |
51 | |
64 | static f_plug_api gethook; |
52 | static f_plug_api gethook = cfapi_get_hooks; |
65 | static f_plug_api systemDirectory; |
53 | static f_plug_api object_set_property = cfapi_object_set_property; |
66 | static f_plug_api object_set_property; |
54 | static f_plug_api object_insert = cfapi_object_insert; |
67 | static f_plug_api map_get_map; |
55 | |
68 | static f_plug_api object_insert; |
56 | static bool perl_booted; |
69 | |
57 | |
70 | /* this is a stupid way to do things, and awkward to use for plug-in authors */ |
58 | /* this is a stupid way to do things, and awkward to use for plug-in authors */ |
71 | typedef struct |
59 | typedef struct |
72 | { |
60 | { |
73 | object* who; |
61 | object* who; |
… | |
… | |
118 | return &PL_sv_undef; |
106 | return &PL_sv_undef; |
119 | |
107 | |
120 | if (!obj->self) |
108 | if (!obj->self) |
121 | obj->self = newSVptr (obj, klass); |
109 | obj->self = newSVptr (obj, klass); |
122 | |
110 | |
123 | return newSVsv (static_cast<SV *>(obj->self)); |
111 | return newSVsv (obj->self); |
124 | } |
112 | } |
125 | |
113 | |
126 | static void |
114 | static void |
127 | SVptr_cache_set (void *ptr, SV *sv) |
115 | SVptr_cache_set (void *ptr, SV *sv) |
128 | { |
116 | { |
… | |
… | |
314 | return newRV_inc ((SV *)ext->cb); |
302 | return newRV_inc ((SV *)ext->cb); |
315 | } |
303 | } |
316 | |
304 | |
317 | void attachable_base::clear () |
305 | void attachable_base::clear () |
318 | { |
306 | { |
319 | //if (self) fprintf (stderr, "free_ob_self %p %s (%p,%p)\n", this, ((object *)this)->name, self, cb);//D |
307 | if (self) |
|
|
308 | { |
|
|
309 | if (cb) |
|
|
310 | if (SvROK (*av_fetch (cb, EVENT_OBJECT_DESTROY, 1))) |
|
|
311 | INVOKE_OBJECT (DESTROY, static_cast<object *>(this)); |
|
|
312 | else if (SvROK (*av_fetch (cb, EVENT_MAP_DESTROY, 1))) |
|
|
313 | INVOKE_MAP (DESTROY, static_cast<mapstruct *>(this)); |
320 | |
314 | |
|
|
315 | // disconnect Perl from C, to avoid crashes |
|
|
316 | sv_unmagic (SvRV ((SV *)self), PERL_MAGIC_ext); |
|
|
317 | |
|
|
318 | // clear the perl hash, might or might not be a good idea |
|
|
319 | hv_clear ((HV *)SvRV ((SV *)self)); |
|
|
320 | |
321 | if (self) SvREFCNT_dec (self); |
321 | SvREFCNT_dec (self); |
|
|
322 | self = 0; |
|
|
323 | } |
|
|
324 | |
|
|
325 | if (cb) |
|
|
326 | { |
322 | if (cb) SvREFCNT_dec (cb); |
327 | SvREFCNT_dec (cb); |
|
|
328 | cb = 0; |
|
|
329 | } |
323 | |
330 | |
|
|
331 | if (attach) |
|
|
332 | { |
324 | if (attach) free_string (attach); |
333 | free_string (attach); |
325 | |
|
|
326 | self = 0; |
|
|
327 | cb = 0; |
|
|
328 | attach = 0; |
334 | attach = 0; |
|
|
335 | } |
329 | } |
336 | } |
330 | |
337 | |
331 | void attachable_base::optimise () |
338 | void attachable_base::optimise () |
332 | { |
339 | { |
333 | if (!self) |
340 | if (!self) |
… | |
… | |
342 | SvREFCNT_dec ((SV *)self); |
349 | SvREFCNT_dec ((SV *)self); |
343 | self = 0; |
350 | self = 0; |
344 | } |
351 | } |
345 | } |
352 | } |
346 | |
353 | |
347 | void |
354 | void attachable_base::instantiate (data_type type, void *obj) |
348 | object::instantiate_ () |
|
|
349 | { |
355 | { |
350 | dSP; |
356 | dSP; |
351 | ENTER; |
357 | ENTER; |
352 | SAVETMPS; |
358 | SAVETMPS; |
353 | PUSHMARK (SP); |
359 | PUSHMARK (SP); |
354 | EXTEND (SP, 2); |
360 | EXTEND (SP, 2); |
355 | PUSHs (sv_2mortal (newSVdt (DT_OBJECT, static_cast<object *>(this)))); |
361 | PUSHs (sv_2mortal (newSVdt (type, obj))); |
356 | PUSHs (sv_2mortal (newSVpv (attach, 0))); |
362 | PUSHs (sv_2mortal (newSVpv (attach, 0))); |
|
|
363 | |
|
|
364 | free_string (attach); |
|
|
365 | attach = 0; |
|
|
366 | |
357 | PUTBACK; |
367 | PUTBACK; |
358 | call_pv ("cf::instantiate", G_DISCARD | G_VOID | G_EVAL); |
368 | call_pv ("cf::instantiate", G_DISCARD | G_VOID | G_EVAL); |
359 | FREETMPS; |
369 | FREETMPS; |
360 | LEAVE; |
370 | LEAVE; |
361 | |
371 | |
362 | INVOKE_OBJECT (INSTANTIATE, this); |
372 | switch (type) |
|
|
373 | { |
|
|
374 | case DT_OBJECT: INVOKE_OBJECT (INSTANTIATE, obj); break; |
|
|
375 | case DT_MAP: INVOKE_MAP (INSTANTIATE, obj); break; |
|
|
376 | } |
363 | } |
377 | } |
364 | |
378 | |
365 | ///////////////////////////////////////////////////////////////////////////// |
379 | ///////////////////////////////////////////////////////////////////////////// |
366 | |
380 | |
367 | void reattach (data_type type, void *obj) |
381 | void reattach (data_type type, void *obj) |
368 | { |
382 | { |
|
|
383 | //TODO only do this when the object has _attachment's |
|
|
384 | |
369 | dSP; |
385 | dSP; |
370 | ENTER; |
386 | ENTER; |
371 | SAVETMPS; |
387 | SAVETMPS; |
372 | PUSHMARK (SP); |
388 | PUSHMARK (SP); |
373 | XPUSHs (sv_2mortal (newSVdt (type, obj))); |
389 | XPUSHs (sv_2mortal (newSVdt (type, obj))); |
… | |
… | |
391 | |
407 | |
392 | if (obj->self) |
408 | if (obj->self) |
393 | reattach (subclass::get_dt (), (subclass *)obj); |
409 | reattach (subclass::get_dt (), (subclass *)obj); |
394 | } |
410 | } |
395 | |
411 | |
396 | object_freezer::object_freezer (const char *filename) |
412 | object_freezer::object_freezer () |
397 | : filename (filename) |
|
|
398 | { |
413 | { |
399 | av = (AV *)newAV (); |
414 | av = newAV (); |
|
|
415 | // TODO: fast dynbuf implementation... yeah, we need obstacks |
|
|
416 | text = newSV (10 * 1024 * 1024); // only temporarily used, so be generous |
400 | } |
417 | } |
401 | |
418 | |
402 | object_freezer::~object_freezer () |
419 | object_freezer::~object_freezer () |
|
|
420 | { |
|
|
421 | SvREFCNT_dec (text); |
|
|
422 | SvREFCNT_dec (av); |
|
|
423 | } |
|
|
424 | |
|
|
425 | void object_freezer::put (attachable_base *ext) |
|
|
426 | { |
|
|
427 | ext->optimise (); |
|
|
428 | |
|
|
429 | if (ext->self) |
|
|
430 | { |
|
|
431 | int idx = AvFILLp ((AV *)av) + 1; |
|
|
432 | av_store (av, idx, SvREFCNT_inc (ext->self)); |
|
|
433 | |
|
|
434 | sv_catpvf (text, "oid %d\n", idx); |
|
|
435 | } |
|
|
436 | } |
|
|
437 | |
|
|
438 | bool object_freezer::save (const char *filename) |
403 | { |
439 | { |
404 | dSP; |
440 | dSP; |
405 | ENTER; |
441 | ENTER; |
406 | SAVETMPS; |
442 | SAVETMPS; |
407 | PUSHMARK (SP); |
443 | PUSHMARK (SP); |
|
|
444 | EXTEND (SP, 3); |
408 | XPUSHs (sv_2mortal (newSVpv (filename, 0))); |
445 | PUSHs (sv_2mortal (newSVpv (filename, 0))); |
|
|
446 | PUSHs (sv_2mortal (newRV_inc (text))); |
409 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
447 | PUSHs (sv_2mortal (newRV_inc ((SV *)av))); |
410 | PUTBACK; |
448 | PUTBACK; |
411 | call_pv ("cf::object_freezer_save", G_VOID | G_DISCARD | G_EVAL); |
449 | call_pv ("cf::object_freezer_save", G_VOID | G_DISCARD | G_EVAL); |
412 | FREETMPS; |
450 | FREETMPS; |
413 | LEAVE; |
451 | LEAVE; |
414 | } |
452 | } |
415 | |
453 | |
416 | void object_freezer::put (FILE *fp, attachable_base *ext) |
454 | int fprintf (object_freezer &freezer, const char *format, ...) |
417 | { |
455 | { |
418 | ext->optimise (); |
456 | va_list ap; |
419 | |
457 | |
420 | if (ext->self) |
458 | va_start (ap, format); |
421 | { |
459 | sv_vcatpvfn (freezer.text, format, strlen (format), &ap, 0, 0, 0); |
422 | int idx = AvFILLp ((AV *)av) + 1; |
460 | va_end (ap); |
423 | av_store ((AV *)av, idx, SvREFCNT_inc ((SV *)ext->self)); |
461 | } |
424 | fprintf (fp, "oid %d\n", idx); |
462 | |
425 | } |
463 | int fputs (const char *s, object_freezer &freezer) |
|
|
464 | { |
|
|
465 | sv_catpvn (freezer.text, s, strlen (s)); |
426 | } |
466 | } |
427 | |
467 | |
428 | object_thawer::object_thawer (const char *filename) |
468 | object_thawer::object_thawer (const char *filename) |
429 | { |
469 | { |
430 | av = 0; |
470 | av = 0; |
|
|
471 | fp = 0; |
431 | |
472 | |
432 | if (!filename) |
473 | if (!filename) |
433 | return; |
474 | return; |
434 | |
475 | |
435 | dSP; |
476 | fp = fopen (filename, "r"); |
436 | ENTER; |
477 | if (!fp) |
437 | SAVETMPS; |
|
|
438 | PUSHMARK (SP); |
|
|
439 | XPUSHs (sv_2mortal (newSVpv (filename, 0))); |
|
|
440 | PUTBACK; |
|
|
441 | |
|
|
442 | if (0 < call_pv ("cf::object_thawer_load", G_SCALAR | G_EVAL)) |
|
|
443 | { |
478 | { |
444 | SPAGAIN; |
479 | LOG (llevError, "object_thawer: unable to open '%s': %s.\n", filename, strerror (errno)); |
445 | SV *sv = POPs; |
480 | return; |
446 | if (SvROK (sv)) |
|
|
447 | av = SvREFCNT_inc (SvRV (sv)); |
|
|
448 | } |
481 | } |
449 | |
482 | |
|
|
483 | if (perl_booted) |
|
|
484 | { |
|
|
485 | dSP; |
|
|
486 | ENTER; |
|
|
487 | SAVETMPS; |
|
|
488 | PUSHMARK (SP); |
|
|
489 | XPUSHs (sv_2mortal (newSVpv (filename, 0))); |
|
|
490 | PUTBACK; |
|
|
491 | |
|
|
492 | if (0 < call_pv ("cf::object_thawer_load", G_SCALAR | G_EVAL)) |
|
|
493 | { |
|
|
494 | SPAGAIN; |
|
|
495 | SV *sv = POPs; |
|
|
496 | if (SvROK (sv)) |
|
|
497 | av = (AV *)SvREFCNT_inc (SvRV (sv)); |
|
|
498 | } |
|
|
499 | |
450 | FREETMPS; |
500 | FREETMPS; |
451 | LEAVE; |
501 | LEAVE; |
|
|
502 | } |
452 | } |
503 | } |
453 | |
504 | |
454 | void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid) |
505 | void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid) |
455 | { |
506 | { |
456 | if (!av || oid < 0) // this is actually an error of sorts |
507 | if (!av || oid < 0) // this is actually an error of sorts |
… | |
… | |
466 | printf ("trying to thaw duplicate or never-issued oid %d, ignoring.\n", oid); |
517 | printf ("trying to thaw duplicate or never-issued oid %d, ignoring.\n", oid); |
467 | return; |
518 | return; |
468 | } |
519 | } |
469 | |
520 | |
470 | ext->self = *svp; *svp = &PL_sv_undef; |
521 | ext->self = *svp; *svp = &PL_sv_undef; |
471 | sv_magic (SvRV ((SV *)ext->self), 0, PERL_MAGIC_ext, (char *)obj, 0); |
522 | sv_magic (SvRV (ext->self), 0, PERL_MAGIC_ext, (char *)obj, 0); |
472 | |
523 | |
473 | reattach (type, obj); |
524 | reattach (type, obj); |
474 | } |
525 | } |
475 | |
526 | |
476 | object_thawer::~object_thawer () |
527 | object_thawer::~object_thawer () |
477 | { |
528 | { |
478 | if (av) |
529 | if (fp) fclose (fp); |
479 | SvREFCNT_dec ((SV *)av); |
530 | if (av) SvREFCNT_dec ((AV *)av); |
480 | } |
531 | } |
481 | |
532 | |
|
|
533 | token object_thawer::get_token () |
|
|
534 | { |
|
|
535 | #if 0 |
|
|
536 | for (;;) |
|
|
537 | { |
|
|
538 | if (!fgets (line, sizeof (line), fp)) |
|
|
539 | return token (KW_eof); |
|
|
540 | |
|
|
541 | unsigned char *p = (unsigned char *)line; |
|
|
542 | |
|
|
543 | while (*p > ' ') |
|
|
544 | p++; |
|
|
545 | |
|
|
546 | int len = p - (unsigned char *)line; |
|
|
547 | |
|
|
548 | while ((*p - 1) < ' ') |
|
|
549 | p++; |
|
|
550 | |
|
|
551 | if (*p) |
|
|
552 | { |
|
|
553 | char *v = p; |
|
|
554 | |
|
|
555 | while (*p && *p != '\n') |
|
|
556 | p++; |
|
|
557 | |
|
|
558 | *p = 0; |
|
|
559 | |
|
|
560 | return token (k, v); |
|
|
561 | } |
|
|
562 | else |
|
|
563 | return token (k); |
|
|
564 | } |
|
|
565 | #endif |
|
|
566 | } |
|
|
567 | |
482 | ///////////////////////////////////////////////////////////////////////////// |
568 | ///////////////////////////////////////////////////////////////////////////// |
483 | |
569 | |
484 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
570 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
485 | { |
571 | { |
486 | gethook = gethooksptr; |
|
|
487 | |
|
|
488 | return 0; |
572 | return 0; |
489 | } |
573 | } |
490 | |
574 | |
491 | static CommArray_s rtn_cmd; |
575 | static CommArray_s rtn_cmd; |
492 | |
576 | |
… | |
… | |
572 | extern "C" int cfperl_postInitPlugin () |
656 | extern "C" int cfperl_postInitPlugin () |
573 | { |
657 | { |
574 | int hooktype = 1; |
658 | int hooktype = 1; |
575 | int rtype = 0; |
659 | int rtype = 0; |
576 | |
660 | |
577 | systemDirectory = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_system_directory"); |
|
|
578 | object_set_property = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_set_property"); |
|
|
579 | map_get_map = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_map_get_map"); |
|
|
580 | object_insert = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_insert"); |
|
|
581 | |
|
|
582 | cf_init_plugin (gethook); |
661 | cf_init_plugin (gethook); |
583 | |
662 | |
584 | return 0; |
663 | return 0; |
585 | } |
664 | } |
586 | |
665 | |
… | |
… | |
590 | } |
669 | } |
591 | |
670 | |
592 | void |
671 | void |
593 | cfperl_init () |
672 | cfperl_init () |
594 | { |
673 | { |
|
|
674 | PERL_SYS_INIT3 (&settings.argc, &settings.argv, 0); |
|
|
675 | perl = perl_alloc (); |
|
|
676 | perl_construct (perl); |
|
|
677 | |
|
|
678 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
|
|
679 | |
595 | char *argv[] = { |
680 | char *argv[] = { |
596 | "", |
681 | "", |
597 | "-e" |
682 | "-e" |
598 | "BEGIN {" |
|
|
599 | " cf->bootstrap;" |
683 | "cf->bootstrap;" |
600 | " unshift @INC, cf::datadir ();" |
684 | "unshift @INC, cf::datadir ();" |
601 | "}" |
|
|
602 | "" |
|
|
603 | "use cf;" |
|
|
604 | }; |
685 | }; |
605 | |
|
|
606 | perl = perl_alloc (); |
|
|
607 | perl_construct (perl); |
|
|
608 | |
|
|
609 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
|
|
610 | |
686 | |
611 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
687 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
612 | { |
688 | { |
613 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
689 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
614 | |
|
|
615 | exit (EXIT_FAILURE); |
690 | exit (EXIT_FAILURE); |
616 | //perl_destruct (perl); |
|
|
617 | //perl_free (perl); |
|
|
618 | //perl = 0; |
|
|
619 | //return; |
|
|
620 | } |
691 | } |
621 | |
692 | |
622 | obj_cache = newHV (); |
693 | obj_cache = newHV (); |
|
|
694 | } |
|
|
695 | |
|
|
696 | void cfperl_boot () |
|
|
697 | { |
|
|
698 | perl_booted = true; |
|
|
699 | |
|
|
700 | eval_pv ("require cf", 1); |
623 | } |
701 | } |
624 | |
702 | |
625 | void cfperl_main () |
703 | void cfperl_main () |
626 | { |
704 | { |
627 | dSP; |
705 | dSP; |
… | |
… | |
699 | dt = (data_type) va_arg (ap, int); |
777 | dt = (data_type) va_arg (ap, int); |
700 | assert (("first argument must be of type object", dt == DT_OBJECT)); |
778 | assert (("first argument must be of type object", dt == DT_OBJECT)); |
701 | op = va_arg (ap, object *); |
779 | op = va_arg (ap, object *); |
702 | |
780 | |
703 | if (op->cb) |
781 | if (op->cb) |
704 | gather_callbacks (callbacks, (AV *)op->cb, event); |
782 | gather_callbacks (callbacks, op->cb, event); |
705 | |
783 | |
706 | if (op->type) |
784 | if (op->type) |
707 | { |
785 | { |
708 | if (op->subtype && op->type + op->subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) |
786 | if (op->subtype && op->type + op->subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) |
709 | { |
787 | { |
… | |
… | |
730 | dt = (data_type) va_arg (ap, int); |
808 | dt = (data_type) va_arg (ap, int); |
731 | assert (("first argument must be of type player", dt == DT_PLAYER)); |
809 | assert (("first argument must be of type player", dt == DT_PLAYER)); |
732 | pl = va_arg (ap, player *); |
810 | pl = va_arg (ap, player *); |
733 | |
811 | |
734 | if (pl->cb) |
812 | if (pl->cb) |
735 | gather_callbacks (callbacks, (AV *)pl->cb, event); |
813 | gather_callbacks (callbacks, pl->cb, event); |
736 | |
814 | |
737 | gather_callbacks (callbacks, cb_player, event); |
815 | gather_callbacks (callbacks, cb_player, event); |
738 | break; |
816 | break; |
739 | |
817 | |
740 | case KLASS_MAP: |
818 | case KLASS_MAP: |
741 | dt = (data_type) va_arg (ap, int); |
819 | dt = (data_type) va_arg (ap, int); |
742 | assert (("first argument must be of type object", dt == DT_MAP)); |
820 | assert (("first argument must be of type object", dt == DT_MAP)); |
743 | map = va_arg (ap, mapstruct *); |
821 | map = va_arg (ap, mapstruct *); |
744 | |
822 | |
745 | if (map->cb) |
823 | if (map->cb) |
746 | gather_callbacks (callbacks, (AV *)map->cb, event); |
824 | gather_callbacks (callbacks, map->cb, event); |
747 | |
825 | |
748 | gather_callbacks (callbacks, cb_map, event); |
826 | gather_callbacks (callbacks, cb_map, event); |
749 | break; |
827 | break; |
750 | |
828 | |
751 | default: |
829 | default: |
… | |
… | |
1371 | prop (CFAPI_INT, MAP_PROP_WINDDIR) |
1449 | prop (CFAPI_INT, MAP_PROP_WINDDIR) |
1372 | prop (CFAPI_INT, MAP_PROP_SKY) |
1450 | prop (CFAPI_INT, MAP_PROP_SKY) |
1373 | prop (CFAPI_INT, MAP_PROP_WPARTX) |
1451 | prop (CFAPI_INT, MAP_PROP_WPARTX) |
1374 | prop (CFAPI_INT, MAP_PROP_WPARTY) |
1452 | prop (CFAPI_INT, MAP_PROP_WPARTY) |
1375 | prop (CFAPI_STRING, MAP_PROP_MESSAGE) |
1453 | prop (CFAPI_STRING, MAP_PROP_MESSAGE) |
1376 | prop (CFAPI_PMAP, MAP_PROP_NEXT) |
|
|
1377 | prop (CFAPI_PREGION, MAP_PROP_REGION) |
1454 | prop (CFAPI_PREGION, MAP_PROP_REGION) |
1378 | prop (CFAPI_POBJECT, OBJECT_PROP_OB_ABOVE) |
|
|
1379 | prop (CFAPI_POBJECT, OBJECT_PROP_OB_BELOW) |
|
|
1380 | prop (CFAPI_POBJECT, OBJECT_PROP_NEXT_ACTIVE_OB) |
1455 | prop (CFAPI_POBJECT, OBJECT_PROP_NEXT_ACTIVE_OB) |
1381 | prop (CFAPI_POBJECT, OBJECT_PROP_PREV_ACTIVE_OB) |
1456 | prop (CFAPI_POBJECT, OBJECT_PROP_PREV_ACTIVE_OB) |
1382 | prop (CFAPI_POBJECT, OBJECT_PROP_INVENTORY) |
1457 | prop (CFAPI_POBJECT, OBJECT_PROP_INVENTORY) |
1383 | prop (CFAPI_POBJECT, OBJECT_PROP_ENVIRONMENT) |
1458 | prop (CFAPI_POBJECT, OBJECT_PROP_ENVIRONMENT) |
1384 | prop (CFAPI_POBJECT, OBJECT_PROP_HEAD) |
|
|
1385 | prop (CFAPI_POBJECT, OBJECT_PROP_CONTAINER) |
1459 | prop (CFAPI_POBJECT, OBJECT_PROP_CONTAINER) |
1386 | prop (CFAPI_PMAP, OBJECT_PROP_MAP) |
1460 | prop (CFAPI_PMAP, OBJECT_PROP_MAP) |
1387 | prop (CFAPI_INT, OBJECT_PROP_COUNT) |
1461 | prop (CFAPI_INT, OBJECT_PROP_COUNT) |
1388 | prop (CFAPI_INT, OBJECT_PROP_REFCOUNT) |
1462 | prop (CFAPI_INT, OBJECT_PROP_REFCOUNT) |
1389 | prop (CFAPI_STRING, OBJECT_PROP_NAME) |
1463 | prop (CFAPI_STRING, OBJECT_PROP_NAME) |
… | |
… | |
1521 | PROTOTYPE: $$ |
1595 | PROTOTYPE: $$ |
1522 | |
1596 | |
1523 | char *path_combine_and_normalize (char *base, char *path) |
1597 | char *path_combine_and_normalize (char *base, char *path) |
1524 | PROTOTYPE: $$ |
1598 | PROTOTYPE: $$ |
1525 | |
1599 | |
1526 | char * |
1600 | const char * |
1527 | cf_get_maps_directory (char *path) |
1601 | get_maps_directory (char *path) |
1528 | PROTOTYPE: $ |
1602 | PROTOTYPE: $ |
1529 | ALIAS: maps_directory = 0 |
1603 | ALIAS: maps_directory = 0 |
|
|
1604 | CODE: |
|
|
1605 | RETVAL = create_pathname (path); |
|
|
1606 | OUTPUT: RETVAL |
1530 | |
1607 | |
1531 | void |
1608 | void |
1532 | sub_generation_inc () |
1609 | sub_generation_inc () |
1533 | CODE: |
1610 | CODE: |
1534 | PL_sub_generation++; |
1611 | PL_sub_generation++; |
… | |
… | |
1543 | confdir = 3 |
1620 | confdir = 3 |
1544 | localdir = 4 |
1621 | localdir = 4 |
1545 | playerdir = 5 |
1622 | playerdir = 5 |
1546 | datadir = 6 |
1623 | datadir = 6 |
1547 | CODE: |
1624 | CODE: |
1548 | { |
1625 | switch (ix) |
1549 | int unused_type; |
1626 | { |
1550 | RETVAL = (char *)systemDirectory (&unused_type, ix); |
1627 | case 0: RETVAL = settings.mapdir ; break; |
1551 | } |
1628 | case 1: RETVAL = settings.uniquedir; break; |
|
|
1629 | case 2: RETVAL = settings.tmpdir ; break; |
|
|
1630 | case 3: RETVAL = settings.confdir ; break; |
|
|
1631 | case 4: RETVAL = settings.localdir ; break; |
|
|
1632 | case 5: RETVAL = settings.playerdir; break; |
|
|
1633 | case 6: RETVAL = settings.datadir ; break; |
|
|
1634 | } |
1552 | OUTPUT: RETVAL |
1635 | OUTPUT: RETVAL |
1553 | |
1636 | |
1554 | int |
1637 | int |
1555 | cf_find_animation (char *text) |
1638 | cf_find_animation (char *text) |
1556 | PROTOTYPE: $ |
1639 | PROTOTYPE: $ |
… | |
… | |
1560 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1643 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1561 | |
1644 | |
1562 | int invoke (int event, ...) |
1645 | int invoke (int event, ...) |
1563 | CODE: |
1646 | CODE: |
1564 | if (KLASS_OF (event) != KLASS_GLOBAL) croak ("event class must be GLOBAL"); |
1647 | if (KLASS_OF (event) != KLASS_GLOBAL) croak ("event class must be GLOBAL"); |
1565 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); for (int i = 1; i < items; i++) av_push (av, ST (i)); |
1648 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1649 | for (int i = 1; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1566 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
1650 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
1567 | OUTPUT: RETVAL |
1651 | OUTPUT: RETVAL |
1568 | |
1652 | |
1569 | int |
1653 | int |
1570 | exp_to_level (val64 exp) |
1654 | exp_to_level (val64 exp) |
… | |
… | |
1603 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1687 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1604 | else |
1688 | else |
1605 | XSRETURN_UNDEF; |
1689 | XSRETURN_UNDEF; |
1606 | OUTPUT: RETVAL |
1690 | OUTPUT: RETVAL |
1607 | |
1691 | |
|
|
1692 | int |
|
|
1693 | _valid (SV *obj) |
|
|
1694 | CODE: |
|
|
1695 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
|
|
1696 | OUTPUT: |
|
|
1697 | RETVAL |
|
|
1698 | |
1608 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1699 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1609 | |
1700 | |
1610 | int invoke (object *op, int event, ...) |
1701 | int invoke (object *op, int event, ...) |
1611 | CODE: |
1702 | CODE: |
1612 | if (KLASS_OF (event) != KLASS_OBJECT) croak ("event class must be OBJECT"); |
1703 | if (KLASS_OF (event) != KLASS_OBJECT) croak ("event class must be OBJECT"); |
1613 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); for (int i = 2; i < items; i++) av_push (av, ST (i)); |
1704 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1705 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1614 | RETVAL = INVOKE_((event_type)event, ARG_OBJECT (op), ARG_AV (av)); |
1706 | RETVAL = INVOKE_((event_type)event, ARG_OBJECT (op), ARG_AV (av)); |
1615 | OUTPUT: RETVAL |
1707 | OUTPUT: RETVAL |
1616 | |
1708 | |
1617 | SV *registry (object *op) |
1709 | SV *registry (object *op) |
1618 | CODE: |
1710 | CODE: |
1619 | RETVAL = registry_of (op); |
1711 | RETVAL = registry_of (op); |
1620 | OUTPUT: |
1712 | OUTPUT: |
|
|
1713 | RETVAL |
|
|
1714 | |
|
|
1715 | object *head (object *op) |
|
|
1716 | PROTOTYPE: $ |
|
|
1717 | ALIAS: |
|
|
1718 | more = 1 |
|
|
1719 | above = 2 |
|
|
1720 | below = 3 |
|
|
1721 | CODE: |
|
|
1722 | switch (ix) |
|
|
1723 | { |
|
|
1724 | case 0: RETVAL = op->head ? op->head : op; break; // DOH! |
|
|
1725 | case 1: RETVAL = op->more; break; |
|
|
1726 | case 2: RETVAL = op->above; break; |
|
|
1727 | case 3: RETVAL = op->below; break; |
|
|
1728 | } |
|
|
1729 | OUTPUT: |
1621 | RETVAL |
1730 | RETVAL |
1622 | |
1731 | |
1623 | SV * |
1732 | SV * |
1624 | get_property (object *obj, int type, int idx) |
1733 | get_property (object *obj, int type, int idx) |
1625 | CODE: |
1734 | CODE: |
… | |
… | |
1705 | |
1814 | |
1706 | int need_identify (const object *obj); |
1815 | int need_identify (const object *obj); |
1707 | |
1816 | |
1708 | int apply_shop_mat (object *shop_mat, object *op); |
1817 | int apply_shop_mat (object *shop_mat, object *op); |
1709 | |
1818 | |
1710 | void cf_object_move (object *op, int dir, object *originator = op) |
1819 | int move (object *op, int dir, object *originator = op) |
|
|
1820 | CODE: |
|
|
1821 | RETVAL = move_ob (op, dir, originator); |
|
|
1822 | OUTPUT: |
|
|
1823 | RETVAL |
1711 | |
1824 | |
1712 | void cf_object_apply (object *op, object *author, int flags = 0) |
1825 | void cf_object_apply (object *op, object *author, int flags = 0) |
1713 | |
1826 | |
1714 | void cf_object_apply_below (object *op) |
1827 | void cf_object_apply_below (object *op) |
1715 | |
1828 | |
… | |
… | |
1756 | int cf_object_out_of_map (object *op, int x, int y) |
1869 | int cf_object_out_of_map (object *op, int x, int y) |
1757 | |
1870 | |
1758 | void cf_object_drop (object *op, object *author) |
1871 | void cf_object_drop (object *op, object *author) |
1759 | |
1872 | |
1760 | void cf_object_take (object *op, object *author) |
1873 | void cf_object_take (object *op, object *author) |
1761 | |
|
|
1762 | void cf_object_say (object *op, char *msg) |
|
|
1763 | |
|
|
1764 | void cf_object_speak (object *op, char *msg) |
|
|
1765 | |
1874 | |
1766 | object *cf_object_insert_object (object *op, object *container) |
1875 | object *cf_object_insert_object (object *op, object *container) |
1767 | |
1876 | |
1768 | const char *cf_object_get_msg (object *ob) |
1877 | const char *cf_object_get_msg (object *ob) |
1769 | ALIAS: msg = 0 |
1878 | ALIAS: msg = 0 |
… | |
… | |
1908 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2017 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
1909 | |
2018 | |
1910 | int invoke (player *pl, int event, ...) |
2019 | int invoke (player *pl, int event, ...) |
1911 | CODE: |
2020 | CODE: |
1912 | if (KLASS_OF (event) != KLASS_PLAYER) croak ("event class must be PLAYER"); |
2021 | if (KLASS_OF (event) != KLASS_PLAYER) croak ("event class must be PLAYER"); |
1913 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); for (int i = 2; i < items; i++) av_push (av, ST (i)); |
2022 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
2023 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1914 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
2024 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
1915 | OUTPUT: RETVAL |
2025 | OUTPUT: RETVAL |
1916 | |
2026 | |
1917 | SV *registry (player *pl) |
2027 | SV *registry (player *pl) |
1918 | CODE: |
2028 | CODE: |
… | |
… | |
2045 | OUTPUT: RETVAL |
2155 | OUTPUT: RETVAL |
2046 | |
2156 | |
2047 | |
2157 | |
2048 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2158 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2049 | |
2159 | |
|
|
2160 | mapstruct *first () |
|
|
2161 | PROTOTYPE: |
|
|
2162 | CODE: |
|
|
2163 | RETVAL = first_map; |
|
|
2164 | OUTPUT: RETVAL |
|
|
2165 | |
|
|
2166 | mapstruct *next (mapstruct *map) |
|
|
2167 | PROTOTYPE: |
|
|
2168 | CODE: |
|
|
2169 | RETVAL = map->next; |
|
|
2170 | OUTPUT: RETVAL |
|
|
2171 | |
2050 | int invoke (mapstruct *map, int event, ...) |
2172 | int invoke (mapstruct *map, int event, ...) |
2051 | CODE: |
2173 | CODE: |
2052 | if (KLASS_OF (event) != KLASS_MAP) croak ("event class must be MAP"); |
2174 | if (KLASS_OF (event) != KLASS_MAP) croak ("event class must be MAP"); |
2053 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); for (int i = 2; i < items; i++) av_push (av, ST (i)); |
2175 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
2176 | for (int i = 2; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
2054 | RETVAL = INVOKE_((event_type)event, ARG_MAP (map), ARG_AV (av)); |
2177 | RETVAL = INVOKE_((event_type)event, ARG_MAP (map), ARG_AV (av)); |
2055 | OUTPUT: |
2178 | OUTPUT: RETVAL |
2056 | RETVAL |
|
|
2057 | |
2179 | |
2058 | SV *registry (mapstruct *map) |
2180 | SV *registry (mapstruct *map) |
2059 | CODE: |
2181 | CODE: |
2060 | RETVAL = registry_of (map); |
2182 | RETVAL = registry_of (map); |
2061 | OUTPUT: |
2183 | OUTPUT: |
… | |
… | |
2081 | |
2203 | |
2082 | mapstruct *new (int width, int height) |
2204 | mapstruct *new (int width, int height) |
2083 | PROTOTYPE: |
2205 | PROTOTYPE: |
2084 | CODE: |
2206 | CODE: |
2085 | { |
2207 | { |
2086 | int unused_type; |
2208 | RETVAL = get_empty_map (width, height); |
2087 | RETVAL = (mapstruct*) map_get_map (&unused_type, 0, width, height); |
|
|
2088 | } |
2209 | } |
2089 | OUTPUT: |
2210 | OUTPUT: |
2090 | RETVAL |
2211 | RETVAL |
2091 | |
2212 | |
2092 | void delete_map (mapstruct *map) |
2213 | void delete_map (mapstruct *map) |
… | |
… | |
2107 | XSRETURN_UNDEF; |
2228 | XSRETURN_UNDEF; |
2108 | RETVAL = map->tile_path [dir]; |
2229 | RETVAL = map->tile_path [dir]; |
2109 | OUTPUT: |
2230 | OUTPUT: |
2110 | RETVAL |
2231 | RETVAL |
2111 | |
2232 | |
2112 | mapstruct *cf_map_get_map (char *name) |
2233 | mapstruct *ready_map_name (char *name, int flags = 0) |
2113 | PROTOTYPE: $ |
2234 | PROTOTYPE: $;$ |
2114 | ALIAS: map = 0 |
2235 | ALIAS: |
|
|
2236 | find = 0 |
|
|
2237 | get_map = 1 |
2115 | |
2238 | |
2116 | mapstruct *has_been_loaded (char *name) |
2239 | mapstruct *has_been_loaded (char *name) |
2117 | PROTOTYPE: $ |
2240 | PROTOTYPE: $ |
2118 | |
|
|
2119 | mapstruct *cf_map_get_first () |
|
|
2120 | PROTOTYPE: |
|
|
2121 | ALIAS: first = 0 |
|
|
2122 | |
2241 | |
2123 | # whoever "designed" the plug-in api should have wasted |
2242 | # whoever "designed" the plug-in api should have wasted |
2124 | # his/her time with staying away from the project - would have |
2243 | # his/her time with staying away from the project - would have |
2125 | # saved others a lot of time, without doubt. |
2244 | # saved others a lot of time, without doubt. |
2126 | void set_path (mapstruct *where, char *path) |
2245 | void set_path (mapstruct *where, char *path) |
… | |
… | |
2141 | |
2260 | |
2142 | void set_unique (mapstruct *map, bool unique) |
2261 | void set_unique (mapstruct *map, bool unique) |
2143 | CODE: |
2262 | CODE: |
2144 | map->unique = unique; |
2263 | map->unique = unique; |
2145 | |
2264 | |
|
|
2265 | void |
|
|
2266 | trigger (mapstruct *map, long connection, bool state = true) |
|
|
2267 | CODE: |
|
|
2268 | activate_connection (map, connection, state); |
|
|
2269 | |
|
|
2270 | void |
|
|
2271 | get_connection (mapstruct *map, long connection) |
|
|
2272 | PPCODE: |
|
|
2273 | oblinkpt *obp = get_connection_links (map, connection); |
|
|
2274 | if (obp) |
|
|
2275 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
|
|
2276 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, ol->ob))); |
|
|
2277 | |
2146 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
2278 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
2147 | |
2279 | |
2148 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
2280 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
2149 | |
2281 | |
2150 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
2282 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
… | |
… | |
2154 | cf_map_normalise (mapstruct *map, int x, int y) |
2286 | cf_map_normalise (mapstruct *map, int x, int y) |
2155 | PPCODE: |
2287 | PPCODE: |
2156 | { |
2288 | { |
2157 | mapstruct *nmap = 0; |
2289 | mapstruct *nmap = 0; |
2158 | I16 nx = 0, ny = 0; |
2290 | I16 nx = 0, ny = 0; |
2159 | int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2291 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
2160 | |
2292 | |
2161 | EXTEND (SP, 4); |
2293 | EXTEND (SP, 4); |
2162 | PUSHs (sv_2mortal (newSViv (flags))); |
2294 | PUSHs (sv_2mortal (newSViv (flags))); |
2163 | |
2295 | |
2164 | if (GIMME_V == G_ARRAY) |
2296 | if (GIMME_V == G_ARRAY) |
… | |
… | |
2176 | { |
2308 | { |
2177 | object *o; |
2309 | object *o; |
2178 | mapstruct *nmap = 0; |
2310 | mapstruct *nmap = 0; |
2179 | I16 nx, ny; |
2311 | I16 nx, ny; |
2180 | |
2312 | |
2181 | cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2313 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
2182 | |
2314 | |
2183 | if (nmap) |
2315 | if (nmap) |
2184 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2316 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2185 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2317 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2186 | } |
2318 | } |
… | |
… | |
2211 | case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
2343 | case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
2212 | } |
2344 | } |
2213 | OUTPUT: |
2345 | OUTPUT: |
2214 | RETVAL |
2346 | RETVAL |
2215 | |
2347 | |
2216 | # "deserialise" perl map data into the map # TODO# compatibility cruft, remove |
|
|
2217 | void |
|
|
2218 | _set_obs (mapstruct *map, SV *sv) |
|
|
2219 | CODE: |
|
|
2220 | { |
|
|
2221 | object *o; |
|
|
2222 | AV *av; |
|
|
2223 | int x, y; |
|
|
2224 | AV *obs = (AV *)SvRV (sv); |
|
|
2225 | |
2348 | |
2226 | for (y = 0; y < MAP_HEIGHT (map); y++) |
2349 | MODULE = cf PACKAGE = cf::arch |
2227 | for (x = 0; x < MAP_WIDTH (map); x++) |
|
|
2228 | { |
|
|
2229 | sv = *av_fetch (obs, x + y * MAP_HEIGHT (map), 1); |
|
|
2230 | |
2350 | |
2231 | if (!SvROK (sv)) |
2351 | archetype *first() |
2232 | continue; |
|
|
2233 | |
|
|
2234 | av = (AV *)SvRV (sv); |
|
|
2235 | |
|
|
2236 | for (o = GET_MAP_OB (map, x, y); o; o = o->above) |
|
|
2237 | { |
|
|
2238 | sv = av_shift (av); |
|
|
2239 | |
|
|
2240 | if (SvROK (sv)) |
|
|
2241 | { |
|
|
2242 | sv_magic ((SV *)SvRV (sv), 0, PERL_MAGIC_ext, (char *)o, 0); |
|
|
2243 | SVptr_cache_set (o, sv); |
|
|
2244 | } |
|
|
2245 | } |
|
|
2246 | } |
|
|
2247 | } |
|
|
2248 | |
|
|
2249 | |
|
|
2250 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
|
|
2251 | |
|
|
2252 | archetype *cf_archetype_get_first() |
|
|
2253 | PROTOTYPE: |
2352 | PROTOTYPE: |
2254 | ALIAS: first = 0 |
2353 | CODE: |
|
|
2354 | RETVAL = first_archetype; |
|
|
2355 | OUTPUT: RETVAL |
2255 | |
2356 | |
2256 | archetype *cf_archetype_get_next (archetype *arch) |
2357 | archetype *next (archetype *arch) |
2257 | ALIAS: next = 0 |
2358 | CODE: |
|
|
2359 | RETVAL = arch->next; |
|
|
2360 | OUTPUT: RETVAL |
2258 | |
2361 | |
2259 | archetype *cf_archetype_get_head (archetype *arch) |
2362 | archetype *head (archetype *arch) |
2260 | ALIAS: head = 0 |
2363 | CODE: |
|
|
2364 | RETVAL = arch->head; |
|
|
2365 | OUTPUT: RETVAL |
2261 | |
2366 | |
2262 | archetype *cf_archetype_get_more (archetype *arch) |
2367 | archetype *more (archetype *arch) |
2263 | ALIAS: more = 0 |
2368 | CODE: |
|
|
2369 | RETVAL = arch->more; |
|
|
2370 | OUTPUT: RETVAL |
2264 | |
2371 | |
2265 | const char *cf_archetype_get_name (archetype *arch) |
2372 | const char *name (archetype *arch) |
2266 | ALIAS: name = 0 |
2373 | CODE: |
|
|
2374 | RETVAL = arch->name; |
|
|
2375 | OUTPUT: RETVAL |
2267 | |
2376 | |
2268 | object *cf_archetype_get_clone (archetype *arch) |
2377 | object *clone (archetype *arch) |
2269 | ALIAS: clone = 0 |
2378 | CODE: |
|
|
2379 | RETVAL = &arch->clone; |
|
|
2380 | OUTPUT: RETVAL |
2270 | |
2381 | |
2271 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
2382 | MODULE = cf PACKAGE = cf::party |
2272 | |
2383 | |
2273 | partylist *cf_party_get_first () |
2384 | partylist *first () |
2274 | PROTOTYPE: |
2385 | PROTOTYPE: |
2275 | ALIAS: first = 0 |
2386 | CODE: |
|
|
2387 | RETVAL = get_firstparty (); |
|
|
2388 | OUTPUT: RETVAL |
2276 | |
2389 | |
2277 | partylist *cf_party_get_next (partylist *party) |
2390 | partylist *next (partylist *party) |
2278 | ALIAS: next = 0 |
2391 | CODE: |
|
|
2392 | RETVAL = party->next; |
|
|
2393 | OUTPUT: RETVAL |
2279 | |
2394 | |
2280 | const char *cf_party_get_name (partylist *party) |
2395 | const char *name (partylist *party) |
|
|
2396 | CODE: |
|
|
2397 | RETVAL = party->partyname; |
|
|
2398 | OUTPUT: RETVAL |
2281 | |
2399 | |
2282 | const char *cf_party_get_password (partylist *party) |
2400 | const char *password (partylist *party) |
2283 | ALIAS: password = 0 |
2401 | CODE: |
|
|
2402 | RETVAL = party->passwd; |
|
|
2403 | OUTPUT: RETVAL |
2284 | |
2404 | |
2285 | player *cf_party_get_first_player (partylist *party) |
2405 | MODULE = cf PACKAGE = cf::region |
2286 | ALIAS: first_player = 0 |
|
|
2287 | |
2406 | |
2288 | player *cf_party_get_next_player (partylist *party, player *op) |
2407 | region *first () |
2289 | ALIAS: next_player = 0 |
|
|
2290 | |
|
|
2291 | |
|
|
2292 | MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ |
|
|
2293 | |
|
|
2294 | region *cf_region_get_first () |
|
|
2295 | PROTOTYPE: |
2408 | PROTOTYPE: |
2296 | ALIAS: first = 0 |
2409 | CODE: |
|
|
2410 | RETVAL = first_region; |
|
|
2411 | OUTPUT: RETVAL |
2297 | |
2412 | |
|
|
2413 | region *next (region *reg) |
|
|
2414 | CODE: |
|
|
2415 | RETVAL = reg->next; |
|
|
2416 | OUTPUT: RETVAL |
|
|
2417 | |
|
|
2418 | const char *name (region *reg) |
|
|
2419 | CODE: |
|
|
2420 | RETVAL = reg->name; |
|
|
2421 | OUTPUT: RETVAL |
|
|
2422 | |
|
|
2423 | region *parent (region *reg) |
|
|
2424 | CODE: |
|
|
2425 | RETVAL = reg->parent; |
|
|
2426 | OUTPUT: RETVAL |
|
|
2427 | |
2298 | const char *cf_region_get_name (region *reg) |
2428 | const char *longname (region *reg) |
2299 | ALIAS: name = 0 |
2429 | CODE: |
|
|
2430 | RETVAL = reg->longname; |
|
|
2431 | OUTPUT: RETVAL |
2300 | |
2432 | |
2301 | region *cf_region_get_next (region *reg) |
2433 | const char *msg (region *reg) |
2302 | ALIAS: next = 0 |
2434 | CODE: |
|
|
2435 | RETVAL = reg->msg; |
|
|
2436 | OUTPUT: RETVAL |
2303 | |
2437 | |
2304 | region *cf_region_get_parent (region *reg) |
2438 | MODULE = cf PACKAGE = cf::living |
2305 | ALIAS: parent = 0 |
|
|
2306 | |
|
|
2307 | const char *cf_region_get_longname (region *reg) |
|
|
2308 | ALIAS: longname = 0 |
|
|
2309 | |
|
|
2310 | const char *cf_region_get_message (region *reg) |
|
|
2311 | ALIAS: message = 0 |
|
|
2312 | |
|
|
2313 | |
|
|
2314 | MODULE = cf PACKAGE = cf::living PREFIX = cf_living_ |
|
|
2315 | |
2439 | |
2316 | val64 |
2440 | val64 |
2317 | exp (living *liv, val64 new_val = 0) |
2441 | exp (living *liv, val64 new_val = 0) |
2318 | PROTOTYPE: $;$ |
2442 | PROTOTYPE: $;$ |
2319 | ALIAS: |
2443 | ALIAS: |