… | |
… | |
28 | |
28 | |
29 | #include <cstdarg> |
29 | #include <cstdarg> |
30 | #include <typeinfo> |
30 | #include <typeinfo> |
31 | |
31 | |
32 | #include "global.h" |
32 | #include "global.h" |
33 | #include "../random_maps/random_map.h" |
33 | #include "rmg.h" |
|
|
34 | #include "noise.h" |
34 | #include "evthread.h" |
35 | #include "evthread.h" |
35 | #include "sproto.h" |
36 | #include "sproto.h" |
36 | |
37 | |
37 | #include <unistd.h> |
38 | #include <unistd.h> |
38 | #if _POSIX_MEMLOCK |
39 | #if _POSIX_MEMLOCK |
… | |
… | |
83 | *stash_cf_mapspace_wrap, |
84 | *stash_cf_mapspace_wrap, |
84 | *stash_cf_client_wrap, |
85 | *stash_cf_client_wrap, |
85 | *stash_cf_arch_wrap, |
86 | *stash_cf_arch_wrap, |
86 | *stash_cf_party_wrap, |
87 | *stash_cf_party_wrap, |
87 | *stash_cf_region_wrap, |
88 | *stash_cf_region_wrap, |
88 | *stash_cf_living_wrap; |
89 | *stash_cf_living_wrap, |
|
|
90 | *stash_cf_layout_wrap, |
|
|
91 | *stash_ext_map_world; |
89 | |
92 | |
90 | static SV |
93 | static SV |
91 | *cv_cf_do_invoke, |
94 | *cv_cf_do_invoke, |
92 | *cv_cf__can_merge, |
95 | *cv_cf__can_merge, |
93 | *cv_cf_client_send_msg, |
96 | *cv_cf_client_send_msg, |
… | |
… | |
121 | |
124 | |
122 | return sv; |
125 | return sv; |
123 | } |
126 | } |
124 | #endif |
127 | #endif |
125 | |
128 | |
126 | static noinline utf8_string |
129 | noinline utf8_string |
127 | cfSvPVutf8_nolen (SV *sv) |
130 | cfSvPVutf8_nolen (SV *sv) |
128 | { |
131 | { |
129 | SvGETMAGIC (sv); |
132 | SvGETMAGIC (sv); |
130 | |
133 | |
131 | if (SvPOK (sv)) |
134 | if (SvPOK (sv)) |
… | |
… | |
351 | #endif |
354 | #endif |
352 | |
355 | |
353 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
356 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
354 | |
357 | |
355 | static SV * |
358 | static SV * |
356 | newSVptr (void *ptr, HV *stash, HV *hv = newHV ()) |
359 | newSVptr (void *ptr, HV *stash, HV *hv) |
357 | { |
360 | { |
358 | SV *sv; |
|
|
359 | |
|
|
360 | if (!ptr) |
361 | if (!ptr) |
361 | return newSV (0); |
362 | return newSV (0); |
362 | |
363 | |
363 | sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0); |
364 | sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0); |
364 | return sv_bless (newRV_noinc ((SV *)hv), stash); |
365 | return sv_bless (newRV_noinc ((SV *)hv), stash); |
|
|
366 | } |
|
|
367 | |
|
|
368 | static SV * noinline |
|
|
369 | newSVptr (void *ptr, HV *stash) |
|
|
370 | { |
|
|
371 | return newSVptr (ptr, stash, newHV ()); |
365 | } |
372 | } |
366 | |
373 | |
367 | static int |
374 | static int |
368 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
375 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
369 | { |
376 | { |
… | |
… | |
381 | return 0; |
388 | return 0; |
382 | } |
389 | } |
383 | |
390 | |
384 | MGVTBL attachable::vtbl = {0, 0, 0, 0, attachable_free}; |
391 | MGVTBL attachable::vtbl = {0, 0, 0, 0, attachable_free}; |
385 | |
392 | |
386 | static SV * |
393 | static SV * noinline |
387 | newSVattachable (attachable *obj, HV *stash) |
394 | newSVattachable (attachable *obj, HV *stash) |
388 | { |
395 | { |
389 | if (!obj) |
396 | if (!obj) |
390 | return newSV (0); |
397 | return newSV (0); |
391 | |
398 | |
… | |
… | |
488 | { |
495 | { |
489 | if (expect_false (!SvOK (sv))) return 0; |
496 | if (expect_false (!SvOK (sv))) return 0; |
490 | |
497 | |
491 | if (!SvROK (sv) |
498 | if (!SvROK (sv) |
492 | || (SvSTASH (SvRV (sv)) != stash_cf_map_wrap |
499 | || (SvSTASH (SvRV (sv)) != stash_cf_map_wrap |
|
|
500 | && SvSTASH (SvRV (sv)) != stash_ext_map_world |
493 | && !sv_derived_from (sv, "cf::map"))) |
501 | && !sv_derived_from (sv, "cf::map"))) |
494 | croak ("object of type cf::map expected"); |
502 | croak ("object of type cf::map expected"); |
495 | |
503 | |
496 | return SvPTR_nc (sv); |
504 | return SvPTR_nc (sv); |
497 | } |
505 | } |
… | |
… | |
524 | static inline SV *to_sv (unsigned long long v) { return newSVval64 (v); } |
532 | static inline SV *to_sv (unsigned long long v) { return newSVval64 (v); } |
525 | static inline SV *to_sv (float v) { return newSVnv (v); } |
533 | static inline SV *to_sv (float v) { return newSVnv (v); } |
526 | static inline SV *to_sv (double v) { return newSVnv (v); } |
534 | static inline SV *to_sv (double v) { return newSVnv (v); } |
527 | static inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); } |
535 | static inline SV *to_sv (client * v) { return newSVattachable (v, stash_cf_client_wrap); } |
528 | static inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); } |
536 | static inline SV *to_sv (player * v) { return newSVattachable (v, stash_cf_player_wrap); } |
|
|
537 | // gcc dislikes noilnine on to_sv |
529 | static inline SV *to_sv (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); } |
538 | static noinline SV *to_sv_ni (object * v) { return newSVattachable (v, v && v->type == PLAYER ? stash_cf_object_player_wrap : stash_cf_object_wrap); } |
|
|
539 | static inline SV *to_sv (object * v) { return to_sv_ni (v); } |
530 | static inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } |
540 | static inline SV *to_sv (maptile * v) { return newSVattachable (v, stash_cf_map_wrap); } |
531 | static inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } |
541 | static inline SV *to_sv (archetype * v) { return newSVattachable (v, stash_cf_arch_wrap); } |
532 | static inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); } |
542 | static inline SV *to_sv (region * v) { return newSVattachable (v, stash_cf_region_wrap); } |
533 | static inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } |
543 | static inline SV *to_sv (partylist * v) { return newSVptr (v, stash_cf_party_wrap); } |
534 | static inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
544 | static inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
535 | static inline SV *to_sv (mapspace * v) { return newSVptr (v, stash_cf_mapspace_wrap); } |
545 | static inline SV *to_sv (mapspace * v) { return newSVptr (v, stash_cf_mapspace_wrap); } |
|
|
546 | static inline SV *to_sv (layout * v) { return newSVptr (v, stash_cf_layout_wrap); } |
536 | |
547 | |
537 | static inline SV *to_sv (object & v) { return to_sv (&v); } |
548 | static inline SV *to_sv (object & v) { return to_sv (&v); } |
538 | static inline SV *to_sv (living & v) { return to_sv (&v); } |
549 | static inline SV *to_sv (living & v) { return to_sv (&v); } |
539 | |
550 | |
540 | static inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } |
551 | static inline SV *to_sv (const std::string & v) { return newSVpvn (v.data (), v.size ()); } |
… | |
… | |
586 | static inline void sv_to (SV *sv, region * &v) { v = (region *) (attachable *)SvPTR_ornull (sv, "cf::region"); } |
597 | static inline void sv_to (SV *sv, region * &v) { v = (region *) (attachable *)SvPTR_ornull (sv, "cf::region"); } |
587 | static inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
598 | static inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
588 | static inline void sv_to (SV *sv, partylist * &v) { v = (partylist *) SvPTR_ornull (sv, "cf::party"); } |
599 | static inline void sv_to (SV *sv, partylist * &v) { v = (partylist *) SvPTR_ornull (sv, "cf::party"); } |
589 | static inline void sv_to (SV *sv, living * &v) { v = (living *) SvPTR_ornull (sv, "cf::living"); } |
600 | static inline void sv_to (SV *sv, living * &v) { v = (living *) SvPTR_ornull (sv, "cf::living"); } |
590 | static inline void sv_to (SV *sv, mapspace * &v) { v = (mapspace *) SvPTR_ornull (sv, "cf::mapspace"); } |
601 | static inline void sv_to (SV *sv, mapspace * &v) { v = (mapspace *) SvPTR_ornull (sv, "cf::mapspace"); } |
|
|
602 | static inline void sv_to (SV *sv, layout * &v) { v = (layout *) SvPTR_ornull (sv, "cf::layout"); } |
591 | static inline void sv_to (SV *sv, object_freezer * &v) { v = (object_freezer *) SvPTR_ornull (sv, "cf::object::freezer"); } |
603 | static inline void sv_to (SV *sv, object_freezer * &v) { v = (object_freezer *) SvPTR_ornull (sv, "cf::object::freezer"); } |
592 | static inline void sv_to (SV *sv, object_thawer * &v) { v = (object_thawer *) SvPTR_ornull (sv, "cf::object::thawer" ); } |
604 | static inline void sv_to (SV *sv, object_thawer * &v) { v = (object_thawer *) SvPTR_ornull (sv, "cf::object::thawer" ); } |
593 | |
605 | |
594 | //static inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
606 | //static inline void sv_to (SV *sv, faceinfo * &v) { v = &faces [face_find (SvPV_nolen (sv), 0)]; } |
595 | static inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } |
607 | static inline void sv_to (SV *sv, treasurelist * &v) { v = treasurelist::find (SvPV_nolen (sv)); } |
… | |
… | |
762 | exit (EXIT_FAILURE); |
774 | exit (EXIT_FAILURE); |
763 | } |
775 | } |
764 | |
776 | |
765 | eval_pv ( |
777 | eval_pv ( |
766 | "#line 1 'cfperl init'\n" |
778 | "#line 1 'cfperl init'\n" |
767 | "use EV ();\n" |
779 | "use EV ();\n" // required by bootstrap |
768 | "use Coro ();\n" |
780 | "use Coro ();\n" // required by bootstrap |
769 | "cf->bootstrap;\n" |
781 | "cf->bootstrap;\n" // required for cf::datadir |
770 | "unshift @INC, cf::datadir ();\n" |
782 | "unshift @INC, cf::datadir ();\n" // required for 'require' :) |
771 | "require cf;\n", |
783 | "require cf;\n", |
772 | 0 |
784 | 0 |
773 | ); |
785 | ); |
774 | |
786 | |
775 | if (SvTRUE (ERRSV)) |
787 | if (SvTRUE (ERRSV)) |
… | |
… | |
1389 | stash_cf_client_wrap = gv_stashpv ("cf::client::wrap", 1); |
1401 | stash_cf_client_wrap = gv_stashpv ("cf::client::wrap", 1); |
1390 | stash_cf_arch_wrap = gv_stashpv ("cf::arch::wrap" , 1); |
1402 | stash_cf_arch_wrap = gv_stashpv ("cf::arch::wrap" , 1); |
1391 | stash_cf_party_wrap = gv_stashpv ("cf::party::wrap" , 1); |
1403 | stash_cf_party_wrap = gv_stashpv ("cf::party::wrap" , 1); |
1392 | stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1); |
1404 | stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1); |
1393 | stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1); |
1405 | stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1); |
|
|
1406 | stash_cf_layout_wrap = gv_stashpv ("cf::layout::wrap", 1); |
|
|
1407 | stash_ext_map_world = gv_stashpv ("ext::map_world" , 1); |
1394 | |
1408 | |
1395 | sv_now = get_sv ("cf::NOW" , 1); SvUPGRADE (sv_now , SVt_NV); |
1409 | sv_now = get_sv ("cf::NOW" , 1); SvUPGRADE (sv_now , SVt_NV); |
1396 | sv_runtime = get_sv ("cf::RUNTIME" , 1); SvUPGRADE (sv_runtime , SVt_NV); |
1410 | sv_runtime = get_sv ("cf::RUNTIME" , 1); SvUPGRADE (sv_runtime , SVt_NV); |
1397 | sv_tick_start = get_sv ("cf::TICK_START", 1); SvUPGRADE (sv_tick_start, SVt_NV); |
1411 | sv_tick_start = get_sv ("cf::TICK_START", 1); SvUPGRADE (sv_tick_start, SVt_NV); |
1398 | sv_next_tick = get_sv ("cf::NEXT_TICK" , 1); SvUPGRADE (sv_next_tick , SVt_NV); |
1412 | sv_next_tick = get_sv ("cf::NEXT_TICK" , 1); SvUPGRADE (sv_next_tick , SVt_NV); |
… | |
… | |
1446 | # include "attackinc.h" |
1460 | # include "attackinc.h" |
1447 | # undef def |
1461 | # undef def |
1448 | # define def(uc, flags) const_iv (SK_ ## uc) |
1462 | # define def(uc, flags) const_iv (SK_ ## uc) |
1449 | # include "skillinc.h" |
1463 | # include "skillinc.h" |
1450 | # undef def |
1464 | # undef def |
1451 | |
1465 | # define def(name, use, nonuse) const_iv (body_ ## name) |
1452 | const_iv (llevError) const_iv (llevInfo) const_iv (llevDebug) const_iv (llevMonster) |
1466 | # include "slotinc.h" |
1453 | const_iv (logBacktrace) |
1467 | # undef def |
1454 | |
|
|
1455 | const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd) |
|
|
1456 | |
1468 | |
1457 | const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) |
1469 | const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) |
1458 | |
1470 | |
1459 | const_iv (MAX_TIME) |
1471 | const_iv (MAX_TIME) |
1460 | const_iv (MAXSOCKBUF) |
1472 | const_iv (MAXSOCKBUF) |
… | |
… | |
1485 | const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) |
1497 | const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) |
1486 | |
1498 | |
1487 | const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES) |
1499 | const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES) |
1488 | }; |
1500 | }; |
1489 | |
1501 | |
1490 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1502 | for (civ = const_iv + array_length (const_iv); civ-- > const_iv; ) |
1491 | newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); |
1503 | newCONSTSUB (stash_cf, (char *)civ->name, newSViv (civ->iv)); |
1492 | |
1504 | |
1493 | static const struct { |
1505 | static const struct { |
1494 | const char *name; |
1506 | const char *name; |
1495 | int skip; |
1507 | int skip; |
… | |
… | |
1501 | # undef def |
1513 | # undef def |
1502 | }; |
1514 | }; |
1503 | |
1515 | |
1504 | AV *av = get_av ("cf::EVENT", 1); |
1516 | AV *av = get_av ("cf::EVENT", 1); |
1505 | |
1517 | |
1506 | for (eiv = event_iv + sizeof (event_iv) / sizeof (event_iv [0]); eiv-- > event_iv; ) |
1518 | for (eiv = event_iv + array_length (event_iv); eiv-- > event_iv; ) |
1507 | { |
1519 | { |
1508 | AV *event = newAV (); |
1520 | AV *event = newAV (); |
1509 | av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0)); |
1521 | av_push (event, newSVpv ((char *)eiv->name + eiv->skip, 0)); |
1510 | av_push (event, newSViv (eiv->klass)); |
1522 | av_push (event, newSViv (eiv->klass)); |
1511 | av_store (av, eiv->iv, newRV_noinc ((SV *)event)); |
1523 | av_store (av, eiv->iv, newRV_noinc ((SV *)event)); |
… | |
… | |
1546 | |
1558 | |
1547 | for_all_objects (op) |
1559 | for_all_objects (op) |
1548 | op->reattach (); |
1560 | op->reattach (); |
1549 | } |
1561 | } |
1550 | |
1562 | |
1551 | # support function for map-world.ext |
|
|
1552 | void _quantise (SV *data_sv, SV *plt_sv) |
|
|
1553 | CODE: |
|
|
1554 | { |
|
|
1555 | if (!SvROK (plt_sv) || SvTYPE (SvRV (plt_sv)) != SVt_PVAV) |
|
|
1556 | croak ("_quantise called with invalid agruments"); |
|
|
1557 | |
|
|
1558 | plt_sv = SvRV (plt_sv); |
|
|
1559 | SV **plt = AvARRAY (plt_sv); |
|
|
1560 | int plt_count = AvFILL (plt_sv) + 1; |
|
|
1561 | |
|
|
1562 | STRLEN len; |
|
|
1563 | char *data = SvPVbyte (data_sv, len); |
|
|
1564 | char *dst = data; |
|
|
1565 | |
|
|
1566 | while (len >= 3) |
|
|
1567 | { |
|
|
1568 | for (SV **val_sv = plt + plt_count; val_sv-- > plt; ) |
|
|
1569 | { |
|
|
1570 | char *val = SvPVX (*val_sv); |
|
|
1571 | |
|
|
1572 | if (val [0] == data [0] |
|
|
1573 | && val [1] == data [1] |
|
|
1574 | && val [2] == data [2]) |
|
|
1575 | { |
|
|
1576 | *dst++ = val [3]; |
|
|
1577 | goto next; |
|
|
1578 | } |
|
|
1579 | } |
|
|
1580 | |
|
|
1581 | croak ("_quantise: color not found in palette: #%02x%02x%02x, at offset %d %d", |
|
|
1582 | (uint8_t)data [0], (uint8_t)data [1], (uint8_t)data [2], |
|
|
1583 | dst - SvPVX (data_sv), len); |
|
|
1584 | |
|
|
1585 | next: |
|
|
1586 | data += 3; |
|
|
1587 | len -= 3; |
|
|
1588 | } |
|
|
1589 | |
|
|
1590 | SvCUR_set (data_sv, dst - SvPVX (data_sv)); |
|
|
1591 | } |
|
|
1592 | |
|
|
1593 | void init_anim () |
1563 | void init_anim () |
1594 | |
1564 | |
1595 | void init_globals () |
1565 | void init_globals () |
1596 | |
1566 | |
1597 | void init_experience () |
|
|
1598 | |
|
|
1599 | void init_attackmess () |
1567 | void init_attackmess () |
1600 | |
1568 | |
1601 | void init_dynamic () |
1569 | void init_dynamic () |
1602 | |
1570 | |
1603 | void load_settings () |
1571 | void load_settings () |
1604 | |
1572 | |
|
|
1573 | void reload_exp_table () |
|
|
1574 | |
1605 | void load_materials () |
1575 | void reload_materials () |
1606 | |
1576 | |
1607 | void init_uuid () |
1577 | void init_uuid () |
1608 | CODE: |
1578 | CODE: |
1609 | UUID::init (); |
1579 | UUID::init (); |
1610 | |
1580 | |
… | |
… | |
1765 | |
1735 | |
1766 | int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) |
1736 | int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) |
1767 | INIT: |
1737 | INIT: |
1768 | #if __GLIBC__ |
1738 | #if __GLIBC__ |
1769 | mallopt (M_TOP_PAD, 1024 * 1024); |
1739 | mallopt (M_TOP_PAD, 1024 * 1024); |
1770 | mallopt (M_MMAP_THRESHOLD, 1024 * 1024 * 128); |
1740 | mallopt (M_MMAP_THRESHOLD, 1024 * 1024); |
1771 | mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory |
1741 | mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory |
|
|
1742 | if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10)) |
1772 | mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc |
1743 | mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc |
1773 | #endif |
1744 | #endif |
1774 | |
1745 | |
1775 | int munlockall () |
1746 | int munlockall () |
1776 | |
1747 | |
1777 | #endif |
1748 | #endif |
… | |
… | |
1815 | int exp_to_level (val64 exp) |
1786 | int exp_to_level (val64 exp) |
1816 | |
1787 | |
1817 | val64 level_to_min_exp (int level) |
1788 | val64 level_to_min_exp (int level) |
1818 | |
1789 | |
1819 | SV * |
1790 | SV * |
1820 | resistance_to_string (int atnr) |
1791 | attacktype_name (int atnr) |
1821 | CODE: |
1792 | CODE: |
1822 | if (atnr >= 0 && atnr < NROFATTACKS) |
1793 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
|
|
1794 | ? newSVpv (attacktype_name [atnr], 0) |
|
|
1795 | : &PL_sv_undef; |
|
|
1796 | OUTPUT: RETVAL |
|
|
1797 | |
|
|
1798 | SV * |
|
|
1799 | attacktype_desc (int atnr) |
|
|
1800 | CODE: |
|
|
1801 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
|
|
1802 | ? newSVpv (attacktype_desc [atnr], 0) |
|
|
1803 | : &PL_sv_undef; |
|
|
1804 | OUTPUT: RETVAL |
|
|
1805 | |
|
|
1806 | SV * |
|
|
1807 | resist_plus (int atnr) |
|
|
1808 | CODE: |
|
|
1809 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
1823 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1810 | ? newSVpv (resist_plus [atnr], 0) |
1824 | else |
1811 | : &PL_sv_undef; |
1825 | XSRETURN_UNDEF; |
1812 | OUTPUT: RETVAL |
|
|
1813 | |
|
|
1814 | SV * |
|
|
1815 | change_resist_msg (int atnr) |
|
|
1816 | CODE: |
|
|
1817 | RETVAL = IN_RANGE_EXC (atnr, 0, NROFATTACKS) |
|
|
1818 | ? newSVpv (change_resist_msg [atnr], 0) |
|
|
1819 | : &PL_sv_undef; |
1826 | OUTPUT: RETVAL |
1820 | OUTPUT: RETVAL |
1827 | |
1821 | |
1828 | UUID |
1822 | UUID |
1829 | uuid_cur () |
1823 | uuid_cur () |
1830 | CODE: |
1824 | CODE: |
… | |
… | |
1880 | CODE: |
1874 | CODE: |
1881 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1875 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1882 | OUTPUT: |
1876 | OUTPUT: |
1883 | RETVAL |
1877 | RETVAL |
1884 | |
1878 | |
|
|
1879 | bool should_invoke (attachable *obj, int event) |
|
|
1880 | CODE: |
|
|
1881 | RETVAL = obj->should_invoke ((event_type)event); |
|
|
1882 | OUTPUT: RETVAL |
|
|
1883 | |
1885 | void |
1884 | void |
1886 | debug_trace (attachable *obj, bool on = true) |
1885 | debug_trace (attachable *obj, bool on = true) |
1887 | CODE: |
1886 | CODE: |
1888 | obj->attachable_flags &= ~attachable::F_DEBUG_TRACE; |
1887 | obj->attachable_flags &= ~attachable::F_DEBUG_TRACE; |
1889 | if (on) |
1888 | if (on) |
… | |
… | |
1948 | int mortals_size () |
1947 | int mortals_size () |
1949 | CODE: |
1948 | CODE: |
1950 | RETVAL = attachable::mortals.size (); |
1949 | RETVAL = attachable::mortals.size (); |
1951 | OUTPUT: RETVAL |
1950 | OUTPUT: RETVAL |
1952 | |
1951 | |
1953 | const_utf8_string slot_use_name (U32 slot) |
1952 | const_utf8_string slot_name (U32 slot) |
1954 | ALIAS: |
1953 | ALIAS: |
|
|
1954 | slot_name = 0 |
|
|
1955 | slot_use_name = 1 |
1955 | slot_nonuse_name = 1 |
1956 | slot_nonuse_name = 2 |
1956 | CODE: |
1957 | CODE: |
1957 | { |
1958 | { |
1958 | if (slot >= NUM_BODY_LOCATIONS) |
1959 | if (slot >= NUM_BODY_LOCATIONS) |
1959 | croak ("body slot index out of range"); |
1960 | croak ("body slot index out of range"); |
1960 | |
1961 | |
1961 | switch (ix) |
1962 | switch (ix) |
1962 | { |
1963 | { |
|
|
1964 | case 0: RETVAL = body_locations[slot].name ; break; |
1963 | case 0: RETVAL = body_locations[slot].use_name; break; |
1965 | case 1: RETVAL = body_locations[slot].use_name ; break; |
1964 | case 1: RETVAL = body_locations[slot].nonuse_name; break; |
1966 | case 2: RETVAL = body_locations[slot].nonuse_name; break; |
1965 | } |
1967 | } |
1966 | } |
1968 | } |
1967 | OUTPUT: |
1969 | OUTPUT: |
1968 | RETVAL |
1970 | RETVAL |
1969 | |
1971 | |
… | |
… | |
2075 | |
2077 | |
2076 | void pick_up (object *who, object *op) |
2078 | void pick_up (object *who, object *op) |
2077 | |
2079 | |
2078 | void update_object (object *op, int action) |
2080 | void update_object (object *op, int action) |
2079 | |
2081 | |
2080 | void change_exp (object *op, uint64 exp, utf8_string skill_name = 0, int flag = 0) |
2082 | void change_exp (object *op, uint64 exp, shstr_tmp skill_name = shstr_tmp (), int flag = 0) |
2081 | |
2083 | |
2082 | void player_lvl_adj (object *who, object *skill = 0) |
2084 | void player_lvl_adj (object *who, object *skill = 0) |
2083 | |
2085 | |
2084 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
2086 | int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) |
2085 | |
2087 | |
… | |
… | |
2130 | RETVAL = 0; |
2132 | RETVAL = 0; |
2131 | } |
2133 | } |
2132 | |
2134 | |
2133 | shstr |
2135 | shstr |
2134 | object::kv_get (shstr key) |
2136 | object::kv_get (shstr key) |
|
|
2137 | CODE: |
|
|
2138 | RETVAL = THIS->kv.get (key); |
|
|
2139 | OUTPUT: |
|
|
2140 | RETVAL |
2135 | |
2141 | |
2136 | void |
2142 | void |
2137 | object::kv_del (shstr key) |
2143 | object::kv_del (shstr key) |
|
|
2144 | CODE: |
|
|
2145 | THIS->kv.del (key); |
2138 | |
2146 | |
2139 | void |
2147 | void |
2140 | object::kv_set (shstr key, shstr value) |
2148 | object::kv_set (shstr key, shstr value) |
|
|
2149 | CODE: |
|
|
2150 | THIS->kv.set (key, value); |
2141 | |
2151 | |
2142 | object *get_nearest_player (object *ob) |
2152 | object *get_nearest_player (object *ob) |
2143 | ALIAS: nearest_player = 0 |
2153 | ALIAS: nearest_player = 0 |
2144 | PREINIT: |
2154 | PREINIT: |
2145 | extern object *get_nearest_player (object *); |
2155 | extern object *get_nearest_player (object *); |
… | |
… | |
2347 | for_all_players (pl) |
2357 | for_all_players (pl) |
2348 | if (pl->ob && pl->ob->map == THIS) |
2358 | if (pl->ob && pl->ob->map == THIS) |
2349 | PUSHs (sv_2mortal (to_sv (pl->ob))); |
2359 | PUSHs (sv_2mortal (to_sv (pl->ob))); |
2350 | } |
2360 | } |
2351 | |
2361 | |
|
|
2362 | #if 0 |
|
|
2363 | |
|
|
2364 | void |
|
|
2365 | maptile::add_quadland (int mx, int my, int mz, SV *biome_map, SV *biome_plt) |
|
|
2366 | CODE: |
|
|
2367 | { |
|
|
2368 | static frac_gen<vec2d> frac; |
|
|
2369 | |
|
|
2370 | if (!SvROK (biome_plt) || SvTYPE (SvRV (biome_plt)) != SVt_PVAV) |
|
|
2371 | croak ("maptile::add_quadland: biome_plt must be arrayref"); |
|
|
2372 | |
|
|
2373 | biome_plt = SvRV (biome_plt); |
|
|
2374 | |
|
|
2375 | const uint8_t *bmap = (const uint8_t *)SvPVbyte_nolen (biome_map); |
|
|
2376 | |
|
|
2377 | for (int x = 0; x < THIS->width; ++x) |
|
|
2378 | for (int y = 0; y < THIS->height; ++y) |
|
|
2379 | { |
|
|
2380 | for (object *op = THIS->at (x, y).bot; op; op = op->above) |
|
|
2381 | if (op->flag [FLAG_IS_FLOOR]) |
|
|
2382 | goto skip; |
|
|
2383 | |
|
|
2384 | { |
|
|
2385 | float fx = mx * THIS->width + x; |
|
|
2386 | float fy = my * THIS->height + y; |
|
|
2387 | |
|
|
2388 | int temp = clamp (int (32 * frac.fBm (vec2d (fx * 0.001, fy * 0.001), 2) ) - 8, 0, 15); |
|
|
2389 | int rain = clamp (int (16 * frac.ridgedmultifractal (vec2d (fx * 0.01, fy * 0.01), 3, 1.03, 2)) - 8, 0, 15); |
|
|
2390 | |
|
|
2391 | rain = lerp (rain, 0, 15, 0, temp); |
|
|
2392 | printf ("rain %d\n", temp);//D |
|
|
2393 | |
|
|
2394 | int biome = bmap [rain * 16 + temp]; |
|
|
2395 | |
|
|
2396 | //printf ("%2d %2d => %s\n", temp, rain, SvPV_nolen (AvARRAY ((AV *)biome_plt)[biome]));//D |
|
|
2397 | #if 1 |
|
|
2398 | if (SV **elem = av_fetch ((AV *)biome_plt, bmap [rain * 16 + temp], 0)) |
|
|
2399 | { |
|
|
2400 | object *ob = get_archetype (cfSvPVutf8_nolen (*elem)); |
|
|
2401 | ob->flag [FLAG_NO_MAP_SAVE] = true; |
|
|
2402 | THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); |
|
|
2403 | |
|
|
2404 | if (ob->randomitems && !ob->above) |
|
|
2405 | { |
|
|
2406 | ob->create_treasure (ob->randomitems); |
|
|
2407 | |
|
|
2408 | for (object *op = ob->above; op; op = op->above) |
|
|
2409 | op->flag [FLAG_NO_MAP_SAVE] = true; |
|
|
2410 | } |
|
|
2411 | } |
|
|
2412 | #endif |
|
|
2413 | } |
|
|
2414 | skip: ; |
|
|
2415 | } |
|
|
2416 | } |
|
|
2417 | |
|
|
2418 | #endif |
|
|
2419 | |
2352 | void |
2420 | void |
2353 | maptile::add_underlay (SV *data, int offset, int stride, SV *palette) |
2421 | maptile::add_underlay (SV *data, int offset, int stride, SV *palette) |
2354 | CODE: |
2422 | CODE: |
2355 | { |
2423 | { |
2356 | if (!SvROK (palette) || SvTYPE (SvRV (palette)) != SVt_PVAV) |
2424 | if (!SvROK (palette) || SvTYPE (SvRV (palette)) != SVt_PVAV) |
… | |
… | |
2387 | op->flag [FLAG_NO_MAP_SAVE] = true; |
2455 | op->flag [FLAG_NO_MAP_SAVE] = true; |
2388 | // TODO: if this is a pickable object, then the item |
2456 | // TODO: if this is a pickable object, then the item |
2389 | // will at a bit weird - saving inside the player |
2457 | // will at a bit weird - saving inside the player |
2390 | // will clear the flag, but when the player drops |
2458 | // will clear the flag, but when the player drops |
2391 | // it without logging out, it keeps the flag. |
2459 | // it without logging out, it keeps the flag. |
2392 | // nobody ahs reported this, but this can be rather |
2460 | // nobody has reported this, but this can be rather |
2393 | // annoying on persistent maps. |
2461 | // annoying on persistent maps. |
2394 | } |
2462 | } |
2395 | } |
2463 | } |
2396 | } |
2464 | } |
2397 | } |
2465 | } |
2398 | |
|
|
2399 | skip: ; |
2466 | skip: ; |
2400 | } |
2467 | } |
2401 | } |
2468 | } |
2402 | |
2469 | |
2403 | void |
2470 | void |
… | |
… | |
2434 | for (int x = 0; x < THIS->width; ++x) |
2501 | for (int x = 0; x < THIS->width; ++x) |
2435 | for (int y = 0; y < THIS->height; ++y) |
2502 | for (int y = 0; y < THIS->height; ++y) |
2436 | { |
2503 | { |
2437 | region *rgn = THIS->region (x, y); |
2504 | region *rgn = THIS->region (x, y); |
2438 | |
2505 | |
2439 | //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D |
|
|
2440 | if (object *op = THIS->at (x, y).top) |
2506 | if (object *op = THIS->at (x, y).top) |
2441 | if (rgn->treasure && rndm () < rgn->treasure_density) |
2507 | if (rgn->treasure && rndm () < rgn->treasure_density) |
2442 | create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); |
2508 | create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); |
2443 | } |
2509 | } |
2444 | |
2510 | |
… | |
… | |
2450 | if (oblinkpt *obp = map->find_link (connection)) |
2516 | if (oblinkpt *obp = map->find_link (connection)) |
2451 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
2517 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
2452 | XPUSHs (sv_2mortal (to_sv ((object *)ol->ob))); |
2518 | XPUSHs (sv_2mortal (to_sv ((object *)ol->ob))); |
2453 | |
2519 | |
2454 | void |
2520 | void |
2455 | get_map_flags (maptile *map, int x, int y) |
2521 | xy_normalise (maptile *map, int x, int y, int dir = 0) |
2456 | PPCODE: |
2522 | PPCODE: |
2457 | { |
2523 | { |
2458 | maptile *nmap = 0; |
2524 | mapxy pos (map, x, y); |
2459 | I16 nx = 0, ny = 0; |
2525 | if (!pos.move (dir).normalise ()) |
|
|
2526 | XSRETURN_EMPTY; |
2460 | |
2527 | |
2461 | PUTBACK; |
|
|
2462 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2463 | SPAGAIN; |
|
|
2464 | |
|
|
2465 | EXTEND (SP, 4); |
2528 | EXTEND (SP, 3); |
2466 | PUSHs (sv_2mortal (newSViv (flags))); |
|
|
2467 | |
|
|
2468 | if (GIMME_V == G_ARRAY) |
|
|
2469 | { |
|
|
2470 | PUSHs (sv_2mortal (to_sv (nmap))); |
2529 | PUSHs (sv_2mortal (to_sv (pos.m))); |
2471 | PUSHs (sv_2mortal (newSViv (nx))); |
2530 | PUSHs (sv_2mortal (to_sv (pos.x))); |
2472 | PUSHs (sv_2mortal (newSViv (ny))); |
2531 | PUSHs (sv_2mortal (to_sv (pos.y))); |
2473 | } |
|
|
2474 | } |
2532 | } |
2475 | |
2533 | |
2476 | mapspace * |
2534 | mapspace * |
2477 | ms (maptile *map, unsigned int x, unsigned int y) |
2535 | ms (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2478 | PROTOTYPE: $$$ |
2536 | PROTOTYPE: $$$;$ |
2479 | CODE: |
2537 | CODE: |
2480 | { |
2538 | { |
2481 | maptile *nmap = 0; |
2539 | mapxy pos (map, x, y); |
2482 | I16 nx, ny; |
2540 | if (!pos.move (dir).normalise ()) |
2483 | |
|
|
2484 | PUTBACK; |
|
|
2485 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2486 | SPAGAIN; |
|
|
2487 | |
|
|
2488 | if (!nmap) |
|
|
2489 | XSRETURN_UNDEF; |
2541 | XSRETURN_UNDEF; |
2490 | |
2542 | |
2491 | RETVAL = &nmap->at (nx, ny); |
2543 | RETVAL = &*pos; |
2492 | } |
2544 | } |
2493 | OUTPUT: |
2545 | OUTPUT: |
2494 | RETVAL |
2546 | RETVAL |
2495 | |
2547 | |
2496 | void |
2548 | void |
2497 | at (maptile *map, unsigned int x, unsigned int y) |
2549 | at (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2498 | PROTOTYPE: $$$ |
2550 | PROTOTYPE: $$$;$ |
2499 | PPCODE: |
2551 | PPCODE: |
2500 | { |
2552 | mapxy pos (map, x, y); |
2501 | maptile *nmap = 0; |
2553 | if (pos.move (dir).normalise ()) |
2502 | I16 nx, ny; |
|
|
2503 | |
|
|
2504 | PUTBACK; |
|
|
2505 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2506 | SPAGAIN; |
|
|
2507 | |
|
|
2508 | if (nmap) |
|
|
2509 | for (object *o = nmap->at (nx, ny).bot; o; o = o->above) |
2554 | for (object *o = pos->bot; o; o = o->above) |
2510 | XPUSHs (sv_2mortal (to_sv (o))); |
2555 | XPUSHs (sv_2mortal (to_sv (o))); |
2511 | } |
|
|
2512 | |
2556 | |
2513 | SV * |
2557 | SV * |
2514 | bot_at (maptile *map, unsigned int x, unsigned int y) |
2558 | bot_at (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2515 | PROTOTYPE: $$$ |
2559 | PROTOTYPE: $$$;$ |
2516 | ALIAS: |
2560 | ALIAS: |
2517 | top_at = 1 |
2561 | top_at = 1 |
2518 | flags_at = 2 |
2562 | flags_at = 2 |
2519 | light_at = 3 |
2563 | light_at = 3 |
2520 | move_block_at = 4 |
2564 | move_block_at = 4 |
2521 | move_slow_at = 5 |
2565 | move_slow_at = 5 |
2522 | move_on_at = 6 |
2566 | move_on_at = 6 |
2523 | move_off_at = 7 |
2567 | move_off_at = 7 |
2524 | CODE: |
2568 | CODE: |
2525 | { |
2569 | { |
2526 | sint16 nx = x; |
2570 | mapxy pos (map, x, y); |
2527 | sint16 ny = y; |
2571 | if (!pos.move (dir).normalise ()) |
2528 | |
|
|
2529 | if (!xy_normalise (map, nx, ny)) |
|
|
2530 | XSRETURN_UNDEF; |
2572 | XSRETURN_UNDEF; |
2531 | |
2573 | |
2532 | mapspace &ms = map->at (nx, ny); |
2574 | mapspace &ms = *pos; |
2533 | |
2575 | |
2534 | ms.update (); |
2576 | ms.update (); |
2535 | |
2577 | |
2536 | switch (ix) |
2578 | switch (ix) |
2537 | { |
2579 | { |
… | |
… | |
2547 | } |
2589 | } |
2548 | OUTPUT: RETVAL |
2590 | OUTPUT: RETVAL |
2549 | |
2591 | |
2550 | # worst xs function of my life |
2592 | # worst xs function of my life |
2551 | bool |
2593 | bool |
2552 | _create_random_map (\ |
2594 | _create_random_map (maptile *self, SV *options) |
2553 | maptile *self,\ |
|
|
2554 | utf8_string wallstyle,\ |
|
|
2555 | utf8_string wall_name,\ |
|
|
2556 | utf8_string floorstyle,\ |
|
|
2557 | utf8_string monsterstyle,\ |
|
|
2558 | utf8_string treasurestyle,\ |
|
|
2559 | utf8_string layoutstyle,\ |
|
|
2560 | utf8_string doorstyle,\ |
|
|
2561 | utf8_string decorstyle,\ |
|
|
2562 | utf8_string miningstyle,\ |
|
|
2563 | utf8_string origin_map,\ |
|
|
2564 | utf8_string final_map,\ |
|
|
2565 | utf8_string exitstyle,\ |
|
|
2566 | utf8_string this_map,\ |
|
|
2567 | utf8_string exit_on_final_map,\ |
|
|
2568 | int xsize,\ |
|
|
2569 | int ysize,\ |
|
|
2570 | int expand2x,\ |
|
|
2571 | int layoutoptions1,\ |
|
|
2572 | int layoutoptions2,\ |
|
|
2573 | int layoutoptions3,\ |
|
|
2574 | int symmetry,\ |
|
|
2575 | int difficulty,\ |
|
|
2576 | int difficulty_given,\ |
|
|
2577 | float difficulty_increase,\ |
|
|
2578 | int dungeon_level,\ |
|
|
2579 | int dungeon_depth,\ |
|
|
2580 | int decoroptions,\ |
|
|
2581 | int orientation,\ |
|
|
2582 | int origin_y,\ |
|
|
2583 | int origin_x,\ |
|
|
2584 | U32 random_seed,\ |
|
|
2585 | val64 total_map_hp,\ |
|
|
2586 | int map_layout_style,\ |
|
|
2587 | int treasureoptions,\ |
|
|
2588 | int symmetry_used,\ |
|
|
2589 | region *region,\ |
|
|
2590 | utf8_string custom\ |
|
|
2591 | ) |
|
|
2592 | CODE: |
2595 | CODE: |
2593 | { |
2596 | { |
2594 | random_map_params rmp; |
2597 | random_map_params rmp ((HV *)SvRV (options)); |
2595 | |
|
|
2596 | assign (rmp.wallstyle , wallstyle); |
|
|
2597 | assign (rmp.wall_name , wall_name); |
|
|
2598 | assign (rmp.floorstyle , floorstyle); |
|
|
2599 | assign (rmp.monsterstyle , monsterstyle); |
|
|
2600 | assign (rmp.treasurestyle , treasurestyle); |
|
|
2601 | assign (rmp.layoutstyle , layoutstyle); |
|
|
2602 | assign (rmp.doorstyle , doorstyle); |
|
|
2603 | assign (rmp.decorstyle , decorstyle); |
|
|
2604 | assign (rmp.miningstyle , miningstyle); |
|
|
2605 | assign (rmp.exitstyle , exitstyle); |
|
|
2606 | assign (rmp.exit_on_final_map, exit_on_final_map); |
|
|
2607 | |
|
|
2608 | rmp.origin_map = origin_map; |
|
|
2609 | rmp.final_map = final_map; |
|
|
2610 | rmp.this_map = this_map; |
|
|
2611 | rmp.xsize = xsize; |
|
|
2612 | rmp.ysize = ysize; |
|
|
2613 | rmp.expand2x = expand2x; |
|
|
2614 | rmp.layoutoptions1 = layoutoptions1; |
|
|
2615 | rmp.layoutoptions2 = layoutoptions2; |
|
|
2616 | rmp.layoutoptions3 = layoutoptions3; |
|
|
2617 | rmp.symmetry = symmetry; |
|
|
2618 | rmp.difficulty = difficulty; |
|
|
2619 | rmp.difficulty_given = difficulty_given; |
|
|
2620 | rmp.difficulty_increase = difficulty_increase; |
|
|
2621 | rmp.dungeon_level = dungeon_level; |
|
|
2622 | rmp.dungeon_depth = dungeon_depth; |
|
|
2623 | rmp.decoroptions = decoroptions; |
|
|
2624 | rmp.orientation = orientation; |
|
|
2625 | rmp.origin_y = origin_y; |
|
|
2626 | rmp.origin_x = origin_x; |
|
|
2627 | rmp.random_seed = random_seed; |
|
|
2628 | rmp.total_map_hp = (uint64_t) total_map_hp; |
|
|
2629 | rmp.map_layout_style = map_layout_style; |
|
|
2630 | rmp.treasureoptions = treasureoptions; |
|
|
2631 | rmp.symmetry_used = symmetry_used; |
|
|
2632 | rmp.region = region; |
|
|
2633 | rmp.custom = custom; |
|
|
2634 | |
|
|
2635 | RETVAL = self->generate_random_map (&rmp); |
2598 | RETVAL = self->generate_random_map (&rmp); |
2636 | } |
2599 | } |
2637 | OUTPUT: |
2600 | OUTPUT: |
2638 | RETVAL |
2601 | RETVAL |
2639 | |
2602 | |
… | |
… | |
2670 | void |
2633 | void |
2671 | list () |
2634 | list () |
2672 | PPCODE: |
2635 | PPCODE: |
2673 | for_all_regions (rgn) |
2636 | for_all_regions (rgn) |
2674 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2637 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2675 | |
|
|
2676 | region *find (utf8_string name) |
|
|
2677 | PROTOTYPE: $ |
|
|
2678 | CODE: |
|
|
2679 | RETVAL = region::find (name); |
|
|
2680 | OUTPUT: RETVAL |
|
|
2681 | |
2638 | |
2682 | int specificity (region *rgn) |
2639 | int specificity (region *rgn) |
2683 | CODE: |
2640 | CODE: |
2684 | RETVAL = 0; |
2641 | RETVAL = 0; |
2685 | while (rgn = rgn->parent) |
2642 | while (rgn = rgn->parent) |
… | |
… | |
2817 | |
2774 | |
2818 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2775 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2819 | CODE: |
2776 | CODE: |
2820 | { |
2777 | { |
2821 | faceinfo *f = face_info (idx); assert (f); |
2778 | faceinfo *f = face_info (idx); assert (f); |
2822 | facedata *d = &(faceset ? f->data64 : f->data32); |
2779 | facedata *d = f->face + faceset; |
2823 | sv_to (data, d->data); |
2780 | sv_to (data, d->data); |
2824 | STRLEN clen; |
2781 | STRLEN clen; |
2825 | char *cdata = SvPVbyte (chksum, clen); |
2782 | char *cdata = SvPVbyte (chksum, clen); |
2826 | clen = min (CHKSUM_MAXLEN, clen); |
2783 | clen = min (CHKSUM_MAXLEN, clen); |
2827 | |
2784 | |
… | |
… | |
2979 | XPUSHs (sv_2mortal (newSVpv_utf8 (self->get_str ()))); |
2936 | XPUSHs (sv_2mortal (newSVpv_utf8 (self->get_str ()))); |
2980 | |
2937 | |
2981 | self->skip (); |
2938 | self->skip (); |
2982 | } |
2939 | } |
2983 | |
2940 | |
|
|
2941 | MODULE = cf PACKAGE = cf::layout |
|
|
2942 | |
|
|
2943 | INCLUDE: $PERL $srcdir/genacc layout $srcdir/../include/rmg.h | |
|
|
2944 | |