ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.299 by root, Fri Sep 19 01:39:45 2008 UTC vs.
Revision 1.303 by root, Tue Sep 23 04:29:11 2008 UTC

627 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 627 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
628 628
629 const char *argv[] = { 629 const char *argv[] = {
630 settings.argv [0], 630 settings.argv [0],
631 "-e" 631 "-e"
632 "use EV; use Coro;" // required for bootstrap 632 "use EV ();"
633 "cf->bootstrap;" // required for datadir :*> 633 "use Coro ();"
634 "cf->bootstrap;"
634 "unshift @INC, cf::datadir ();" 635 "unshift @INC, cf::datadir ();"
635 "require cf;" 636 "require cf;"
636 }; 637 };
637 638
638 if (perl_parse (perl, xs_init, 2, (char **)argv, environ) 639 if (perl_parse (perl, xs_init, 2, (char **)argv, environ)
639 || perl_run (perl)) 640 || perl_run (perl))
640 { 641 {
641 printf ("unable to initialize perl-interpreter, aborting.\n"); 642 printf ("unable to initialize perl-interpreter, aborting.\n");
642 exit (EXIT_FAILURE); 643 exit (EXIT_FAILURE);
643 } 644 }
644
645 {
646 dSP;
647
648 PUSHMARK (SP);
649 PUTBACK;
650 call_pv ("cf::init", G_DISCARD | G_VOID);
651 }
652} 645}
653 646
654void cfperl_main () 647void cfperl_main ()
655{ 648{
656 dSP; 649 dSP;
1521 f (GvGP (gv)->gp_cv); 1514 f (GvGP (gv)->gp_cv);
1522 GvCVGEN (gv) = 0; 1515 GvCVGEN (gv) = 0;
1523 GvMULTI_off (gv); 1516 GvMULTI_off (gv);
1524# undef f 1517# undef f
1525 1518
1526
1527void _connect_to_perl () 1519void _connect_to_perl ()
1528 1520
1529void _recalc_want () 1521void _recalc_want ()
1530 1522
1531void _global_reattach () 1523void _global_reattach ()
1578 len -= 3; 1570 len -= 3;
1579 } 1571 }
1580 1572
1581 SvCUR_set (data_sv, dst - SvPVX (data_sv)); 1573 SvCUR_set (data_sv, dst - SvPVX (data_sv));
1582} 1574}
1575
1576void init_anim ()
1577
1578void init_globals ()
1579
1580void init_experience ()
1581
1582void init_attackmess ()
1583
1584void init_dynamic ()
1585
1586void init_block ()
1587
1588void load_settings ()
1589
1590void load_materials ()
1591
1592void init_uuid ()
1593 CODE:
1594 UUID::init ();
1595
1596void init_signals ()
1597
1598void init_commands ()
1599
1600void init_skills ()
1601
1602void init_beforeplay ()
1583 1603
1584void evthread_start (int aiofd) 1604void evthread_start (int aiofd)
1585 1605
1586void cede_to_tick () 1606void cede_to_tick ()
1587 CODE: 1607 CODE:
1725#if _POSIX_MEMLOCK 1745#if _POSIX_MEMLOCK
1726 1746
1727int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) 1747int mlockall (int flags = MCL_CURRENT | MCL_FUTURE)
1728 INIT: 1748 INIT:
1729#if __GLIBC__ 1749#if __GLIBC__
1750 mallopt (M_TOP_PAD, 1024 * 1024);
1751 mallopt (M_MMAP_THRESHOLD, 1024 * 1024 * 128);
1752 mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory
1730 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc 1753 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc
1731#endif 1754#endif
1732 1755
1733int munlockall () 1756int munlockall ()
1734 1757
2392} 2415}
2393 2416
2394void 2417void
2395maptile::create_region_treasure () 2418maptile::create_region_treasure ()
2396 CODE: 2419 CODE:
2397{
2398 object *op = object::create ();
2399 op->type = FLOOR;
2400 op->map = THIS;
2401
2402 for (int x = 0; x < THIS->width; ++x) 2420 for (int x = 0; x < THIS->width; ++x)
2403 for (int y = 0; y < THIS->height; ++y) 2421 for (int y = 0; y < THIS->height; ++y)
2404 { 2422 {
2405 region *rgn = THIS->region (x, y); 2423 region *rgn = THIS->region (x, y);
2406 2424
2407 //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D 2425 //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D
2426 if (object *op = THIS->at (x, y).top)
2408 if (rgn->treasure && rndm () < rgn->treasure_density) 2427 if (rgn->treasure && rndm () < rgn->treasure_density)
2409 {
2410 op->x = x;
2411 op->y = y;
2412 create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty); 2428 create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty);
2413 }
2414 } 2429 }
2415
2416 op->destroy ();
2417}
2418 2430
2419int out_of_map (maptile *map, int x, int y) 2431int out_of_map (maptile *map, int x, int y)
2420 2432
2421void 2433void
2422trigger (maptile *map, long connection, bool state = true) 2434trigger (maptile *map, long connection, bool state = true)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines