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.297 by root, Mon Sep 8 11:27:25 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;
1326 const_iv (FLAG_CURSED) const_iv (FLAG_DAMNED) const_iv (FLAG_SEE_ANYWHERE) const_iv (FLAG_KNOWN_MAGICAL) 1319 const_iv (FLAG_CURSED) const_iv (FLAG_DAMNED) const_iv (FLAG_SEE_ANYWHERE) const_iv (FLAG_KNOWN_MAGICAL)
1327 const_iv (FLAG_KNOWN_CURSED) const_iv (FLAG_CAN_USE_SKILL) const_iv (FLAG_BEEN_APPLIED) const_iv (FLAG_READY_SCROLL) 1320 const_iv (FLAG_KNOWN_CURSED) const_iv (FLAG_CAN_USE_SKILL) const_iv (FLAG_BEEN_APPLIED) const_iv (FLAG_READY_SCROLL)
1328 const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED) 1321 const_iv (FLAG_USE_ROD) const_iv (FLAG_USE_HORN) const_iv (FLAG_MAKE_INVIS) const_iv (FLAG_INV_LOCKED)
1329 const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON) 1322 const_iv (FLAG_IS_WOODED) const_iv (FLAG_IS_HILLY) const_iv (FLAG_READY_SKILL) const_iv (FLAG_READY_WEAPON)
1330 const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON) 1323 const_iv (FLAG_NO_SKILL_IDENT) const_iv (FLAG_BLIND) const_iv (FLAG_SEE_IN_DARK) const_iv (FLAG_IS_CAULDRON)
1331 const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_BERSERK) 1324 const_iv (FLAG_NO_STEAL) const_iv (FLAG_ONE_HIT) const_iv (FLAG_DEBUG) const_iv (FLAG_BERSERK)
1332 const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL) 1325 const_iv (FLAG_NEUTRAL) const_iv (FLAG_NO_ATTACK) const_iv (FLAG_NO_DAMAGE) const_iv (FLAG_OBJ_ORIGINAL)
1333 const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER) 1326 const_iv (FLAG_ACTIVATE_ON_PUSH) const_iv (FLAG_ACTIVATE_ON_RELEASE) const_iv (FLAG_IS_WATER)
1334 const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE) 1327 const_iv (FLAG_CONTENT_ON_GEN) const_iv (FLAG_IS_A_TEMPLATE) const_iv (FLAG_IS_BUILDABLE)
1335 const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE) 1328 const_iv (FLAG_DESTROY_ON_DEATH) const_iv (FLAG_NO_MAP_SAVE)
1336 1329
1337 const_iv (NDI_BLACK) const_iv (NDI_WHITE) const_iv (NDI_NAVY) const_iv (NDI_RED) 1330 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) 1331 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) 1332 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) 1333 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) 1334 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) 1335 const_iv (NDI_NOCREATE) const_iv (NDI_CLEAR) const_iv (NDI_VERBATIM)
1343 1336
1344 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1337 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) 1338 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1346 1339
1347 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1340 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
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