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.399 by root, Fri Apr 22 02:03:12 2011 UTC vs.
Revision 1.414 by root, Tue Oct 30 17:07:50 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2006,2007,2008,2009,2010,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 5 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 6 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 7 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version. 9 * option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the Affero GNU General Public License 16 * You should have received a copy of the Affero GNU General Public License
17 * and the GNU General Public License along with this program. If not, see 17 * and the GNU General Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>. 18 * <http://www.gnu.org/licenses/>.
19 * 19 *
20 * The authors can be reached via e-mail to <support@deliantra.net> 20 * The authors can be reached via e-mail to <support@deliantra.net>
21 */ 21 */
22 22
23#include "autoconf.h" 23#include "autoconf.h"
24 24
29#include <cstdarg> 29#include <cstdarg>
30#include <typeinfo> 30#include <typeinfo>
31 31
32#include "global.h" 32#include "global.h"
33#include "rmg.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
66static int tick_inhibit; 67static int tick_inhibit;
67static int tick_pending; 68static int tick_pending;
68 69
69global gbl_ev; 70global gbl_ev;
70static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; 71static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map;
71static SV *sv_runtime, *sv_tick_start, *sv_next_tick, *sv_now; 72static SV *sv_runtime, *sv_tick_start, *sv_next_tick, *sv_now, *sv_server_tick;
72static AV *av_reflect; 73static AV *av_reflect;
73 74
74bitset<NUM_EVENT_TYPES> ev_want_event; 75bitset<NUM_EVENT_TYPES> ev_want_event;
75bitset<NUM_TYPES> ev_want_type; 76bitset<NUM_TYPES> ev_want_type;
76 77
252 { 253 {
253 static int last_mortalcount; 254 static int last_mortalcount;
254 if (mortals.size () != last_mortalcount) 255 if (mortals.size () != last_mortalcount)
255 { 256 {
256 last_mortalcount = mortals.size (); 257 last_mortalcount = mortals.size ();
257 LOG (llevInfo, "%d mortals.\n", (int)mortals.size ()); 258 object *specimen = is_a<object> (mortals [rndm (mortals.size ())]);
259
260 LOG (llevInfo, "%d mortals (random specimen: %s).\n",
261 (int)mortals.size (), specimen ? specimen->debug_desc () : "(not an object)");
258 262
259 if (0) 263 if (0)
260 { 264 {
261 for (int j = 0; j < mortals.size (); ++j)//D 265 for (int j = 0; j < mortals.size (); ++j)//D
262 fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D 266 fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D
621 STRLEN len; 625 STRLEN len;
622 char *data = SvPVbyte (sv, len); 626 char *data = SvPVbyte (sv, len);
623 v.assign (data, len); 627 v.assign (data, len);
624} 628}
625 629
630static inline void sv_to (SV *sv, refcnt_buf &v)
631{
632 STRLEN len;
633 char *data = SvPVbyte (sv, len);
634 refcnt_buf buf (data, len);
635 v = buf;
636}
637
626static inline void sv_to (SV *sv, UUID &v) 638static inline void sv_to (SV *sv, UUID &v)
627{ 639{
628 if (!v.parse (SvPV_nolen (sv))) 640 if (!v.parse (SvPV_nolen (sv)))
629 croak ("unparsable uuid: %s", SvPV_nolen (sv)); 641 croak ("unparsable uuid: %s", SvPV_nolen (sv));
630} 642}
1403 stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1); 1415 stash_cf_region_wrap = gv_stashpv ("cf::region::wrap", 1);
1404 stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1); 1416 stash_cf_living_wrap = gv_stashpv ("cf::living::wrap", 1);
1405 stash_cf_layout_wrap = gv_stashpv ("cf::layout::wrap", 1); 1417 stash_cf_layout_wrap = gv_stashpv ("cf::layout::wrap", 1);
1406 stash_ext_map_world = gv_stashpv ("ext::map_world" , 1); 1418 stash_ext_map_world = gv_stashpv ("ext::map_world" , 1);
1407 1419
1408 sv_now = get_sv ("cf::NOW" , 1); SvUPGRADE (sv_now , SVt_NV); 1420 sv_now = get_sv ("cf::NOW" , 1); SvUPGRADE (sv_now , SVt_NV);
1409 sv_runtime = get_sv ("cf::RUNTIME" , 1); SvUPGRADE (sv_runtime , SVt_NV); 1421 sv_runtime = get_sv ("cf::RUNTIME" , 1); SvUPGRADE (sv_runtime , SVt_NV);
1422 sv_server_tick = get_sv ("cf::SERVER_TICK", 1); SvUPGRADE (sv_server_tick, SVt_IV);
1410 sv_tick_start = get_sv ("cf::TICK_START", 1); SvUPGRADE (sv_tick_start, SVt_NV); 1423 sv_tick_start = get_sv ("cf::TICK_START" , 1); SvUPGRADE (sv_tick_start , SVt_NV);
1411 sv_next_tick = get_sv ("cf::NEXT_TICK" , 1); SvUPGRADE (sv_next_tick , SVt_NV); 1424 sv_next_tick = get_sv ("cf::NEXT_TICK" , 1); SvUPGRADE (sv_next_tick , SVt_NV);
1412 1425
1413 cb_global = get_av ("cf::CB_GLOBAL", 1); 1426 cb_global = get_av ("cf::CB_GLOBAL", 1);
1414 cb_attachable = get_av ("cf::CB_ATTACHABLE", 1); 1427 cb_attachable = get_av ("cf::CB_ATTACHABLE", 1);
1415 cb_object = get_av ("cf::CB_OBJECT", 1); 1428 cb_object = get_av ("cf::CB_OBJECT", 1);
1416 cb_player = get_av ("cf::CB_PLAYER", 1); 1429 cb_player = get_av ("cf::CB_PLAYER", 1);
1485 const_iv (SAVE_MODE) const_iv (SAVE_DIR_MODE) 1498 const_iv (SAVE_MODE) const_iv (SAVE_DIR_MODE)
1486 1499
1487 const_iv (SK_EXP_ADD_SKILL) const_iv (SK_EXP_TOTAL) const_iv (SK_EXP_NONE) 1500 const_iv (SK_EXP_ADD_SKILL) const_iv (SK_EXP_TOTAL) const_iv (SK_EXP_NONE)
1488 const_iv (SK_SUBTRACT_SKILL_EXP) const_iv (SK_EXP_SKILL_ONLY) 1501 const_iv (SK_SUBTRACT_SKILL_EXP) const_iv (SK_EXP_SKILL_ONLY)
1489 1502
1490 const_iv (MAP_ACTIVE) const_iv (MAP_SWAPPED) const_iv (MAP_LOADING) const_iv (MAP_SAVING)
1491 const_iv (MAP_INACTIVE)
1492
1493 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) 1503 const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT)
1494 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) 1504 const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP)
1495 1505
1496 const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) 1506 const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT)
1497 1507
1529 1539
1530void _gv_clear (SV *gv) 1540void _gv_clear (SV *gv)
1531 CODE: 1541 CODE:
1532 assert (SvTYPE (gv) == SVt_PVGV); 1542 assert (SvTYPE (gv) == SVt_PVGV);
1533# define f(sv) { SV *sv_ = (SV *)(sv); sv = 0; SvREFCNT_dec (sv_); } 1543# define f(sv) { SV *sv_ = (SV *)(sv); sv = 0; SvREFCNT_dec (sv_); }
1544 SvREFCNT_inc (gv);
1534 f (GvGP (gv)->gp_form); 1545 f (GvGP (gv)->gp_form);
1535 f (GvGP (gv)->gp_io); 1546 f (GvGP (gv)->gp_io);
1536 f (GvGP (gv)->gp_sv); 1547 f (GvGP (gv)->gp_sv);
1537 f (GvGP (gv)->gp_av); 1548 f (GvGP (gv)->gp_av);
1538 f (GvGP (gv)->gp_hv); 1549 f (GvGP (gv)->gp_hv);
1539 f (GvGP (gv)->gp_cv); 1550 f (GvGP (gv)->gp_cv);
1540 GvCVGEN (gv) = 0; 1551 GvCVGEN (gv) = 0;
1541 GvMULTI_off (gv); 1552 GvMULTI_off (gv);
1553 SvREFCNT_dec (gv);
1542# undef f 1554# undef f
1543 1555
1544void _connect_to_perl_1 () 1556void _connect_to_perl_1 ()
1545 1557
1546void _connect_to_perl_2 () 1558void _connect_to_perl_2 ()
1612 { 1624 {
1613 ev_async_send (EV_DEFAULT, &tick_watcher); 1625 ev_async_send (EV_DEFAULT, &tick_watcher);
1614 coroapi::cede (); 1626 coroapi::cede ();
1615 } 1627 }
1616 1628
1617void server_tick () 1629void one_tick ()
1618 CODE: 1630 CODE:
1619{ 1631{
1620 ev_now_update (EV_DEFAULT); 1632 ev_now_update (EV_DEFAULT);
1621 NOW = ev_now (EV_DEFAULT); 1633 NOW = ev_now (EV_DEFAULT);
1622 SvNV_set (sv_now, NOW); SvNOK_only (sv_now); 1634 SvNV_set (sv_now, NOW); SvNOK_only (sv_now);
1623 SvNV_set (sv_tick_start, NOW); SvNOK_only (sv_tick_start); 1635 SvNV_set (sv_tick_start, NOW); SvNOK_only (sv_tick_start);
1624 runtime = SvNVX (sv_runtime); 1636 runtime = SvNVX (sv_runtime);
1625 1637
1638 one_tick ();
1639
1626 server_tick (); 1640 ++server_tick;
1641 SvUV_set (sv_server_tick, server_tick); SvIOK_only_UV (sv_server_tick);
1627 1642
1628 ev_now_update (EV_DEFAULT); 1643 ev_now_update (EV_DEFAULT);
1629 NOW = ev_now (EV_DEFAULT); 1644 NOW = ev_now (EV_DEFAULT);
1630 SvNV_set (sv_now, NOW); SvNOK_only (sv_now); 1645 SvNV_set (sv_now, NOW); SvNOK_only (sv_now);
1646
1631 runtime += TICK; 1647 runtime += TICK;
1632 SvNV_set (sv_runtime, runtime); SvNOK_only (sv_runtime); 1648 SvNV_set (sv_runtime, runtime); SvNOK_only (sv_runtime);
1633} 1649}
1634 1650
1635NV floor (NV x) 1651NV floor (NV x)
2102# dumb kludgy misdesigned plug-in api slowly gets on my nerves. 2118# dumb kludgy misdesigned plug-in api slowly gets on my nerves.
2103 2119
2104object *new (utf8_string archetype = 0) 2120object *new (utf8_string archetype = 0)
2105 PROTOTYPE: ;$ 2121 PROTOTYPE: ;$
2106 CODE: 2122 CODE:
2107 RETVAL = archetype ? get_archetype (archetype) : object::create (); 2123 RETVAL = archetype
2124 ? archetype::get (archetype)
2125 : object::create ();
2108 OUTPUT: 2126 OUTPUT:
2109 RETVAL 2127 RETVAL
2110 2128
2111object *generate (utf8_string arch, object *creator) 2129object *generate (utf8_string arch, object *creator)
2112 CODE: 2130 CODE:
2113 object *obj = get_archetype (arch); 2131 object *obj = archetype::get (arch);
2114 fix_generated_item (obj, creator, 0, 0, GT_MINIMAL); 2132 fix_generated_item (obj, creator, 0, 0, GT_MINIMAL);
2115 RETVAL = obj; 2133 RETVAL = obj;
2116 OUTPUT: 2134 OUTPUT:
2117 RETVAL 2135 RETVAL
2118 2136
2128 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y); 2146 RETVAL = insert_ob_in_map_at (ob, where, orig, flag, x, y);
2129 2147
2130 if (RETVAL->destroyed ()) 2148 if (RETVAL->destroyed ())
2131 RETVAL = 0; 2149 RETVAL = 0;
2132} 2150}
2151 OUTPUT:
2152 RETVAL
2133 2153
2134shstr 2154shstr
2135object::kv_get (shstr key) 2155object::kv_get (shstr key)
2156 CODE:
2157 RETVAL = THIS->kv.get (key);
2158 OUTPUT:
2159 RETVAL
2136 2160
2137void 2161void
2138object::kv_del (shstr key) 2162object::kv_del (shstr key)
2163 CODE:
2164 THIS->kv.del (key);
2139 2165
2140void 2166void
2141object::kv_set (shstr key, shstr value) 2167object::kv_set (shstr key, shstr value)
2168 CODE:
2169 THIS->kv.set (key, value);
2142 2170
2143object *get_nearest_player (object *ob) 2171object *get_nearest_player (object *ob)
2144 ALIAS: nearest_player = 0 2172 ALIAS: nearest_player = 0
2145 PREINIT: 2173 PREINIT:
2146 extern object *get_nearest_player (object *); 2174 extern object *get_nearest_player (object *);
2349 if (pl->ob && pl->ob->map == THIS) 2377 if (pl->ob && pl->ob->map == THIS)
2350 PUSHs (sv_2mortal (to_sv (pl->ob))); 2378 PUSHs (sv_2mortal (to_sv (pl->ob)));
2351 } 2379 }
2352 2380
2353void 2381void
2382maptile::gen_quadmap (int x, int y, int z)
2383 CODE:
2384 gen_quadmap (THIS, x * 50, y * 50, z);
2385
2386void
2354maptile::add_underlay (SV *data, int offset, int stride, SV *palette) 2387maptile::add_underlay (SV *data, int offset, int stride, SV *palette)
2355 CODE: 2388 CODE:
2356{ 2389{
2357 if (!SvROK (palette) || SvTYPE (SvRV (palette)) != SVt_PVAV) 2390 if (!SvROK (palette) || SvTYPE (SvRV (palette)) != SVt_PVAV)
2358 croak ("maptile::add_underlay: palette must be arrayref"); 2391 croak ("maptile::add_underlay: palette must be arrayref");
2374 2407
2375 if (IN_RANGE_EXC (offs, 0, idxlen)) 2408 if (IN_RANGE_EXC (offs, 0, idxlen))
2376 { 2409 {
2377 if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) 2410 if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0))
2378 { 2411 {
2379 object *ob = get_archetype (cfSvPVutf8_nolen (*elem)); 2412 object *ob = archetype::get (cfSvPVutf8_nolen (*elem));
2380 ob->flag [FLAG_NO_MAP_SAVE] = true; 2413 ob->flag [FLAG_NO_MAP_SAVE] = true;
2381 THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); 2414 THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY);
2382 2415
2383 if (ob->randomitems && !ob->above) 2416 if (ob->randomitems && !ob->above)
2384 { 2417 {
2388 op->flag [FLAG_NO_MAP_SAVE] = true; 2421 op->flag [FLAG_NO_MAP_SAVE] = true;
2389 // TODO: if this is a pickable object, then the item 2422 // TODO: if this is a pickable object, then the item
2390 // will at a bit weird - saving inside the player 2423 // will at a bit weird - saving inside the player
2391 // will clear the flag, but when the player drops 2424 // will clear the flag, but when the player drops
2392 // it without logging out, it keeps the flag. 2425 // it without logging out, it keeps the flag.
2393 // nobody ahs reported this, but this can be rather 2426 // nobody has reported this, but this can be rather
2394 // annoying on persistent maps. 2427 // annoying on persistent maps.
2395 } 2428 }
2396 } 2429 }
2397 } 2430 }
2398 } 2431 }
2399
2400 skip: ; 2432 skip: ;
2401 } 2433 }
2402} 2434}
2403 2435
2404void 2436void
2606 PPCODE: 2638 PPCODE:
2607 EXTEND (SP, clients.size ()); 2639 EXTEND (SP, clients.size ());
2608 for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) 2640 for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i)
2609 PUSHs (sv_2mortal (to_sv (*i))); 2641 PUSHs (sv_2mortal (to_sv (*i)));
2610 2642
2643STRLEN
2644client::inbuf_append (SV *data)
2645 CODE:
2646{
2647 STRLEN len;
2648 char *ptr = SvPVbyte (data, len);
2649
2650 min_it (len, sizeof (THIS->inbuf) - THIS->inbuf_len);
2651 memcpy (THIS->inbuf + THIS->inbuf_len, ptr, len);
2652 THIS->inbuf_len += len;
2653
2654 THIS->inbuf_handle ();
2655
2656 RETVAL = len;
2657}
2658 OUTPUT: RETVAL
2659
2611void 2660void
2612client::send_packet (SV *packet) 2661client::send_packet (SV *packet)
2613 CODE: 2662 CODE:
2614{ 2663{
2615 STRLEN len; 2664 STRLEN len;
2670faceidx face_find (utf8_string name, faceidx defidx = 0) 2719faceidx face_find (utf8_string name, faceidx defidx = 0)
2671 2720
2672faceidx alloc (utf8_string name) 2721faceidx alloc (utf8_string name)
2673 CODE: 2722 CODE:
2674{ 2723{
2675 do 2724 RETVAL = face_alloc ();
2676 {
2677 RETVAL = faces.size ();
2678 faces.resize (RETVAL + 1);
2679 }
2680 while (!RETVAL); // crude way to leave index 0
2681 2725
2682 faces [RETVAL].name = name; 2726 faces [RETVAL].name = name;
2683 facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); 2727 facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL));
2684 2728
2685 if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL; 2729 if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL;
2686 if (!strcmp (name, EMPTY_FACE_NAME )) empty_face = RETVAL; 2730 if (!strcmp (name, EMPTY_FACE_NAME )) empty_face = RETVAL;
2687 if (!strcmp (name, MAGICMOUTH_FACE_NAME)) magicmouth_face = RETVAL; 2731 if (!strcmp (name, MAGICMOUTH_FACE_NAME)) magicmouth_face = RETVAL;
2688} 2732}
2733 OUTPUT: RETVAL
2734
2735faceidx faces_size ()
2736 CODE:
2737 RETVAL = faces.size ();
2689 OUTPUT: RETVAL 2738 OUTPUT: RETVAL
2690 2739
2691void set_type (faceidx idx, int value) 2740void set_type (faceidx idx, int value)
2692 ALIAS: 2741 ALIAS:
2693 set_type = 0 2742 set_type = 0
2739 if (!d) XSRETURN_UNDEF; 2788 if (!d) XSRETURN_UNDEF;
2740 RETVAL = d->data.size (); 2789 RETVAL = d->data.size ();
2741 OUTPUT: 2790 OUTPUT:
2742 RETVAL 2791 RETVAL
2743 2792
2793void set_meta (faceidx idx, SV *sv)
2794 CODE:
2795{
2796 faceinfo *f = face_info (idx); assert (f);
2797 SvREFCNT_dec (f->meta_hv);
2798 f->meta_hv = SvOK (sv) ? (HV *)SvREFCNT_inc (SvRV (sv)) : 0;
2799}
2800
2744SV *get_chksum (faceidx idx, int faceset = 0) 2801SV *get_chksum (faceidx idx, int faceset = 0)
2745 CODE: 2802 CODE:
2746 facedata *d = face_data (idx, faceset); 2803 facedata *d = face_data (idx, faceset);
2747 if (!d) XSRETURN_UNDEF; 2804 if (!d) XSRETURN_UNDEF;
2748 RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len); 2805 RETVAL = newSVpvn ((char *)d->chksum, d->chksum_len);
2749 OUTPUT: 2806 OUTPUT:
2750 RETVAL 2807 RETVAL
2751 2808
2809int get_type (faceidx idx)
2810 CODE:
2811 faceinfo *f = face_info (idx);
2812 if (!f) XSRETURN_UNDEF;
2813 RETVAL = f->type;
2814 OUTPUT:
2815 RETVAL
2816
2752SV *get_data (faceidx idx, int faceset = 0) 2817SV *get_data (faceidx idx, int faceset = 0)
2753 CODE: 2818 CODE:
2754 facedata *d = face_data (idx, faceset); 2819 facedata *d = face_data (idx, faceset);
2755 if (!d) XSRETURN_UNDEF; 2820 if (!d) XSRETURN_UNDEF;
2756 RETVAL = newSVpvn (d->data.data (), d->data.length ()); 2821 RETVAL = newSVpvn (d->data, d->data.size ());
2757 OUTPUT: 2822 OUTPUT:
2758 RETVAL 2823 RETVAL
2759 2824
2825SV *get_meta (faceidx idx)
2826 CODE:
2827 faceinfo *f = face_info (idx); assert (f);
2828 if (!f || !f->meta_hv) XSRETURN_UNDEF;
2829 RETVAL = newRV_inc ((SV *)f->meta_hv);
2830 OUTPUT:
2831 RETVAL
2832
2760void invalidate (faceidx idx) 2833void invalidate (faceidx idx)
2761 CODE: 2834 CODE:
2762 for_all_clients (ns) 2835 for_all_clients (ns)
2763 { 2836 ns->invalidate_face (idx);
2764 ns->faces_sent [idx] = false;
2765 ns->force_newmap = true;
2766 }
2767 2837
2768void invalidate_all () 2838void invalidate_all ()
2769 CODE: 2839 CODE:
2770 for_all_clients (ns) 2840 for_all_clients (ns)
2771 { 2841 ns->invalidate_all_faces ();
2772 ns->faces_sent.reset ();
2773 ns->force_newmap = true;
2774 }
2775 2842
2776MODULE = cf PACKAGE = cf::anim PREFIX = anim_ 2843MODULE = cf PACKAGE = cf::anim PREFIX = anim_
2777 2844
2778#INCLUDE: $PERL $srcdir/genacc faceset $srcdir/../include/anim.h | 2845#INCLUDE: $PERL $srcdir/genacc faceset $srcdir/../include/anim.h |
2779 2846
2783 OUTPUT: RETVAL 2850 OUTPUT: RETVAL
2784 2851
2785animidx set (utf8_string name, SV *frames, int facings = 1) 2852animidx set (utf8_string name, SV *frames, int facings = 1)
2786 CODE: 2853 CODE:
2787{ 2854{
2788 if (!SvROK (frames) && SvTYPE (SvRV (frames)) != SVt_PVAV) 2855 if (!SvROK (frames) && SvTYPE (SvRV (frames)) != SVt_PVAV)
2789 croak ("frames must be an arrayref"); 2856 croak ("frames must be an arrayref");
2790 2857
2791 AV *av = (AV *)SvRV (frames); 2858 AV *av = (AV *)SvRV (frames);
2792 2859
2793 animation *anim = &animation::find (name); 2860 animation *anim = &animation::find (name);
2794 if (anim->number) 2861 if (anim->number)
2795 { 2862 {
2796 anim->resize (av_len (av) + 1); 2863 anim->resize (av_len (av) + 1);
2797 anim->facings = facings; 2864 anim->facings = facings;
2798 } 2865 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines