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.176 by root, Sun Mar 11 02:12:45 2007 UTC vs.
Revision 1.181 by root, Tue Apr 3 00:21:38 2007 UTC

606 perl = perl_alloc (); 606 perl = perl_alloc ();
607 perl_construct (perl); 607 perl_construct (perl);
608 608
609 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 609 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
610 610
611 char *argv[] = { 611 const char *argv[] = {
612 "", 612 "",
613 "-e" 613 "-e"
614 "use Event; use Coro;" // required for bootstrap 614 "use Event; use Coro;" // required for bootstrap
615 "cf->bootstrap;" // required for datadir :*> 615 "cf->bootstrap;" // required for datadir :*>
616 "unshift @INC, cf::datadir ();" 616 "unshift @INC, cf::datadir ();"
617 "require cf;" 617 "require cf;"
618 }; 618 };
619 619
620 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) 620 if (perl_parse (perl, xs_init, 2, (char **)argv, (char **)NULL)
621 || perl_run (perl))
621 { 622 {
622 printf ("unable to initialize perl-interpreter, aborting.\n"); 623 printf ("unable to initialize perl-interpreter, aborting.\n");
623 exit (EXIT_FAILURE); 624 exit (EXIT_FAILURE);
624 } 625 }
625 626
1050# define const_iv(name) { # name, (IV)name }, 1051# define const_iv(name) { # name, (IV)name },
1051 const_iv (llevError) 1052 const_iv (llevError)
1052 const_iv (llevInfo) 1053 const_iv (llevInfo)
1053 const_iv (llevDebug) 1054 const_iv (llevDebug)
1054 const_iv (llevMonster) 1055 const_iv (llevMonster)
1056
1057 const_iv (Map0Cmd)
1058 const_iv (Map1Cmd)
1059 const_iv (Map1aCmd)
1060
1061 const_iv (MAP_CLIENT_X)
1062 const_iv (MAP_CLIENT_Y)
1055 1063
1056 const_iv (MAX_TIME) 1064 const_iv (MAX_TIME)
1057 const_iv (PLAYER) 1065 const_iv (PLAYER)
1058 const_iv (TRANSPORT) 1066 const_iv (TRANSPORT)
1059 const_iv (ROD) 1067 const_iv (ROD)
1643void 1651void
1644sub_generation_inc () 1652sub_generation_inc ()
1645 CODE: 1653 CODE:
1646 PL_sub_generation++; 1654 PL_sub_generation++;
1647 1655
1648char * 1656const char *
1649mapdir () 1657mapdir ()
1650 PROTOTYPE: 1658 PROTOTYPE:
1651 ALIAS: 1659 ALIAS:
1652 mapdir = 0 1660 mapdir = 0
1653 uniquedir = 1 1661 uniquedir = 1
2518 2526
2519MODULE = cf PACKAGE = cf::face PREFIX = face_ 2527MODULE = cf PACKAGE = cf::face PREFIX = face_
2520 2528
2521INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | 2529INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h |
2522 2530
2523int face_find (const char *name, int defidx = 0) 2531faceidx face_find (const char *name, faceidx defidx = 0)
2524 2532
2525int alloc (const char *name) 2533faceidx alloc (const char *name)
2526 CODE: 2534 CODE:
2527{ 2535{
2528 do 2536 do
2529 { 2537 {
2530 RETVAL = faces.size (); 2538 RETVAL = faces.size ();
2531 faces.resize (RETVAL + 1); 2539 faces.resize (RETVAL + 1);
2532 face32.resize (RETVAL + 1);
2533 face64.resize (RETVAL + 1);
2534 } 2540 }
2535 while (!RETVAL); // crude way to leave index 0 2541 while (!RETVAL); // crude way to leave index 0
2536 2542
2537 faces [RETVAL].name = name; 2543 faces [RETVAL].name = name;
2538 facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); 2544 facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL));
2540 if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; 2546 if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL;
2541 if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; 2547 if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL;
2542} 2548}
2543 OUTPUT: RETVAL 2549 OUTPUT: RETVAL
2544 2550
2545void set (int idx, int visibility, int magicmap) 2551void set (faceidx idx, int visibility, int magicmap)
2546 CODE: 2552 CODE:
2553 faceinfo *f = face_info (idx);
2554 assert (f);
2547 faces [idx].visibility = visibility; 2555 f->visibility = visibility;
2548 faces [idx].magicmap = magicmap; 2556 f->magicmap = magicmap;
2549 2557
2558void set_smooth (faceidx idx, faceidx smooth)
2559 CODE:
2560 faceinfo *f = face_info (idx);
2561 assert (f);
2562 f->smooth = smooth;
2563
2550void set_data (int idx, int faceset, SV *data, SV *chksum) 2564void set_data (faceidx idx, int faceset, SV *data, SV *chksum)
2551 CODE: 2565 CODE:
2552 facedata *d = face_data (idx, faceset); 2566 facedata *d = face_data (idx, faceset);
2553 assert (sv_len (chksum) == CHKSUM_SIZE); 2567 assert (d);
2554 sv_to (data, d->data); memcpy (d->chksum, SvPVbyte_nolen (chksum), CHKSUM_SIZE); 2568 sv_to (data, d->data);
2569 STRLEN clen;
2570 char *cdata = SvPVbyte (chksum, clen);
2571 memcpy (d->chksum, cdata, min (CHKSUM_SIZE, clen));
2555 2572
2573void invalidate (faceidx idx)
2574 CODE:
2575 for_all_clients (ns)
2576 ns->faces_sent [idx] = false;
2577
2578void invalidate_all ()
2579 CODE:
2580 for_all_clients (ns)
2581 ns->faces_sent.reset ();
2582

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines