… | |
… | |
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))); |
… | |
… | |
388 | void reattach (attachable<subclass> *obj) |
404 | void reattach (attachable<subclass> *obj) |
389 | { |
405 | { |
390 | obj->optimise (); |
406 | obj->optimise (); |
391 | |
407 | |
392 | if (obj->self) |
408 | if (obj->self) |
393 | reattach (subclass::get_dt (), (subclass *)obj); |
409 | reattach ((data_type) cftype<subclass>::dt, (subclass *)obj); |
394 | } |
410 | } |
395 | |
411 | |
|
|
412 | #include "kw_hash.h" |
|
|
413 | |
396 | object_freezer::object_freezer (const char *filename) |
414 | object_freezer::object_freezer () |
397 | : filename (filename) |
|
|
398 | { |
415 | { |
399 | av = (AV *)newAV (); |
416 | av = newAV (); |
|
|
417 | // TODO: fast dynbuf implementation... yeah, we need obstacks |
|
|
418 | text = newSV (10 * 1024 * 1024); // only temporarily used, so be generous |
400 | } |
419 | } |
401 | |
420 | |
402 | object_freezer::~object_freezer () |
421 | object_freezer::~object_freezer () |
|
|
422 | { |
|
|
423 | SvREFCNT_dec (text); |
|
|
424 | SvREFCNT_dec (av); |
|
|
425 | } |
|
|
426 | |
|
|
427 | void object_freezer::put (attachable_base *ext) |
|
|
428 | { |
|
|
429 | ext->optimise (); |
|
|
430 | |
|
|
431 | if (ext->self) |
|
|
432 | { |
|
|
433 | int idx = AvFILLp ((AV *)av) + 1; |
|
|
434 | av_store (av, idx, SvREFCNT_inc (ext->self)); |
|
|
435 | |
|
|
436 | sv_catpvf (text, "oid %d\n", idx); |
|
|
437 | } |
|
|
438 | } |
|
|
439 | |
|
|
440 | void object_freezer::put (keyword k) |
|
|
441 | { |
|
|
442 | sv_catpv (text, keyword_str [k]); |
|
|
443 | } |
|
|
444 | |
|
|
445 | void object_freezer::put (const char *v) |
|
|
446 | { |
|
|
447 | sv_catpv (text, v); |
|
|
448 | } |
|
|
449 | |
|
|
450 | void object_freezer::put (int v) |
|
|
451 | { |
|
|
452 | sv_catpvf (text, "%d\n", v); |
|
|
453 | } |
|
|
454 | |
|
|
455 | bool object_freezer::save (const char *filename) |
403 | { |
456 | { |
404 | dSP; |
457 | dSP; |
405 | ENTER; |
458 | ENTER; |
406 | SAVETMPS; |
459 | SAVETMPS; |
407 | PUSHMARK (SP); |
460 | PUSHMARK (SP); |
|
|
461 | EXTEND (SP, 3); |
408 | XPUSHs (sv_2mortal (newSVpv (filename, 0))); |
462 | PUSHs (sv_2mortal (newSVpv (filename, 0))); |
|
|
463 | PUSHs (sv_2mortal (newRV_inc (text))); |
409 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
464 | PUSHs (sv_2mortal (newRV_inc ((SV *)av))); |
410 | PUTBACK; |
465 | PUTBACK; |
411 | call_pv ("cf::object_freezer_save", G_VOID | G_DISCARD | G_EVAL); |
466 | call_pv ("cf::object_freezer_save", G_VOID | G_DISCARD | G_EVAL); |
412 | FREETMPS; |
467 | FREETMPS; |
413 | LEAVE; |
468 | LEAVE; |
414 | } |
469 | } |
415 | |
470 | |
416 | void object_freezer::put (FILE *fp, attachable_base *ext) |
471 | int fprintf (object_freezer &freezer, const char *format, ...) |
417 | { |
472 | { |
418 | ext->optimise (); |
473 | va_list ap; |
419 | |
474 | |
420 | if (ext->self) |
475 | va_start (ap, format); |
421 | { |
476 | sv_vcatpvfn (freezer.text, format, strlen (format), &ap, 0, 0, 0); |
422 | int idx = AvFILLp ((AV *)av) + 1; |
477 | va_end (ap); |
423 | av_store ((AV *)av, idx, SvREFCNT_inc ((SV *)ext->self)); |
478 | } |
424 | fprintf (fp, "oid %d\n", idx); |
479 | |
425 | } |
480 | int fputs (const char *s, object_freezer &freezer) |
|
|
481 | { |
|
|
482 | sv_catpvn (freezer.text, s, strlen (s)); |
426 | } |
483 | } |
427 | |
484 | |
428 | object_thawer::object_thawer (const char *filename) |
485 | object_thawer::object_thawer (const char *filename) |
429 | { |
486 | { |
430 | av = 0; |
487 | av = 0; |
|
|
488 | fp = 0; |
431 | |
489 | |
432 | if (!filename) |
490 | if (!filename) |
433 | return; |
491 | return; |
434 | |
492 | |
435 | dSP; |
493 | fp = fopen (filename, "r"); |
436 | ENTER; |
494 | 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 | { |
495 | { |
444 | SPAGAIN; |
496 | LOG (llevError, "object_thawer: unable to open '%s': %s.\n", filename, strerror (errno)); |
445 | SV *sv = POPs; |
497 | return; |
446 | if (SvROK (sv)) |
|
|
447 | av = SvREFCNT_inc (SvRV (sv)); |
|
|
448 | } |
498 | } |
449 | |
499 | |
|
|
500 | if (perl_booted) |
|
|
501 | { |
|
|
502 | dSP; |
|
|
503 | ENTER; |
|
|
504 | SAVETMPS; |
|
|
505 | PUSHMARK (SP); |
|
|
506 | XPUSHs (sv_2mortal (newSVpv (filename, 0))); |
|
|
507 | PUTBACK; |
|
|
508 | |
|
|
509 | if (0 < call_pv ("cf::object_thawer_load", G_SCALAR | G_EVAL)) |
|
|
510 | { |
|
|
511 | SPAGAIN; |
|
|
512 | SV *sv = POPs; |
|
|
513 | if (SvROK (sv)) |
|
|
514 | av = (AV *)SvREFCNT_inc (SvRV (sv)); |
|
|
515 | } |
|
|
516 | |
450 | FREETMPS; |
517 | FREETMPS; |
451 | LEAVE; |
518 | LEAVE; |
|
|
519 | } |
452 | } |
520 | } |
453 | |
521 | |
454 | void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid) |
522 | void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid) |
455 | { |
523 | { |
456 | if (!av || oid < 0) // this is actually an error of sorts |
524 | 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); |
534 | printf ("trying to thaw duplicate or never-issued oid %d, ignoring.\n", oid); |
467 | return; |
535 | return; |
468 | } |
536 | } |
469 | |
537 | |
470 | ext->self = *svp; *svp = &PL_sv_undef; |
538 | ext->self = *svp; *svp = &PL_sv_undef; |
471 | sv_magic (SvRV ((SV *)ext->self), 0, PERL_MAGIC_ext, (char *)obj, 0); |
539 | sv_magic (SvRV (ext->self), 0, PERL_MAGIC_ext, (char *)obj, 0); |
472 | |
540 | |
473 | reattach (type, obj); |
541 | reattach (type, obj); |
474 | } |
542 | } |
475 | |
543 | |
476 | object_thawer::~object_thawer () |
544 | object_thawer::~object_thawer () |
477 | { |
545 | { |
478 | if (av) |
546 | if (fp) fclose (fp); |
479 | SvREFCNT_dec ((SV *)av); |
547 | if (av) SvREFCNT_dec ((AV *)av); |
480 | } |
548 | } |
481 | |
549 | |
|
|
550 | token object_thawer::get_token () |
|
|
551 | { |
|
|
552 | #if 0 |
|
|
553 | for (;;) |
|
|
554 | { |
|
|
555 | if (!fgets (line, sizeof (line), fp)) |
|
|
556 | return token (KW_eof); |
|
|
557 | |
|
|
558 | unsigned char *p = (unsigned char *)line; |
|
|
559 | |
|
|
560 | while (*p > ' ') |
|
|
561 | p++; |
|
|
562 | |
|
|
563 | int len = p - (unsigned char *)line; |
|
|
564 | |
|
|
565 | while ((*p - 1) < ' ') |
|
|
566 | p++; |
|
|
567 | |
|
|
568 | if (*p) |
|
|
569 | { |
|
|
570 | char *v = p; |
|
|
571 | |
|
|
572 | while (*p && *p != '\n') |
|
|
573 | p++; |
|
|
574 | |
|
|
575 | *p = 0; |
|
|
576 | |
|
|
577 | return token (k, v); |
|
|
578 | } |
|
|
579 | else |
|
|
580 | return token (k); |
|
|
581 | } |
|
|
582 | #endif |
|
|
583 | } |
|
|
584 | |
482 | ///////////////////////////////////////////////////////////////////////////// |
585 | ///////////////////////////////////////////////////////////////////////////// |
483 | |
586 | |
484 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
587 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
485 | { |
588 | { |
486 | gethook = gethooksptr; |
|
|
487 | |
|
|
488 | return 0; |
589 | return 0; |
489 | } |
590 | } |
490 | |
591 | |
491 | static CommArray_s rtn_cmd; |
592 | static CommArray_s rtn_cmd; |
492 | |
593 | |
… | |
… | |
572 | extern "C" int cfperl_postInitPlugin () |
673 | extern "C" int cfperl_postInitPlugin () |
573 | { |
674 | { |
574 | int hooktype = 1; |
675 | int hooktype = 1; |
575 | int rtype = 0; |
676 | int rtype = 0; |
576 | |
677 | |
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); |
678 | cf_init_plugin (gethook); |
583 | |
679 | |
584 | return 0; |
680 | return 0; |
585 | } |
681 | } |
586 | |
682 | |
… | |
… | |
590 | } |
686 | } |
591 | |
687 | |
592 | void |
688 | void |
593 | cfperl_init () |
689 | cfperl_init () |
594 | { |
690 | { |
|
|
691 | PERL_SYS_INIT3 (&settings.argc, &settings.argv, 0); |
|
|
692 | perl = perl_alloc (); |
|
|
693 | perl_construct (perl); |
|
|
694 | |
|
|
695 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
|
|
696 | |
595 | char *argv[] = { |
697 | char *argv[] = { |
596 | "", |
698 | "", |
597 | "-e" |
699 | "-e" |
598 | "BEGIN {" |
|
|
599 | " cf->bootstrap;" |
700 | "cf->bootstrap;" |
600 | " unshift @INC, cf::datadir ();" |
701 | "unshift @INC, cf::datadir ();" |
601 | "}" |
|
|
602 | "" |
|
|
603 | "use cf;" |
|
|
604 | }; |
702 | }; |
605 | |
|
|
606 | perl = perl_alloc (); |
|
|
607 | perl_construct (perl); |
|
|
608 | |
|
|
609 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
|
|
610 | |
703 | |
611 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
704 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
612 | { |
705 | { |
613 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
706 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
614 | |
|
|
615 | exit (EXIT_FAILURE); |
707 | exit (EXIT_FAILURE); |
616 | //perl_destruct (perl); |
|
|
617 | //perl_free (perl); |
|
|
618 | //perl = 0; |
|
|
619 | //return; |
|
|
620 | } |
708 | } |
621 | |
709 | |
622 | obj_cache = newHV (); |
710 | obj_cache = newHV (); |
|
|
711 | } |
|
|
712 | |
|
|
713 | void cfperl_boot () |
|
|
714 | { |
|
|
715 | perl_booted = true; |
|
|
716 | |
|
|
717 | eval_pv ("require cf", 1); |
623 | } |
718 | } |
624 | |
719 | |
625 | void cfperl_main () |
720 | void cfperl_main () |
626 | { |
721 | { |
627 | dSP; |
722 | dSP; |
… | |
… | |
699 | dt = (data_type) va_arg (ap, int); |
794 | dt = (data_type) va_arg (ap, int); |
700 | assert (("first argument must be of type object", dt == DT_OBJECT)); |
795 | assert (("first argument must be of type object", dt == DT_OBJECT)); |
701 | op = va_arg (ap, object *); |
796 | op = va_arg (ap, object *); |
702 | |
797 | |
703 | if (op->cb) |
798 | if (op->cb) |
704 | gather_callbacks (callbacks, (AV *)op->cb, event); |
799 | gather_callbacks (callbacks, op->cb, event); |
705 | |
800 | |
706 | if (op->type) |
801 | if (op->type) |
707 | { |
802 | { |
708 | if (op->subtype && op->type + op->subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) |
803 | if (op->subtype && op->type + op->subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) |
709 | { |
804 | { |
… | |
… | |
730 | dt = (data_type) va_arg (ap, int); |
825 | dt = (data_type) va_arg (ap, int); |
731 | assert (("first argument must be of type player", dt == DT_PLAYER)); |
826 | assert (("first argument must be of type player", dt == DT_PLAYER)); |
732 | pl = va_arg (ap, player *); |
827 | pl = va_arg (ap, player *); |
733 | |
828 | |
734 | if (pl->cb) |
829 | if (pl->cb) |
735 | gather_callbacks (callbacks, (AV *)pl->cb, event); |
830 | gather_callbacks (callbacks, pl->cb, event); |
736 | |
831 | |
737 | gather_callbacks (callbacks, cb_player, event); |
832 | gather_callbacks (callbacks, cb_player, event); |
738 | break; |
833 | break; |
739 | |
834 | |
740 | case KLASS_MAP: |
835 | case KLASS_MAP: |
741 | dt = (data_type) va_arg (ap, int); |
836 | dt = (data_type) va_arg (ap, int); |
742 | assert (("first argument must be of type object", dt == DT_MAP)); |
837 | assert (("first argument must be of type object", dt == DT_MAP)); |
743 | map = va_arg (ap, mapstruct *); |
838 | map = va_arg (ap, mapstruct *); |
744 | |
839 | |
745 | if (map->cb) |
840 | if (map->cb) |
746 | gather_callbacks (callbacks, (AV *)map->cb, event); |
841 | gather_callbacks (callbacks, map->cb, event); |
747 | |
842 | |
748 | gather_callbacks (callbacks, cb_map, event); |
843 | gather_callbacks (callbacks, cb_map, event); |
749 | break; |
844 | break; |
750 | |
845 | |
751 | default: |
846 | default: |
… | |
… | |
1371 | prop (CFAPI_INT, MAP_PROP_WINDDIR) |
1466 | prop (CFAPI_INT, MAP_PROP_WINDDIR) |
1372 | prop (CFAPI_INT, MAP_PROP_SKY) |
1467 | prop (CFAPI_INT, MAP_PROP_SKY) |
1373 | prop (CFAPI_INT, MAP_PROP_WPARTX) |
1468 | prop (CFAPI_INT, MAP_PROP_WPARTX) |
1374 | prop (CFAPI_INT, MAP_PROP_WPARTY) |
1469 | prop (CFAPI_INT, MAP_PROP_WPARTY) |
1375 | prop (CFAPI_STRING, MAP_PROP_MESSAGE) |
1470 | prop (CFAPI_STRING, MAP_PROP_MESSAGE) |
1376 | prop (CFAPI_PMAP, MAP_PROP_NEXT) |
|
|
1377 | prop (CFAPI_PREGION, MAP_PROP_REGION) |
1471 | 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) |
1472 | prop (CFAPI_POBJECT, OBJECT_PROP_NEXT_ACTIVE_OB) |
1381 | prop (CFAPI_POBJECT, OBJECT_PROP_PREV_ACTIVE_OB) |
1473 | prop (CFAPI_POBJECT, OBJECT_PROP_PREV_ACTIVE_OB) |
1382 | prop (CFAPI_POBJECT, OBJECT_PROP_INVENTORY) |
1474 | prop (CFAPI_POBJECT, OBJECT_PROP_INVENTORY) |
1383 | prop (CFAPI_POBJECT, OBJECT_PROP_ENVIRONMENT) |
1475 | prop (CFAPI_POBJECT, OBJECT_PROP_ENVIRONMENT) |
1384 | prop (CFAPI_POBJECT, OBJECT_PROP_HEAD) |
|
|
1385 | prop (CFAPI_POBJECT, OBJECT_PROP_CONTAINER) |
1476 | prop (CFAPI_POBJECT, OBJECT_PROP_CONTAINER) |
1386 | prop (CFAPI_PMAP, OBJECT_PROP_MAP) |
1477 | prop (CFAPI_PMAP, OBJECT_PROP_MAP) |
1387 | prop (CFAPI_INT, OBJECT_PROP_COUNT) |
1478 | prop (CFAPI_INT, OBJECT_PROP_COUNT) |
1388 | prop (CFAPI_INT, OBJECT_PROP_REFCOUNT) |
1479 | prop (CFAPI_INT, OBJECT_PROP_REFCOUNT) |
1389 | prop (CFAPI_STRING, OBJECT_PROP_NAME) |
1480 | prop (CFAPI_STRING, OBJECT_PROP_NAME) |
… | |
… | |
1521 | PROTOTYPE: $$ |
1612 | PROTOTYPE: $$ |
1522 | |
1613 | |
1523 | char *path_combine_and_normalize (char *base, char *path) |
1614 | char *path_combine_and_normalize (char *base, char *path) |
1524 | PROTOTYPE: $$ |
1615 | PROTOTYPE: $$ |
1525 | |
1616 | |
1526 | char * |
1617 | const char * |
1527 | cf_get_maps_directory (char *path) |
1618 | get_maps_directory (char *path) |
1528 | PROTOTYPE: $ |
1619 | PROTOTYPE: $ |
1529 | ALIAS: maps_directory = 0 |
1620 | ALIAS: maps_directory = 0 |
|
|
1621 | CODE: |
|
|
1622 | RETVAL = create_pathname (path); |
|
|
1623 | OUTPUT: RETVAL |
1530 | |
1624 | |
1531 | void |
1625 | void |
1532 | sub_generation_inc () |
1626 | sub_generation_inc () |
1533 | CODE: |
1627 | CODE: |
1534 | PL_sub_generation++; |
1628 | PL_sub_generation++; |
… | |
… | |
1543 | confdir = 3 |
1637 | confdir = 3 |
1544 | localdir = 4 |
1638 | localdir = 4 |
1545 | playerdir = 5 |
1639 | playerdir = 5 |
1546 | datadir = 6 |
1640 | datadir = 6 |
1547 | CODE: |
1641 | CODE: |
1548 | { |
1642 | switch (ix) |
1549 | int unused_type; |
1643 | { |
1550 | RETVAL = (char *)systemDirectory (&unused_type, ix); |
1644 | case 0: RETVAL = settings.mapdir ; break; |
1551 | } |
1645 | case 1: RETVAL = settings.uniquedir; break; |
|
|
1646 | case 2: RETVAL = settings.tmpdir ; break; |
|
|
1647 | case 3: RETVAL = settings.confdir ; break; |
|
|
1648 | case 4: RETVAL = settings.localdir ; break; |
|
|
1649 | case 5: RETVAL = settings.playerdir; break; |
|
|
1650 | case 6: RETVAL = settings.datadir ; break; |
|
|
1651 | } |
1552 | OUTPUT: RETVAL |
1652 | OUTPUT: RETVAL |
1553 | |
1653 | |
1554 | int |
1654 | int |
1555 | cf_find_animation (char *text) |
1655 | cf_find_animation (char *text) |
1556 | PROTOTYPE: $ |
1656 | PROTOTYPE: $ |
… | |
… | |
1560 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1660 | const char *cost_string_from_value(uint64 cost, int approx = 0) |
1561 | |
1661 | |
1562 | int invoke (int event, ...) |
1662 | int invoke (int event, ...) |
1563 | CODE: |
1663 | CODE: |
1564 | if (KLASS_OF (event) != KLASS_GLOBAL) croak ("event class must be GLOBAL"); |
1664 | 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)); |
1665 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1666 | for (int i = 1; i < items; i++) av_push (av, SvREFCNT_inc (ST (i))); |
1566 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
1667 | RETVAL = INVOKE_((event_type)event, ARG_AV (av)); |
1567 | OUTPUT: RETVAL |
1668 | OUTPUT: RETVAL |
1568 | |
1669 | |
1569 | int |
1670 | int |
1570 | exp_to_level (val64 exp) |
1671 | exp_to_level (val64 exp) |
… | |
… | |
1603 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1704 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1604 | else |
1705 | else |
1605 | XSRETURN_UNDEF; |
1706 | XSRETURN_UNDEF; |
1606 | OUTPUT: RETVAL |
1707 | OUTPUT: RETVAL |
1607 | |
1708 | |
|
|
1709 | int |
|
|
1710 | _valid (SV *obj) |
|
|
1711 | CODE: |
|
|
1712 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
|
|
1713 | OUTPUT: |
|
|
1714 | RETVAL |
|
|
1715 | |
1608 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1716 | MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ |
1609 | |
1717 | |
1610 | int invoke (object *op, int event, ...) |
1718 | int invoke (object *op, int event, ...) |
1611 | CODE: |
1719 | CODE: |
1612 | if (KLASS_OF (event) != KLASS_OBJECT) croak ("event class must be OBJECT"); |
1720 | 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)); |
1721 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
1722 | 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)); |
1723 | RETVAL = INVOKE_((event_type)event, ARG_OBJECT (op), ARG_AV (av)); |
1615 | OUTPUT: RETVAL |
1724 | OUTPUT: RETVAL |
1616 | |
1725 | |
1617 | SV *registry (object *op) |
1726 | SV *registry (object *op) |
1618 | CODE: |
1727 | CODE: |
1619 | RETVAL = registry_of (op); |
1728 | RETVAL = registry_of (op); |
1620 | OUTPUT: |
1729 | OUTPUT: |
|
|
1730 | RETVAL |
|
|
1731 | |
|
|
1732 | object *head (object *op) |
|
|
1733 | PROTOTYPE: $ |
|
|
1734 | ALIAS: |
|
|
1735 | more = 1 |
|
|
1736 | above = 2 |
|
|
1737 | below = 3 |
|
|
1738 | CODE: |
|
|
1739 | switch (ix) |
|
|
1740 | { |
|
|
1741 | case 0: RETVAL = op->head ? op->head : op; break; // DOH! |
|
|
1742 | case 1: RETVAL = op->more; break; |
|
|
1743 | case 2: RETVAL = op->above; break; |
|
|
1744 | case 3: RETVAL = op->below; break; |
|
|
1745 | } |
|
|
1746 | OUTPUT: |
1621 | RETVAL |
1747 | RETVAL |
1622 | |
1748 | |
1623 | SV * |
1749 | SV * |
1624 | get_property (object *obj, int type, int idx) |
1750 | get_property (object *obj, int type, int idx) |
1625 | CODE: |
1751 | CODE: |
… | |
… | |
1705 | |
1831 | |
1706 | int need_identify (const object *obj); |
1832 | int need_identify (const object *obj); |
1707 | |
1833 | |
1708 | int apply_shop_mat (object *shop_mat, object *op); |
1834 | int apply_shop_mat (object *shop_mat, object *op); |
1709 | |
1835 | |
1710 | void cf_object_move (object *op, int dir, object *originator = op) |
1836 | int move (object *op, int dir, object *originator = op) |
|
|
1837 | CODE: |
|
|
1838 | RETVAL = move_ob (op, dir, originator); |
|
|
1839 | OUTPUT: |
|
|
1840 | RETVAL |
1711 | |
1841 | |
1712 | void cf_object_apply (object *op, object *author, int flags = 0) |
1842 | void cf_object_apply (object *op, object *author, int flags = 0) |
1713 | |
1843 | |
1714 | void cf_object_apply_below (object *op) |
1844 | void cf_object_apply_below (object *op) |
1715 | |
1845 | |
… | |
… | |
1756 | int cf_object_out_of_map (object *op, int x, int y) |
1886 | int cf_object_out_of_map (object *op, int x, int y) |
1757 | |
1887 | |
1758 | void cf_object_drop (object *op, object *author) |
1888 | void cf_object_drop (object *op, object *author) |
1759 | |
1889 | |
1760 | void cf_object_take (object *op, object *author) |
1890 | 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 | |
1891 | |
1766 | object *cf_object_insert_object (object *op, object *container) |
1892 | object *cf_object_insert_object (object *op, object *container) |
1767 | |
1893 | |
1768 | const char *cf_object_get_msg (object *ob) |
1894 | const char *cf_object_get_msg (object *ob) |
1769 | ALIAS: msg = 0 |
1895 | ALIAS: msg = 0 |
… | |
… | |
1908 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2034 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
1909 | |
2035 | |
1910 | int invoke (player *pl, int event, ...) |
2036 | int invoke (player *pl, int event, ...) |
1911 | CODE: |
2037 | CODE: |
1912 | if (KLASS_OF (event) != KLASS_PLAYER) croak ("event class must be PLAYER"); |
2038 | 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)); |
2039 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
2040 | 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)); |
2041 | RETVAL = INVOKE_((event_type)event, ARG_PLAYER (pl), ARG_AV (av)); |
1915 | OUTPUT: RETVAL |
2042 | OUTPUT: RETVAL |
1916 | |
2043 | |
1917 | SV *registry (player *pl) |
2044 | SV *registry (player *pl) |
1918 | CODE: |
2045 | CODE: |
… | |
… | |
2045 | OUTPUT: RETVAL |
2172 | OUTPUT: RETVAL |
2046 | |
2173 | |
2047 | |
2174 | |
2048 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2175 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2049 | |
2176 | |
|
|
2177 | mapstruct *first () |
|
|
2178 | PROTOTYPE: |
|
|
2179 | CODE: |
|
|
2180 | RETVAL = first_map; |
|
|
2181 | OUTPUT: RETVAL |
|
|
2182 | |
|
|
2183 | mapstruct *next (mapstruct *map) |
|
|
2184 | PROTOTYPE: |
|
|
2185 | CODE: |
|
|
2186 | RETVAL = map->next; |
|
|
2187 | OUTPUT: RETVAL |
|
|
2188 | |
2050 | int invoke (mapstruct *map, int event, ...) |
2189 | int invoke (mapstruct *map, int event, ...) |
2051 | CODE: |
2190 | CODE: |
2052 | if (KLASS_OF (event) != KLASS_MAP) croak ("event class must be MAP"); |
2191 | 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)); |
2192 | AV *av = (AV *)sv_2mortal ((SV *)newAV ()); |
|
|
2193 | 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)); |
2194 | RETVAL = INVOKE_((event_type)event, ARG_MAP (map), ARG_AV (av)); |
2055 | OUTPUT: |
2195 | OUTPUT: RETVAL |
2056 | RETVAL |
|
|
2057 | |
2196 | |
2058 | SV *registry (mapstruct *map) |
2197 | SV *registry (mapstruct *map) |
2059 | CODE: |
2198 | CODE: |
2060 | RETVAL = registry_of (map); |
2199 | RETVAL = registry_of (map); |
2061 | OUTPUT: |
2200 | OUTPUT: |
… | |
… | |
2081 | |
2220 | |
2082 | mapstruct *new (int width, int height) |
2221 | mapstruct *new (int width, int height) |
2083 | PROTOTYPE: |
2222 | PROTOTYPE: |
2084 | CODE: |
2223 | CODE: |
2085 | { |
2224 | { |
2086 | int unused_type; |
2225 | RETVAL = get_empty_map (width, height); |
2087 | RETVAL = (mapstruct*) map_get_map (&unused_type, 0, width, height); |
|
|
2088 | } |
2226 | } |
2089 | OUTPUT: |
2227 | OUTPUT: |
2090 | RETVAL |
2228 | RETVAL |
2091 | |
2229 | |
2092 | void delete_map (mapstruct *map) |
2230 | void delete_map (mapstruct *map) |
… | |
… | |
2107 | XSRETURN_UNDEF; |
2245 | XSRETURN_UNDEF; |
2108 | RETVAL = map->tile_path [dir]; |
2246 | RETVAL = map->tile_path [dir]; |
2109 | OUTPUT: |
2247 | OUTPUT: |
2110 | RETVAL |
2248 | RETVAL |
2111 | |
2249 | |
2112 | mapstruct *cf_map_get_map (char *name) |
2250 | mapstruct *ready_map_name (char *name, int flags = 0) |
2113 | PROTOTYPE: $ |
2251 | PROTOTYPE: $;$ |
2114 | ALIAS: map = 0 |
2252 | ALIAS: |
|
|
2253 | find = 0 |
|
|
2254 | get_map = 1 |
2115 | |
2255 | |
2116 | mapstruct *has_been_loaded (char *name) |
2256 | mapstruct *has_been_loaded (char *name) |
2117 | PROTOTYPE: $ |
2257 | PROTOTYPE: $ |
2118 | |
|
|
2119 | mapstruct *cf_map_get_first () |
|
|
2120 | PROTOTYPE: |
|
|
2121 | ALIAS: first = 0 |
|
|
2122 | |
2258 | |
2123 | # whoever "designed" the plug-in api should have wasted |
2259 | # whoever "designed" the plug-in api should have wasted |
2124 | # his/her time with staying away from the project - would have |
2260 | # his/her time with staying away from the project - would have |
2125 | # saved others a lot of time, without doubt. |
2261 | # saved others a lot of time, without doubt. |
2126 | void set_path (mapstruct *where, char *path) |
2262 | void set_path (mapstruct *where, char *path) |
… | |
… | |
2141 | |
2277 | |
2142 | void set_unique (mapstruct *map, bool unique) |
2278 | void set_unique (mapstruct *map, bool unique) |
2143 | CODE: |
2279 | CODE: |
2144 | map->unique = unique; |
2280 | map->unique = unique; |
2145 | |
2281 | |
|
|
2282 | void |
|
|
2283 | trigger (mapstruct *map, long connection, bool state = true) |
|
|
2284 | CODE: |
|
|
2285 | activate_connection (map, connection, state); |
|
|
2286 | |
|
|
2287 | void |
|
|
2288 | get_connection (mapstruct *map, long connection) |
|
|
2289 | PPCODE: |
|
|
2290 | oblinkpt *obp = get_connection_links (map, connection); |
|
|
2291 | if (obp) |
|
|
2292 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
|
|
2293 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, ol->ob))); |
|
|
2294 | |
2146 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
2295 | object *cf_map_insert_object_there (mapstruct *where, object *op, object *originator, int flags) |
2147 | |
2296 | |
2148 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
2297 | object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) |
2149 | |
2298 | |
2150 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
2299 | 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) |
2303 | cf_map_normalise (mapstruct *map, int x, int y) |
2155 | PPCODE: |
2304 | PPCODE: |
2156 | { |
2305 | { |
2157 | mapstruct *nmap = 0; |
2306 | mapstruct *nmap = 0; |
2158 | I16 nx = 0, ny = 0; |
2307 | I16 nx = 0, ny = 0; |
2159 | int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2308 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
2160 | |
2309 | |
2161 | EXTEND (SP, 4); |
2310 | EXTEND (SP, 4); |
2162 | PUSHs (sv_2mortal (newSViv (flags))); |
2311 | PUSHs (sv_2mortal (newSViv (flags))); |
2163 | |
2312 | |
2164 | if (GIMME_V == G_ARRAY) |
2313 | if (GIMME_V == G_ARRAY) |
… | |
… | |
2176 | { |
2325 | { |
2177 | object *o; |
2326 | object *o; |
2178 | mapstruct *nmap = 0; |
2327 | mapstruct *nmap = 0; |
2179 | I16 nx, ny; |
2328 | I16 nx, ny; |
2180 | |
2329 | |
2181 | cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2330 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
2182 | |
2331 | |
2183 | if (nmap) |
2332 | if (nmap) |
2184 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2333 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2185 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2334 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2186 | } |
2335 | } |
… | |
… | |
2211 | case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
2360 | case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
2212 | } |
2361 | } |
2213 | OUTPUT: |
2362 | OUTPUT: |
2214 | RETVAL |
2363 | RETVAL |
2215 | |
2364 | |
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 | |
2365 | |
2226 | for (y = 0; y < MAP_HEIGHT (map); y++) |
2366 | 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 | |
2367 | |
2231 | if (!SvROK (sv)) |
2368 | archetype *find (const char *name) |
2232 | continue; |
2369 | CODE: |
|
|
2370 | RETVAL = find_archetype (name); |
|
|
2371 | OUTPUT: |
|
|
2372 | RETVAL |
2233 | |
2373 | |
2234 | av = (AV *)SvRV (sv); |
2374 | archetype *first() |
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: |
2375 | PROTOTYPE: |
2254 | ALIAS: first = 0 |
2376 | CODE: |
|
|
2377 | RETVAL = first_archetype; |
|
|
2378 | OUTPUT: RETVAL |
2255 | |
2379 | |
2256 | archetype *cf_archetype_get_next (archetype *arch) |
2380 | archetype *next (archetype *arch) |
2257 | ALIAS: next = 0 |
2381 | CODE: |
|
|
2382 | RETVAL = arch->next; |
|
|
2383 | OUTPUT: RETVAL |
2258 | |
2384 | |
2259 | archetype *cf_archetype_get_head (archetype *arch) |
2385 | archetype *head (archetype *arch) |
2260 | ALIAS: head = 0 |
2386 | CODE: |
|
|
2387 | RETVAL = arch->head; |
|
|
2388 | OUTPUT: RETVAL |
2261 | |
2389 | |
2262 | archetype *cf_archetype_get_more (archetype *arch) |
2390 | archetype *more (archetype *arch) |
2263 | ALIAS: more = 0 |
2391 | CODE: |
|
|
2392 | RETVAL = arch->more; |
|
|
2393 | OUTPUT: RETVAL |
2264 | |
2394 | |
2265 | const char *cf_archetype_get_name (archetype *arch) |
2395 | const char *name (archetype *arch) |
2266 | ALIAS: name = 0 |
2396 | CODE: |
|
|
2397 | RETVAL = arch->name; |
|
|
2398 | OUTPUT: RETVAL |
2267 | |
2399 | |
2268 | object *cf_archetype_get_clone (archetype *arch) |
2400 | object *clone (archetype *arch) |
2269 | ALIAS: clone = 0 |
2401 | CODE: |
|
|
2402 | RETVAL = &arch->clone; |
|
|
2403 | OUTPUT: RETVAL |
2270 | |
2404 | |
2271 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
2405 | MODULE = cf PACKAGE = cf::party |
2272 | |
2406 | |
2273 | partylist *cf_party_get_first () |
2407 | partylist *first () |
2274 | PROTOTYPE: |
2408 | PROTOTYPE: |
2275 | ALIAS: first = 0 |
2409 | CODE: |
|
|
2410 | RETVAL = get_firstparty (); |
|
|
2411 | OUTPUT: RETVAL |
2276 | |
2412 | |
2277 | partylist *cf_party_get_next (partylist *party) |
2413 | partylist *next (partylist *party) |
2278 | ALIAS: next = 0 |
2414 | CODE: |
|
|
2415 | RETVAL = party->next; |
|
|
2416 | OUTPUT: RETVAL |
2279 | |
2417 | |
2280 | const char *cf_party_get_name (partylist *party) |
2418 | const char *name (partylist *party) |
|
|
2419 | CODE: |
|
|
2420 | RETVAL = party->partyname; |
|
|
2421 | OUTPUT: RETVAL |
2281 | |
2422 | |
2282 | const char *cf_party_get_password (partylist *party) |
2423 | const char *password (partylist *party) |
2283 | ALIAS: password = 0 |
2424 | CODE: |
|
|
2425 | RETVAL = party->passwd; |
|
|
2426 | OUTPUT: RETVAL |
2284 | |
2427 | |
2285 | player *cf_party_get_first_player (partylist *party) |
2428 | MODULE = cf PACKAGE = cf::region |
2286 | ALIAS: first_player = 0 |
|
|
2287 | |
2429 | |
2288 | player *cf_party_get_next_player (partylist *party, player *op) |
2430 | 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: |
2431 | PROTOTYPE: |
2296 | ALIAS: first = 0 |
2432 | CODE: |
|
|
2433 | RETVAL = first_region; |
|
|
2434 | OUTPUT: RETVAL |
2297 | |
2435 | |
|
|
2436 | region *next (region *reg) |
|
|
2437 | CODE: |
|
|
2438 | RETVAL = reg->next; |
|
|
2439 | OUTPUT: RETVAL |
|
|
2440 | |
|
|
2441 | const char *name (region *reg) |
|
|
2442 | CODE: |
|
|
2443 | RETVAL = reg->name; |
|
|
2444 | OUTPUT: RETVAL |
|
|
2445 | |
|
|
2446 | region *parent (region *reg) |
|
|
2447 | CODE: |
|
|
2448 | RETVAL = reg->parent; |
|
|
2449 | OUTPUT: RETVAL |
|
|
2450 | |
2298 | const char *cf_region_get_name (region *reg) |
2451 | const char *longname (region *reg) |
2299 | ALIAS: name = 0 |
2452 | CODE: |
|
|
2453 | RETVAL = reg->longname; |
|
|
2454 | OUTPUT: RETVAL |
2300 | |
2455 | |
2301 | region *cf_region_get_next (region *reg) |
2456 | const char *msg (region *reg) |
2302 | ALIAS: next = 0 |
2457 | CODE: |
|
|
2458 | RETVAL = reg->msg; |
|
|
2459 | OUTPUT: RETVAL |
2303 | |
2460 | |
2304 | region *cf_region_get_parent (region *reg) |
2461 | 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 | |
2462 | |
2316 | val64 |
2463 | val64 |
2317 | exp (living *liv, val64 new_val = 0) |
2464 | exp (living *liv, val64 new_val = 0) |
2318 | PROTOTYPE: $;$ |
2465 | PROTOTYPE: $;$ |
2319 | ALIAS: |
2466 | ALIAS: |