1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
3 | * |
3 | * |
4 | * This code is placed under the GNU General Public Licence (GPL) |
4 | * Copyright (©) 2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | * |
|
|
6 | * Copyright (C) 2001-2005 by Chachkoff Yann |
5 | * Copyright (©) 2001-2005,2007 by Chachkoff Yann |
7 | * Copyright (C) 2006,2007 by Marc Lehmann <cf@schmorp.de> |
6 | * Copyright (©) 2006,2007 by Marc Lehmann <cf@schmorp.de> |
8 | * |
7 | * |
9 | * This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
12 | * (at your option) any later version. |
11 | * (at your option) any later version. |
13 | * |
12 | * |
14 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
18 | * |
17 | * |
19 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 | * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | * |
|
|
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include "autoconf.h" |
24 | #include "autoconf.h" |
25 | |
25 | |
26 | #define PLUGIN_NAME "perl" |
26 | #define PLUGIN_NAME "perl" |
… | |
… | |
74 | # define newSVval64 newSVnv |
74 | # define newSVval64 newSVnv |
75 | # define SvVAL64 SvNV |
75 | # define SvVAL64 SvNV |
76 | #endif |
76 | #endif |
77 | |
77 | |
78 | static f_plug_api gethook = cfapi_get_hooks; |
78 | static f_plug_api gethook = cfapi_get_hooks; |
79 | static f_plug_api object_set_property = cfapi_object_set_property; |
|
|
80 | static f_plug_api object_insert = cfapi_object_insert; |
79 | static f_plug_api object_insert = cfapi_object_insert; |
81 | |
80 | |
82 | static PerlInterpreter *perl; |
81 | static PerlInterpreter *perl; |
83 | |
82 | |
84 | double runtime; |
83 | tstamp NOW, runtime; |
85 | |
84 | |
86 | global gbl_ev; |
85 | global gbl_ev; |
87 | static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; |
86 | static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; |
88 | static SV *sv_runtime, *sv_next_tick; |
87 | static SV *sv_runtime, *sv_next_tick; |
89 | |
88 | |
… | |
… | |
201 | { |
200 | { |
202 | if (i >= mortals.size ()) |
201 | if (i >= mortals.size ()) |
203 | { |
202 | { |
204 | i = 0; |
203 | i = 0; |
205 | |
204 | |
206 | if (mortals.size () > 1000) |
205 | if (mortals.size () >= 512) |
|
|
206 | { |
|
|
207 | static int last_mortalcount; |
|
|
208 | if (mortals.size () != last_mortalcount) |
|
|
209 | { |
|
|
210 | last_mortalcount = mortals.size (); |
207 | LOG (llevInfo, "mortal queue size (%d) exceeds 1000.\n", (int)mortals.size ()); |
211 | LOG (llevInfo, "%d mortals.\n", (int)mortals.size ()); |
|
|
212 | |
|
|
213 | if (0) |
|
|
214 | { |
|
|
215 | for (int j = 0; j < mortals.size (); ++j)//D |
|
|
216 | fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D |
|
|
217 | fprintf (stderr, "\n");//D |
|
|
218 | } |
|
|
219 | } |
|
|
220 | } |
208 | |
221 | |
209 | break; |
222 | break; |
210 | } |
223 | } |
211 | |
224 | |
212 | attachable *obj = mortals [i]; |
225 | attachable *obj = mortals [i]; |
… | |
… | |
243 | |
256 | |
244 | attach = src.attach; |
257 | attach = src.attach; |
245 | return *this; |
258 | return *this; |
246 | } |
259 | } |
247 | |
260 | |
|
|
261 | template<typename T> |
|
|
262 | static bool |
|
|
263 | find_backref (void *ptr, T *obj) |
|
|
264 | { |
|
|
265 | char *s = (char *)obj; |
|
|
266 | while (s < (char *)obj + sizeof (T)) |
|
|
267 | { |
|
|
268 | if (ptr == *(void **)s) |
|
|
269 | return true; |
|
|
270 | |
|
|
271 | s += sizeof (void *); // assume natural alignment |
|
|
272 | } |
|
|
273 | |
|
|
274 | return false; |
|
|
275 | } |
|
|
276 | |
|
|
277 | // for debugging, find "live" objects containing this ptr |
|
|
278 | void |
|
|
279 | find_backref (void *ptr) |
|
|
280 | { |
|
|
281 | for_all_objects (op) |
|
|
282 | if (find_backref (ptr, op)) |
|
|
283 | fprintf (stderr, "O %p %d:'%s'\n", op, op->count, &op->name); |
|
|
284 | |
|
|
285 | for_all_players (pl) |
|
|
286 | if (find_backref (ptr, pl)) |
|
|
287 | fprintf (stderr, "P %p\n", pl); |
|
|
288 | |
|
|
289 | for_all_clients (ns) |
|
|
290 | if (find_backref (ptr, ns)) |
|
|
291 | fprintf (stderr, "C %p\n", ns); |
|
|
292 | |
|
|
293 | } |
|
|
294 | |
248 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
295 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
249 | |
296 | |
250 | static SV * |
297 | static SV * |
251 | newSVptr (void *ptr, HV *stash, HV *hv = newHV ()) |
298 | newSVptr (void *ptr, HV *stash, HV *hv = newHV ()) |
252 | { |
299 | { |
… | |
… | |
334 | return SvPTR (sv, klass); |
381 | return SvPTR (sv, klass); |
335 | else |
382 | else |
336 | return 0; |
383 | return 0; |
337 | } |
384 | } |
338 | |
385 | |
|
|
386 | static inline SV * |
|
|
387 | newSVpv_utf8 (const char *s) |
|
|
388 | { |
|
|
389 | SV *sv = newSVpv (s, 0); |
|
|
390 | SvUTF8_on (sv); |
|
|
391 | return sv; |
|
|
392 | } |
|
|
393 | |
|
|
394 | static inline SV * |
|
|
395 | newSVpvn_utf8 (const char *s, STRLEN l) |
|
|
396 | { |
|
|
397 | SV *sv = newSVpvn (s, l); |
|
|
398 | SvUTF8_on (sv); |
|
|
399 | return sv; |
|
|
400 | } |
|
|
401 | |
339 | inline SV *to_sv (const shstr & v) { return v ? newSVpvn ((const char *)v, v.length ()) : &PL_sv_undef; } |
402 | inline SV *to_sv (const shstr & v) { return v ? newSVpvn_utf8 ((const char *)v, v.length ()) : &PL_sv_undef; } |
340 | inline SV *to_sv (const char * v) { return newSVpv (v, 0); } |
403 | inline SV *to_sv (const char * v) { return newSVpv (v, 0); } |
341 | inline SV *to_sv (bool v) { return newSViv (v); } |
404 | inline SV *to_sv (bool v) { return newSViv (v); } |
342 | inline SV *to_sv ( signed char v) { return newSViv (v); } |
405 | inline SV *to_sv ( signed char v) { return newSViv (v); } |
343 | inline SV *to_sv (unsigned char v) { return newSViv (v); } |
406 | inline SV *to_sv (unsigned char v) { return newSViv (v); } |
344 | inline SV *to_sv ( signed short v) { return newSViv (v); } |
407 | inline SV *to_sv ( signed short v) { return newSViv (v); } |
… | |
… | |
371 | char buf[128]; |
434 | char buf[128]; |
372 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
435 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
373 | return newSVpv (buf, 0); |
436 | return newSVpv (buf, 0); |
374 | } |
437 | } |
375 | |
438 | |
376 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } |
439 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPVutf8_nolen (sv) : 0; } |
377 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
440 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
378 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
441 | inline void sv_to (SV *sv, bool &v) { v = SvIV (sv); } |
379 | inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } |
442 | inline void sv_to (SV *sv, signed char &v) { v = SvIV (sv); } |
380 | inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); } |
443 | inline void sv_to (SV *sv, unsigned char &v) { v = SvIV (sv); } |
381 | inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); } |
444 | inline void sv_to (SV *sv, signed short &v) { v = SvIV (sv); } |
… | |
… | |
938 | CALL_ARG (level); |
1001 | CALL_ARG (level); |
939 | CALL_CALL ("ext::books::make_book", G_VOID); |
1002 | CALL_CALL ("ext::books::make_book", G_VOID); |
940 | CALL_END; |
1003 | CALL_END; |
941 | } |
1004 | } |
942 | |
1005 | |
|
|
1006 | void |
|
|
1007 | cfperl_send_msg (client *ns, int color, const char *type, const char *msg) |
|
|
1008 | { |
|
|
1009 | CALL_BEGIN (4); |
|
|
1010 | CALL_ARG (ns); |
|
|
1011 | CALL_ARG (color); |
|
|
1012 | CALL_ARG (type); |
|
|
1013 | CALL_ARG_SV (newSVpv_utf8 (msg)); |
|
|
1014 | CALL_CALL ("cf::client::send_msg", G_VOID); |
|
|
1015 | CALL_END; |
|
|
1016 | } |
|
|
1017 | |
943 | maptile * |
1018 | maptile * |
944 | maptile::find_sync (const char *path, maptile *origin) |
1019 | maptile::find_sync (const char *path, maptile *origin) |
945 | { |
1020 | { |
946 | CALL_BEGIN (2); |
1021 | CALL_BEGIN (2); |
947 | CALL_ARG (path); |
1022 | CALL_ARG (path); |
… | |
… | |
1031 | |
1106 | |
1032 | struct EventAPI *watcher_base::GEventAPI; |
1107 | struct EventAPI *watcher_base::GEventAPI; |
1033 | struct CoroAPI *coroapi::GCoroAPI; |
1108 | struct CoroAPI *coroapi::GCoroAPI; |
1034 | |
1109 | |
1035 | int coroapi::cede_counter; |
1110 | int coroapi::cede_counter; |
1036 | double (*coroapi::time)(); |
|
|
1037 | double coroapi::next_cede; |
1111 | tstamp coroapi::next_cede; |
1038 | |
1112 | |
1039 | void coroapi::do_cede_to_tick () |
1113 | void coroapi::do_cede_to_tick () |
1040 | { |
1114 | { |
1041 | cede_counter = 0; |
1115 | cede_counter = 0; |
1042 | |
1116 | |
… | |
… | |
1173 | |
1247 | |
1174 | _connect_to_perl (); |
1248 | _connect_to_perl (); |
1175 | |
1249 | |
1176 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1250 | newCONSTSUB (stash_cf, "VERSION", newSVpv (VERSION, sizeof (VERSION) - 1)); |
1177 | |
1251 | |
1178 | { |
1252 | //{ |
1179 | require_pv ("Time::HiRes"); |
1253 | // require_pv ("Time::HiRes"); |
1180 | |
1254 | // |
1181 | SV **svp = hv_fetch (PL_modglobal, "Time::NVtime", 12, 0); |
1255 | // SV **svp = hv_fetch (PL_modglobal, "Time::NVtime", 12, 0); |
1182 | if (!svp) croak ("Time::HiRes is required"); |
1256 | // if (!svp) croak ("Time::HiRes is required"); |
1183 | if (!SvIOK(*svp)) croak ("Time::NVtime isn’t a function pointer"); |
1257 | // if (!SvIOK(*svp)) croak ("Time::NVtime isn’t a function pointer"); |
1184 | coroapi::time = INT2PTR (double(*)(), SvIV(*svp)); |
1258 | // coroapi::time = INT2PTR (double(*)(), SvIV(*svp)); |
1185 | } |
1259 | //} |
1186 | |
1260 | |
1187 | static const struct { |
1261 | static const struct { |
1188 | const char *name; |
1262 | const char *name; |
1189 | IV iv; |
1263 | IV iv; |
1190 | } *civ, const_iv[] = { |
1264 | } *civ, const_iv[] = { |
… | |
… | |
1540 | CODE: |
1614 | CODE: |
1541 | coroapi::cede_to_tick (); |
1615 | coroapi::cede_to_tick (); |
1542 | |
1616 | |
1543 | void server_tick () |
1617 | void server_tick () |
1544 | CODE: |
1618 | CODE: |
|
|
1619 | NOW = now (); |
1545 | runtime = SvNVx (sv_runtime); |
1620 | runtime = SvNVx (sv_runtime); |
1546 | server_tick (); |
1621 | server_tick (); |
1547 | |
1622 | |
1548 | void |
1623 | void |
1549 | log_backtrace (utf8_string msg) |
1624 | log_backtrace (utf8_string msg) |
… | |
… | |
1741 | object *actives (U32 index) |
1816 | object *actives (U32 index) |
1742 | CODE: |
1817 | CODE: |
1743 | RETVAL = index < actives.size () ? actives [index] : 0; |
1818 | RETVAL = index < actives.size () ? actives [index] : 0; |
1744 | OUTPUT: RETVAL |
1819 | OUTPUT: RETVAL |
1745 | |
1820 | |
1746 | const char *slot_save_name (U32 slot) |
1821 | const char *slot_use_name (U32 slot) |
1747 | ALIAS: |
1822 | ALIAS: |
1748 | slot_use_name = 1 |
|
|
1749 | slot_nonuse_name = 2 |
1823 | slot_nonuse_name = 1 |
1750 | CODE: |
1824 | CODE: |
1751 | { |
1825 | { |
1752 | if (slot >= NUM_BODY_LOCATIONS) |
1826 | if (slot >= NUM_BODY_LOCATIONS) |
1753 | croak ("body slot index out of range"); |
1827 | croak ("body slot index out of range"); |
1754 | |
1828 | |
1755 | switch (ix) |
1829 | switch (ix) |
1756 | { |
1830 | { |
1757 | case 0: RETVAL = body_locations[slot].save_name; break; |
|
|
1758 | case 1: RETVAL = body_locations[slot].use_name; break; |
1831 | case 0: RETVAL = body_locations[slot].use_name; break; |
1759 | case 2: RETVAL = body_locations[slot].nonuse_name; break; |
1832 | case 1: RETVAL = body_locations[slot].nonuse_name; break; |
1760 | } |
1833 | } |
1761 | } |
1834 | } |
1762 | OUTPUT: |
1835 | OUTPUT: |
1763 | RETVAL |
1836 | RETVAL |
1764 | |
1837 | |
… | |
… | |
1766 | |
1839 | |
1767 | object *head (object *op) |
1840 | object *head (object *op) |
1768 | PROTOTYPE: $ |
1841 | PROTOTYPE: $ |
1769 | CODE: |
1842 | CODE: |
1770 | RETVAL = op->head_ (); |
1843 | RETVAL = op->head_ (); |
1771 | OUTPUT: RETVAL |
|
|
1772 | |
|
|
1773 | int is_head (object *op) |
|
|
1774 | PROTOTYPE: $ |
|
|
1775 | CODE: |
|
|
1776 | RETVAL = op->head_ () == op; |
|
|
1777 | OUTPUT: RETVAL |
1844 | OUTPUT: RETVAL |
1778 | |
1845 | |
1779 | void |
1846 | void |
1780 | inv (object *obj) |
1847 | inv (object *obj) |
1781 | PROTOTYPE: $ |
1848 | PROTOTYPE: $ |
… | |
… | |
1938 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
2005 | # dumb kludgy misdesigned plug-in api slowly gets on my nerves. |
1939 | |
2006 | |
1940 | object *new (utf8_string archetype = 0) |
2007 | object *new (utf8_string archetype = 0) |
1941 | PROTOTYPE: ;$ |
2008 | PROTOTYPE: ;$ |
1942 | CODE: |
2009 | CODE: |
1943 | RETVAL = archetype ? get_archetype (archetype) : cf_create_object (); |
2010 | RETVAL = archetype ? get_archetype (archetype) : object::create (); |
1944 | OUTPUT: |
2011 | OUTPUT: |
1945 | RETVAL |
2012 | RETVAL |
1946 | |
2013 | |
|
|
2014 | object *find_object (U32 tag) |
|
|
2015 | |
|
|
2016 | # TODO: nuke |
1947 | object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y) |
2017 | object *insert_ob_in_map_at (object *ob, maptile *where, object_ornull *orig, int flag, int x, int y) |
1948 | PROTOTYPE: $$$$$$ |
2018 | PROTOTYPE: $$$$$$ |
1949 | CODE: |
2019 | CODE: |
1950 | { |
2020 | { |
1951 | int unused_type; |
2021 | int unused_type; |
1952 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
2022 | RETVAL = (object *)object_insert (&unused_type, ob, 0, where, orig, flag, x, y); |
1953 | } |
2023 | } |
1954 | |
|
|
1955 | player *contr (object *op) |
|
|
1956 | CODE: |
|
|
1957 | RETVAL = op->contr; |
|
|
1958 | OUTPUT: RETVAL |
|
|
1959 | |
2024 | |
1960 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
2025 | const_utf8_string get_ob_key_value (object *op, utf8_string key) |
1961 | |
2026 | |
1962 | bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) |
2027 | bool set_ob_key_value (object *op, utf8_string key, utf8_string value = 0, int add_key = 1) |
1963 | |
2028 | |
… | |
… | |
2009 | void kill_player (object *op) |
2074 | void kill_player (object *op) |
2010 | |
2075 | |
2011 | void esrv_update_item (object *op, int what, object *item) |
2076 | void esrv_update_item (object *op, int what, object *item) |
2012 | C_ARGS: what, op, item |
2077 | C_ARGS: what, op, item |
2013 | |
2078 | |
2014 | void clear_los (object *op) |
|
|
2015 | |
|
|
2016 | int command_summon (object *op, utf8_string params) |
2079 | int command_summon (object *op, utf8_string params) |
2017 | |
2080 | |
2018 | int command_arrest (object *op, utf8_string params) |
2081 | int command_arrest (object *op, utf8_string params) |
2019 | |
2082 | |
2020 | |
2083 | |
… | |
… | |
2037 | CODE: |
2100 | CODE: |
2038 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
2101 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
2039 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
2102 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
2040 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
2103 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
2041 | pl->orig_stats = pl->ob->stats; |
2104 | pl->orig_stats = pl->ob->stats; |
|
|
2105 | |
|
|
2106 | void clear_los (player *pl) |
2042 | |
2107 | |
2043 | void cf_player_move (player *pl, int dir) |
2108 | void cf_player_move (player *pl, int dir) |
2044 | |
2109 | |
2045 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
2110 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
2046 | |
2111 | |
… | |
… | |
2418 | CODE: |
2483 | CODE: |
2419 | RETVAL = archetype::find (name); |
2484 | RETVAL = archetype::find (name); |
2420 | OUTPUT: |
2485 | OUTPUT: |
2421 | RETVAL |
2486 | RETVAL |
2422 | |
2487 | |
2423 | archetype *first() |
2488 | int archetypes_size () |
2424 | PROTOTYPE: |
2489 | CODE: |
2425 | CODE: |
|
|
2426 | RETVAL = first_archetype; |
2490 | RETVAL = archetypes.size (); |
2427 | OUTPUT: RETVAL |
2491 | OUTPUT: RETVAL |
|
|
2492 | |
|
|
2493 | archetype *archetypes (U32 index) |
|
|
2494 | CODE: |
|
|
2495 | RETVAL = index < archetypes.size () ? archetypes [index] : 0; |
|
|
2496 | OUTPUT: RETVAL |
2428 | |
2497 | |
2429 | object *instantiate (archetype *arch) |
2498 | object *instantiate (archetype *arch) |
2430 | CODE: |
2499 | CODE: |
2431 | RETVAL = arch_to_object (arch); |
2500 | RETVAL = arch_to_object (arch); |
2432 | OUTPUT: |
2501 | OUTPUT: |
… | |
… | |
2534 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2603 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2535 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2604 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2536 | } |
2605 | } |
2537 | OUTPUT: RETVAL |
2606 | OUTPUT: RETVAL |
2538 | |
2607 | |
2539 | void set (faceidx idx, int visibility, int magicmap) |
2608 | void set_type (faceidx idx, int value) |
|
|
2609 | ALIAS: |
|
|
2610 | set_type = 0 |
|
|
2611 | set_visibility = 1 |
|
|
2612 | set_magicmap = 2 |
|
|
2613 | set_smooth = 3 |
|
|
2614 | set_smoothlevel = 4 |
2540 | CODE: |
2615 | CODE: |
2541 | faceinfo *f = face_info (idx); |
2616 | faceinfo *f = face_info (idx); |
2542 | assert (f); |
2617 | assert (f); |
2543 | f->visibility = visibility; |
2618 | switch (ix) |
2544 | f->magicmap = magicmap; |
2619 | { |
2545 | |
2620 | case 0: f->type = value; break; |
2546 | void set_smooth (faceidx idx, faceidx smooth, int smoothlevel) |
2621 | case 1: f->visibility = value; break; |
2547 | CODE: |
2622 | case 2: f->magicmap = value; break; |
2548 | faceinfo *f = face_info (idx); assert (f); |
2623 | case 3: f->smooth = value; break; |
2549 | f->smooth = smooth; |
2624 | case 4: f->smoothlevel = value; break; |
2550 | f->smoothlevel = smoothlevel; |
2625 | } |
2551 | |
2626 | |
2552 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2627 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2553 | CODE: |
2628 | CODE: |
2554 | { |
2629 | { |
2555 | facedata *d = face_data (idx, faceset); |
2630 | facedata *d = face_data (idx, faceset); |