… | |
… | |
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 | |
… | |
… | |
1586 | { |
1594 | { |
1587 | // reattach to all attachable objects in the game. |
1595 | // reattach to all attachable objects in the game. |
1588 | for_all_clients (ns) |
1596 | for_all_clients (ns) |
1589 | ns->reattach (); |
1597 | ns->reattach (); |
1590 | |
1598 | |
1591 | for_all_players (pl) |
|
|
1592 | pl->reattach (); |
|
|
1593 | |
|
|
1594 | //TODO |
|
|
1595 | //for (map_container::iterator i = maps.begin (); i != maps.end (); ++i) |
|
|
1596 | // i->second->reattach (); |
|
|
1597 | |
|
|
1598 | for_all_objects (op) |
1599 | for_all_objects (op) |
1599 | op->reattach (); |
1600 | op->reattach (); |
1600 | } |
1601 | } |
1601 | |
1602 | |
1602 | NV floor (NV x) |
1603 | NV floor (NV x) |
… | |
… | |
2068 | void clear_los (object *op) |
2069 | void clear_los (object *op) |
2069 | |
2070 | |
2070 | int command_summon (object *op, char *params) |
2071 | int command_summon (object *op, char *params) |
2071 | |
2072 | |
2072 | int command_arrest (object *op, char *params) |
2073 | int command_arrest (object *op, char *params) |
2073 | |
|
|
2074 | int command_banish (object *op, char *params) |
|
|
2075 | |
2074 | |
2076 | |
2075 | |
2077 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2076 | MODULE = cf PACKAGE = cf::player PREFIX = cf_player_ |
2078 | |
2077 | |
2079 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
2078 | INCLUDE: $PERL $srcdir/genacc player ../include/player.h | |
… | |
… | |
2515 | char *buf = SvPVbyte (packet, len); |
2514 | char *buf = SvPVbyte (packet, len); |
2516 | |
2515 | |
2517 | THIS->send_packet (buf, len); |
2516 | THIS->send_packet (buf, len); |
2518 | } |
2517 | } |
2519 | |
2518 | |
|
|
2519 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
|
|
2520 | |
|
|
2521 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
|
|
2522 | |
|
|
2523 | faceidx face_find (const char *name, faceidx defidx = 0) |
|
|
2524 | |
|
|
2525 | faceidx alloc (const char *name) |
|
|
2526 | CODE: |
|
|
2527 | { |
|
|
2528 | do |
|
|
2529 | { |
|
|
2530 | RETVAL = faces.size (); |
|
|
2531 | faces.resize (RETVAL + 1); |
|
|
2532 | } |
|
|
2533 | while (!RETVAL); // crude way to leave index 0 |
|
|
2534 | |
|
|
2535 | faces [RETVAL].name = name; |
|
|
2536 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
|
|
2537 | |
|
|
2538 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
|
|
2539 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
|
|
2540 | } |
|
|
2541 | OUTPUT: RETVAL |
|
|
2542 | |
|
|
2543 | void set (faceidx idx, int visibility, int magicmap) |
|
|
2544 | CODE: |
|
|
2545 | faceinfo *f = face_info (idx); |
|
|
2546 | assert (f); |
|
|
2547 | f->visibility = visibility; |
|
|
2548 | f->magicmap = magicmap; |
|
|
2549 | |
|
|
2550 | void set_smooth (faceidx idx, faceidx smooth) |
|
|
2551 | CODE: |
|
|
2552 | faceinfo *f = face_info (idx); |
|
|
2553 | assert (f); |
|
|
2554 | f->smooth = smooth; |
|
|
2555 | |
|
|
2556 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
|
|
2557 | CODE: |
|
|
2558 | facedata *d = face_data (idx, faceset); |
|
|
2559 | assert (d); |
|
|
2560 | assert (sv_len (chksum) == CHKSUM_SIZE); |
|
|
2561 | sv_to (data, d->data); memcpy (d->chksum, SvPVbyte_nolen (chksum), CHKSUM_SIZE); |
|
|
2562 | |
|
|
2563 | void invalidate (faceidx idx) |
|
|
2564 | CODE: |
|
|
2565 | for_all_clients (ns) |
|
|
2566 | ns->faces_sent [idx] = false; |
|
|
2567 | |
|
|
2568 | void invalidate_all () |
|
|
2569 | CODE: |
|
|
2570 | for_all_clients (ns) |
|
|
2571 | ns->faces_sent.reset (); |
|
|
2572 | |