… | |
… | |
349 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
349 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
350 | |
350 | |
351 | inline SV *to_sv (object & v) { return to_sv (&v); } |
351 | inline SV *to_sv (object & v) { return to_sv (&v); } |
352 | inline SV *to_sv (living & v) { return to_sv (&v); } |
352 | inline SV *to_sv (living & v) { return to_sv (&v); } |
353 | |
353 | |
354 | inline SV *to_sv (facetile * v) { return to_sv (v->name); } |
354 | //inline SV *to_sv (faceinfo * v) { return to_sv (v->name); } |
355 | inline SV *to_sv (treasurelist * v) { return to_sv (v->name); } |
355 | inline SV *to_sv (treasurelist * v) { return to_sv (v->name); } |
|
|
356 | inline SV *to_sv (std::string & v) { return newSVpvn (v.data (), v.size ()); } |
356 | |
357 | |
357 | inline SV *to_sv (UUID v) |
358 | inline SV *to_sv (UUID v) |
358 | { |
359 | { |
359 | char buf[128]; |
360 | char buf[128]; |
360 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
361 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
… | |
… | |
384 | inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
385 | inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
385 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
386 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
386 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
387 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
387 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
388 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
388 | |
389 | |
389 | inline void sv_to (SV *sv, facetile * &v) { v = &new_faces[FindFace (SvPV_nolen (sv), 0)]; } |
390 | //inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
390 | inline void sv_to (SV *sv, treasurelist * &v) { v = find_treasurelist (SvPV_nolen (sv)); } |
391 | inline void sv_to (SV *sv, treasurelist * &v) { v = find_treasurelist (SvPV_nolen (sv)); } |
391 | |
392 | |
392 | template<class T> |
393 | template<class T> |
393 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
394 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
394 | |
395 | |
… | |
… | |
398 | inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); } |
399 | inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); } |
399 | inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } |
400 | inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } |
400 | inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } |
401 | inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } |
401 | inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } |
402 | inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } |
402 | inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } |
403 | inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } |
|
|
404 | |
|
|
405 | inline void sv_to (SV *sv, std::string &v) |
|
|
406 | { |
|
|
407 | STRLEN len; |
|
|
408 | char *data = SvPVbyte (sv, len); |
|
|
409 | v.assign (data, len); |
|
|
410 | } |
403 | |
411 | |
404 | inline void sv_to (SV *sv, UUID &v) |
412 | inline void sv_to (SV *sv, UUID &v) |
405 | { |
413 | { |
406 | unsigned int version; |
414 | unsigned int version; |
407 | |
415 | |
… | |
… | |
598 | perl = perl_alloc (); |
606 | perl = perl_alloc (); |
599 | perl_construct (perl); |
607 | perl_construct (perl); |
600 | |
608 | |
601 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
609 | PL_exit_flags |= PERL_EXIT_DESTRUCT_END; |
602 | |
610 | |
603 | char *argv[] = { |
611 | const char *argv[] = { |
604 | "", |
612 | "", |
605 | "-e" |
613 | "-e" |
606 | "use Event; use Coro;" // required for bootstrap |
614 | "use Event; use Coro;" // required for bootstrap |
607 | "cf->bootstrap;" // required for datadir :*> |
615 | "cf->bootstrap;" // required for datadir :*> |
608 | "unshift @INC, cf::datadir ();" |
616 | "unshift @INC, cf::datadir ();" |
609 | "require cf;" |
617 | "require cf;" |
610 | }; |
618 | }; |
611 | |
619 | |
612 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
620 | if (perl_parse (perl, xs_init, 2, (char **)argv, (char **)NULL) |
|
|
621 | || perl_run (perl)) |
613 | { |
622 | { |
614 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
623 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
615 | exit (EXIT_FAILURE); |
624 | exit (EXIT_FAILURE); |
616 | } |
625 | } |
617 | |
626 | |
… | |
… | |
1042 | # define const_iv(name) { # name, (IV)name }, |
1051 | # define const_iv(name) { # name, (IV)name }, |
1043 | const_iv (llevError) |
1052 | const_iv (llevError) |
1044 | const_iv (llevInfo) |
1053 | const_iv (llevInfo) |
1045 | const_iv (llevDebug) |
1054 | const_iv (llevDebug) |
1046 | const_iv (llevMonster) |
1055 | const_iv (llevMonster) |
|
|
1056 | |
|
|
1057 | const_iv (Map0Cmd) |
|
|
1058 | const_iv (Map1Cmd) |
|
|
1059 | const_iv (Map1aCmd) |
|
|
1060 | |
|
|
1061 | const_iv (MAP_CLIENT_X) |
|
|
1062 | const_iv (MAP_CLIENT_Y) |
1047 | |
1063 | |
1048 | const_iv (MAX_TIME) |
1064 | const_iv (MAX_TIME) |
1049 | const_iv (PLAYER) |
1065 | const_iv (PLAYER) |
1050 | const_iv (TRANSPORT) |
1066 | const_iv (TRANSPORT) |
1051 | const_iv (ROD) |
1067 | const_iv (ROD) |
… | |
… | |
1635 | void |
1651 | void |
1636 | sub_generation_inc () |
1652 | sub_generation_inc () |
1637 | CODE: |
1653 | CODE: |
1638 | PL_sub_generation++; |
1654 | PL_sub_generation++; |
1639 | |
1655 | |
1640 | char * |
1656 | const char * |
1641 | mapdir () |
1657 | mapdir () |
1642 | PROTOTYPE: |
1658 | PROTOTYPE: |
1643 | ALIAS: |
1659 | ALIAS: |
1644 | mapdir = 0 |
1660 | mapdir = 0 |
1645 | uniquedir = 1 |
1661 | uniquedir = 1 |
… | |
… | |
2061 | void clear_los (object *op) |
2077 | void clear_los (object *op) |
2062 | |
2078 | |
2063 | int command_summon (object *op, char *params) |
2079 | int command_summon (object *op, char *params) |
2064 | |
2080 | |
2065 | int command_arrest (object *op, char *params) |
2081 | int command_arrest (object *op, char *params) |
2066 | |
|
|
2067 | int command_banish (object *op, char *params) |
|
|
2068 | |
2082 | |
2069 | |
2083 | |
2070 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2084 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2071 | |
2085 | |
2072 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
2086 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
… | |
… | |
2508 | char *buf = SvPVbyte (packet, len); |
2522 | char *buf = SvPVbyte (packet, len); |
2509 | |
2523 | |
2510 | THIS->send_packet (buf, len); |
2524 | THIS->send_packet (buf, len); |
2511 | } |
2525 | } |
2512 | |
2526 | |
|
|
2527 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
|
|
2528 | |
|
|
2529 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
|
|
2530 | |
|
|
2531 | faceidx face_find (const char *name, faceidx defidx = 0) |
|
|
2532 | |
|
|
2533 | faceidx alloc (const char *name) |
|
|
2534 | CODE: |
|
|
2535 | { |
|
|
2536 | do |
|
|
2537 | { |
|
|
2538 | RETVAL = faces.size (); |
|
|
2539 | faces.resize (RETVAL + 1); |
|
|
2540 | } |
|
|
2541 | while (!RETVAL); // crude way to leave index 0 |
|
|
2542 | |
|
|
2543 | faces [RETVAL].name = name; |
|
|
2544 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
|
|
2545 | |
|
|
2546 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
|
|
2547 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
|
|
2548 | } |
|
|
2549 | OUTPUT: RETVAL |
|
|
2550 | |
|
|
2551 | void set (faceidx idx, int visibility, int magicmap) |
|
|
2552 | CODE: |
|
|
2553 | faceinfo *f = face_info (idx); |
|
|
2554 | assert (f); |
|
|
2555 | f->visibility = visibility; |
|
|
2556 | f->magicmap = magicmap; |
|
|
2557 | |
|
|
2558 | void set_smooth (faceidx idx, faceidx smooth) |
|
|
2559 | CODE: |
|
|
2560 | faceinfo *f = face_info (idx); |
|
|
2561 | assert (f); |
|
|
2562 | f->smooth = smooth; |
|
|
2563 | |
|
|
2564 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
|
|
2565 | CODE: |
|
|
2566 | facedata *d = face_data (idx, faceset); |
|
|
2567 | assert (d); |
|
|
2568 | sv_to (data, d->data); |
|
|
2569 | STRLEN clen; |
|
|
2570 | char *cdata = SvPVbyte (chksum, clen); |
|
|
2571 | memcpy (d->chksum, cdata, min (CHKSUM_SIZE, clen)); |
|
|
2572 | |
|
|
2573 | void invalidate (faceidx idx) |
|
|
2574 | CODE: |
|
|
2575 | for_all_clients (ns) |
|
|
2576 | ns->faces_sent [idx] = false; |
|
|
2577 | |
|
|
2578 | void invalidate_all () |
|
|
2579 | CODE: |
|
|
2580 | for_all_clients (ns) |
|
|
2581 | ns->faces_sent.reset (); |
|
|
2582 | |