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.298 by root, Tue Sep 16 14:25:37 2008 UTC vs.
Revision 1.304 by root, Wed Oct 1 05:50:19 2008 UTC

626 626
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 "-e0"
632 "use EV; use Coro;" // required for bootstrap
633 "cf->bootstrap;" // required for datadir :*>
634 "unshift @INC, cf::datadir ();"
635 "require cf;"
636 }; 632 };
637 633
638 if (perl_parse (perl, xs_init, 2, (char **)argv, environ) 634 if (perl_parse (perl, xs_init, 2, (char **)argv, environ)
639 || perl_run (perl)) 635 || perl_run (perl))
640 { 636 {
641 printf ("unable to initialize perl-interpreter, aborting.\n"); 637 printf ("unable to initialize perl-interpreter, aborting.\n");
642 exit (EXIT_FAILURE); 638 exit (EXIT_FAILURE);
643 } 639 }
644 640
641 eval_pv (
642 "#line 1 'cfperl init'\n"
643 "use EV ();\n"
644 "use Coro ();\n"
645 "cf->bootstrap;\n"
646 "unshift @INC, cf::datadir ();\n"
647 "require cf;\n",
648 0
649 );
650
651 if (SvTRUE (ERRSV))
645 { 652 {
646 dSP; 653 printf ("unable to bootstrap perl, aborting:\n%s", SvPV_nolen (ERRSV));
647 654 exit (EXIT_FAILURE);
648 PUSHMARK (SP);
649 PUTBACK;
650 call_pv ("cf::init", G_DISCARD | G_VOID);
651 } 655 }
652} 656}
653 657
654void cfperl_main () 658void cfperl_main ()
655{ 659{
656 dSP; 660 dSP;
1337 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) 1341 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED)
1338 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN) 1342 const_iv (NDI_ORANGE) const_iv (NDI_BLUE) const_iv (NDI_DK_ORANGE) const_iv (NDI_GREEN)
1339 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD) 1343 const_iv (NDI_LT_GREEN) const_iv (NDI_GREY) const_iv (NDI_BROWN) const_iv (NDI_GOLD)
1340 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE) 1344 const_iv (NDI_TAN) const_iv (NDI_MAX_COLOR) const_iv (NDI_COLOR_MASK) const_iv (NDI_UNIQUE)
1341 const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK) 1345 const_iv (NDI_ALL) const_iv (NDI_DEF) const_iv (NDI_REPLY) const_iv (NDI_CLIENT_MASK)
1342 const_iv (NDI_NOCREATE) const_iv (NDI_CLEAR) 1346 const_iv (NDI_NOCREATE) const_iv (NDI_CLEAR) const_iv (NDI_VERBATIM)
1343 1347
1344 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1348 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE)
1345 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) 1349 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1346 1350
1347 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1351 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
1521 f (GvGP (gv)->gp_cv); 1525 f (GvGP (gv)->gp_cv);
1522 GvCVGEN (gv) = 0; 1526 GvCVGEN (gv) = 0;
1523 GvMULTI_off (gv); 1527 GvMULTI_off (gv);
1524# undef f 1528# undef f
1525 1529
1526
1527void _connect_to_perl () 1530void _connect_to_perl ()
1528 1531
1529void _recalc_want () 1532void _recalc_want ()
1530 1533
1534# not used by default anymore
1531void _global_reattach () 1535void _global_reattach ()
1532 CODE: 1536 CODE:
1533{ 1537{
1534 // reattach to all attachable objects in the game. 1538 // reattach to all attachable objects in the game.
1535 for_all_clients (ns) 1539 for_all_clients (ns)
1578 len -= 3; 1582 len -= 3;
1579 } 1583 }
1580 1584
1581 SvCUR_set (data_sv, dst - SvPVX (data_sv)); 1585 SvCUR_set (data_sv, dst - SvPVX (data_sv));
1582} 1586}
1587
1588void init_anim ()
1589
1590void init_globals ()
1591
1592void init_experience ()
1593
1594void init_attackmess ()
1595
1596void init_dynamic ()
1597
1598void init_block ()
1599
1600void load_settings ()
1601
1602void load_materials ()
1603
1604void init_uuid ()
1605 CODE:
1606 UUID::init ();
1607
1608void init_signals ()
1609
1610void init_commands ()
1611
1612void init_skills ()
1613
1614void init_beforeplay ()
1583 1615
1584void evthread_start (int aiofd) 1616void evthread_start (int aiofd)
1585 1617
1586void cede_to_tick () 1618void cede_to_tick ()
1587 CODE: 1619 CODE:
1725#if _POSIX_MEMLOCK 1757#if _POSIX_MEMLOCK
1726 1758
1727int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) 1759int mlockall (int flags = MCL_CURRENT | MCL_FUTURE)
1728 INIT: 1760 INIT:
1729#if __GLIBC__ 1761#if __GLIBC__
1762 mallopt (M_TOP_PAD, 1024 * 1024);
1763 mallopt (M_MMAP_THRESHOLD, 1024 * 1024 * 128);
1764 mallopt (M_MMAP_MAX, 0); // likely bug-workaround, also frees memory
1730 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc 1765 mallopt (M_PERTURB, 0xee); // bug-workaround for linux glibc+mlockall+calloc
1731#endif 1766#endif
1732 1767
1733int munlockall () 1768int munlockall ()
1734 1769
2392} 2427}
2393 2428
2394void 2429void
2395maptile::create_region_treasure () 2430maptile::create_region_treasure ()
2396 CODE: 2431 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) 2432 for (int x = 0; x < THIS->width; ++x)
2403 for (int y = 0; y < THIS->height; ++y) 2433 for (int y = 0; y < THIS->height; ++y)
2404 { 2434 {
2405 region *rgn = THIS->region (x, y); 2435 region *rgn = THIS->region (x, y);
2406 2436
2407 //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D 2437 //fprintf (stderr, "%d,%d %f %p\n", x, y, rgn->treasure_density,rgn->treasure);//D
2438 if (object *op = THIS->at (x, y).top)
2408 if (rgn->treasure && rndm () < rgn->treasure_density) 2439 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); 2440 create_treasure (rgn->treasure, op, GT_ENVIRONMENT, THIS->difficulty);
2413 }
2414 } 2441 }
2415
2416 op->destroy ();
2417}
2418 2442
2419int out_of_map (maptile *map, int x, int y) 2443int out_of_map (maptile *map, int x, int y)
2420 2444
2421void 2445void
2422trigger (maptile *map, long connection, bool state = true) 2446trigger (maptile *map, long connection, bool state = true)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines