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.197 by root, Fri Apr 27 03:38:33 2007 UTC vs.
Revision 1.213 by root, Thu May 24 03:33:29 2007 UTC

1/*****************************************************************************/
2/* CrossFire, A Multiplayer game for the X Window System */
3/*****************************************************************************/
4
5/* 1/*
2 * CrossFire, A Multiplayer game
3 *
6 * This code is placed under the GNU General Public Licence (GPL) 4 * This code is placed under the GNU General Public Licence (GPL)
7 * 5 *
8 * Copyright (C) 2001-2005 by Chachkoff Yann 6 * Copyright (C) 2001-2005 by Chachkoff Yann
9 * Copyright (C) 2006,2007 by Marc Lehmann <cf@schmorp.de> 7 * Copyright (C) 2006,2007 by Marc Lehmann <cf@schmorp.de>
10 * 8 *
21 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
23 * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */ 22 */
25 23
24#include "autoconf.h"
25
26#define PLUGIN_NAME "perl" 26#define PLUGIN_NAME "perl"
27#define PLUGIN_VERSION "cfperl 0.5" 27#define PLUGIN_VERSION "cfperl 0.5"
28 28
29#define CEDES_PER_TICK 5 29#define CEDES_PER_TICK 5
30
31#if HAVE_EXECINFO_H
32# include <execinfo.h>
33#endif
30 34
31#include <plugin_common.h> 35#include <plugin_common.h>
32#include <sounds.h> 36#include <sounds.h>
33#include <cstdarg> 37#include <cstdarg>
34#include <sproto.h> 38#include <sproto.h>
80double runtime; 84double runtime;
81 85
82global gbl_ev; 86global gbl_ev;
83static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map; 87static AV *cb_global, *cb_attachable, *cb_object, *cb_player, *cb_client, *cb_type, *cb_map;
84static SV *sv_runtime, *sv_next_tick; 88static SV *sv_runtime, *sv_next_tick;
89
90bitset<NUM_EVENT_TYPES> ev_want_event;
91bitset<NUM_TYPES> ev_want_type;
85 92
86static HV 93static HV
87 *stash_cf, 94 *stash_cf,
88 *stash_cf_object_wrap, 95 *stash_cf_object_wrap,
89 *stash_cf_object_player_wrap, 96 *stash_cf_object_player_wrap,
180 if (destroyed ()) 187 if (destroyed ())
181 return; 188 return;
182 189
183 flags |= F_DESTROYED; 190 flags |= F_DESTROYED;
184 do_destroy (); 191 do_destroy ();
192 sever_self ();
185} 193}
186 194
187void 195void
188attachable::check_mortals () 196attachable::check_mortals ()
189{ 197{
209 LOG (llevError, "check_mortals: object '%s' still has self\n", typeid (obj).name ()); 217 LOG (llevError, "check_mortals: object '%s' still has self\n", typeid (obj).name ());
210 obj->sever_self (); 218 obj->sever_self ();
211 } 219 }
212#endif 220#endif
213 221
214 if (obj->refcnt_cnt ()) 222 if (obj->refcnt)
215 { 223 {
216 ++i; // further delay freeing 224 ++i; // further delay freeing
217 225
218 if (!(i & 0x3ff)) 226 if (!(i & 0x3ff))
219 break; 227 break;
397inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } 405inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; }
398 406
399template<int N> 407template<int N>
400inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } 408inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); }
401 409
402inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); }
403inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); } 410inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); }
404inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); } 411inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); }
405inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); } 412inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); }
406inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); } 413inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); }
407 414
610 perl_construct (perl); 617 perl_construct (perl);
611 618
612 PL_exit_flags |= PERL_EXIT_DESTRUCT_END; 619 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
613 620
614 const char *argv[] = { 621 const char *argv[] = {
615 "", 622 settings.argv [0],
616 "-e" 623 "-e"
617 "use Event; use Coro;" // required for bootstrap 624 "use Event; use Coro;" // required for bootstrap
618 "cf->bootstrap;" // required for datadir :*> 625 "cf->bootstrap;" // required for datadir :*>
619 "unshift @INC, cf::datadir ();" 626 "unshift @INC, cf::datadir ();"
620 "require cf;" 627 "require cf;"
711} 718}
712 719
713void 720void
714global::gather_callbacks (AV *&callbacks, event_type event) const 721global::gather_callbacks (AV *&callbacks, event_type event) const
715{ 722{
716 ::gather_callbacks (callbacks, cb_object, event); 723 ::gather_callbacks (callbacks, cb_global, event);
717} 724}
718 725
719void 726void
720object::gather_callbacks (AV *&callbacks, event_type event) const 727object::gather_callbacks (AV *&callbacks, event_type event) const
721{ 728{
722 if (subtype && type + subtype * NUM_SUBTYPES <= AvFILLp (cb_type)) 729 if (subtype && type + subtype * NUM_TYPES <= AvFILLp (cb_type))
723 { 730 {
724 SV *registry = AvARRAY (cb_type)[type + subtype * NUM_SUBTYPES]; 731 SV *registry = AvARRAY (cb_type)[type + subtype * NUM_TYPES];
725 732
726 if (registry && SvROK (registry) && SvTYPE (SvRV (registry)) == SVt_PVAV) 733 if (registry && SvROK (registry) && SvTYPE (SvRV (registry)) == SVt_PVAV)
727 ::gather_callbacks (callbacks, (AV *)SvRV (registry), event); 734 ::gather_callbacks (callbacks, (AV *)SvRV (registry), event);
728 } 735 }
729 736
765{ 772{
766 attachable::gather_callbacks (callbacks, event); 773 attachable::gather_callbacks (callbacks, event);
767 ::gather_callbacks (callbacks, cb_map, event); 774 ::gather_callbacks (callbacks, cb_map, event);
768} 775}
769 776
777void
778_recalc_want (bitset<NUM_EVENT_TYPES> &set, AV *registry)
779{
780 for (int event = 0; event <= AvFILLp (registry); ++event)
781 {
782 SV *cbs_ = AvARRAY (registry)[event];
783
784 // element must be list of callback entries
785 if (cbs_ && SvROK (cbs_) && SvTYPE (SvRV (cbs_)) == SVt_PVAV)
786 {
787 AV *cbs = (AV *)SvRV (cbs_);
788
789 // no callback entries, no callbacks to call
790 if (AvFILLp (cbs) >= 0)
791 set.set (event);
792 }
793 }
794}
795
796// very slow and inefficient way to recalculate the global want bitsets
797void
798_recalc_want ()
799{
800 ev_want_event.reset ();
801
802 _recalc_want (ev_want_event, cb_global);
803 _recalc_want (ev_want_event, cb_attachable);
804 _recalc_want (ev_want_event, cb_object);
805 _recalc_want (ev_want_event, cb_client);
806 _recalc_want (ev_want_event, cb_player);
807 _recalc_want (ev_want_event, cb_map);
808
809 ev_want_type.reset ();
810
811 for (int type = 0; type <= AvFILLp (cb_type); ++type)
812 {
813 SV *cbs_ = AvARRAY (cb_type)[type];
814
815 // element must be list of callback entries
816 if (cbs_ && SvROK (cbs_) && SvTYPE (SvRV (cbs_)) == SVt_PVAV)
817 {
818 AV *cbs = (AV *)SvRV (cbs_);
819
820 // no callback entries, no callbacks to call
821 if (AvFILLp (cbs) >= 0)
822 ev_want_type.set (type % NUM_TYPES);
823 }
824 }
825}
826
770bool 827bool
771attachable::invoke (event_type event, ...) 828attachable::vinvoke (event_type event, va_list &ap)
772{ 829{
773 data_type dt; 830 data_type dt;
774 va_list ap;
775
776 va_start (ap, event);
777 831
778 // callback call ordering should be: 832 // callback call ordering should be:
779 // 1. per-object callback 833 // 1. per-object callback
780 // 2. per-class object 834 // 2. per-class object
781 // 3. per-type callback 835 // 3. per-type callback
871 CALL_ARG (make_core); 925 CALL_ARG (make_core);
872 CALL_CALL ("cf::post_cleanup", G_VOID); 926 CALL_CALL ("cf::post_cleanup", G_VOID);
873 CALL_END; 927 CALL_END;
874} 928}
875 929
930void
931cfperl_make_book (object *book, int level)
932{
933 CALL_BEGIN (2);
934 CALL_ARG (book);
935 CALL_ARG (level);
936 CALL_CALL ("ext::books::make_book", G_VOID);
937 CALL_END;
938}
939
876maptile * 940maptile *
877maptile::find_sync (const char *path, maptile *origin) 941maptile::find_sync (const char *path, maptile *origin)
878{ 942{
879 CALL_BEGIN (2); 943 CALL_BEGIN (2);
880 CALL_ARG (path); 944 CALL_ARG (path);
940 CALL_BEGIN (2); 1004 CALL_BEGIN (2);
941 CALL_ARG (this); 1005 CALL_ARG (this);
942 CALL_ARG (exit); 1006 CALL_ARG (exit);
943 CALL_CALL ("cf::object::player::enter_exit", G_VOID); 1007 CALL_CALL ("cf::object::player::enter_exit", G_VOID);
944 CALL_END; 1008 CALL_END;
1009}
1010
1011void
1012log_backtrace (const char *msg)
1013{
1014#if HAVE_BACKTRACE
1015 void *addr [20];
1016 int size = backtrace (addr, 20);
1017
1018 CALL_BEGIN (size);
1019 CALL_ARG (msg);
1020 for (int i = 0; i < size; ++i)
1021 CALL_ARG ((IV)addr [i]);
1022 CALL_CALL ("cf::_log_backtrace", G_VOID);
1023 CALL_END;
1024#endif
945} 1025}
946 1026
947///////////////////////////////////////////////////////////////////////////// 1027/////////////////////////////////////////////////////////////////////////////
948 1028
949struct EventAPI *watcher_base::GEventAPI; 1029struct EventAPI *watcher_base::GEventAPI;
1105 const char *name; 1185 const char *name;
1106 IV iv; 1186 IV iv;
1107 } *civ, const_iv[] = { 1187 } *civ, const_iv[] = {
1108# define const_iv(name) { # name, (IV)name }, 1188# define const_iv(name) { # name, (IV)name },
1109 const_iv (llevError) const_iv (llevInfo) const_iv (llevDebug) const_iv (llevMonster) 1189 const_iv (llevError) const_iv (llevInfo) const_iv (llevDebug) const_iv (llevMonster)
1190 const_iv (logBacktrace)
1110 1191
1111 const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd) 1192 const_iv (Map0Cmd) const_iv (Map1Cmd) const_iv (Map1aCmd)
1112 1193
1113 const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y) 1194 const_iv (MAP_CLIENT_X) const_iv (MAP_CLIENT_Y)
1114 1195
1115 const_iv (MAX_TIME) 1196 const_iv (MAX_TIME)
1197
1198 const_iv (NUM_BODY_LOCATIONS)
1199 const_iv (body_range) const_iv (body_shield) const_iv (body_combat)
1200 const_iv (body_arm) const_iv (body_torso) const_iv (body_head)
1201 const_iv (body_neck) const_iv (body_skill) const_iv (body_finger)
1202 const_iv (body_shoulder) const_iv (body_foot) const_iv (body_hand)
1203 const_iv (body_wrist) const_iv (body_waist)
1116 1204
1117 const_iv (PLAYER) const_iv (TRANSPORT) const_iv (ROD) const_iv (TREASURE) 1205 const_iv (PLAYER) const_iv (TRANSPORT) const_iv (ROD) const_iv (TREASURE)
1118 const_iv (POTION) const_iv (FOOD) const_iv (POISON) const_iv (BOOK) 1206 const_iv (POTION) const_iv (FOOD) const_iv (POISON) const_iv (BOOK)
1119 const_iv (CLOCK) const_iv (ARROW) const_iv (BOW) const_iv (WEAPON) 1207 const_iv (CLOCK) const_iv (ARROW) const_iv (BOW) const_iv (WEAPON)
1120 const_iv (ARMOUR) const_iv (PEDESTAL) const_iv (ALTAR) const_iv (LOCKED_DOOR) 1208 const_iv (ARMOUR) const_iv (PEDESTAL) const_iv (ALTAR) const_iv (LOCKED_DOOR)
1141 const_iv (CONTAINER) const_iv (ARMOUR_IMPROVER) const_iv (WEAPON_IMPROVER) const_iv (SKILLSCROLL) 1229 const_iv (CONTAINER) const_iv (ARMOUR_IMPROVER) const_iv (WEAPON_IMPROVER) const_iv (SKILLSCROLL)
1142 const_iv (DEEP_SWAMP) const_iv (IDENTIFY_ALTAR) const_iv (MENU) const_iv (RUNE) 1230 const_iv (DEEP_SWAMP) const_iv (IDENTIFY_ALTAR) const_iv (MENU) const_iv (RUNE)
1143 const_iv (TRAP) const_iv (POWER_CRYSTAL) const_iv (CORPSE) const_iv (DISEASE) 1231 const_iv (TRAP) const_iv (POWER_CRYSTAL) const_iv (CORPSE) const_iv (DISEASE)
1144 const_iv (SYMPTOM) const_iv (BUILDER) const_iv (MATERIAL) const_iv (ITEM_TRANSFORMER) 1232 const_iv (SYMPTOM) const_iv (BUILDER) const_iv (MATERIAL) const_iv (ITEM_TRANSFORMER)
1145 1233
1146 const_iv (NUM_SUBTYPES) 1234 const_iv (NUM_TYPES) const_iv (NUM_SUBTYPES)
1147 1235
1148 const_iv (ST_BD_BUILD) const_iv (ST_BD_REMOVE) 1236 const_iv (ST_BD_BUILD) const_iv (ST_BD_REMOVE)
1149 const_iv (ST_MAT_FLOOR) const_iv (ST_MAT_WALL) const_iv (ST_MAT_ITEM) 1237 const_iv (ST_MAT_FLOOR) const_iv (ST_MAT_WALL) const_iv (ST_MAT_ITEM)
1150 1238
1151 const_iv (AT_PHYSICAL) const_iv (AT_MAGIC) const_iv (AT_FIRE) const_iv (AT_ELECTRICITY) 1239 const_iv (AT_PHYSICAL) const_iv (AT_MAGIC) const_iv (AT_FIRE) const_iv (AT_ELECTRICITY)
1159 const_iv (WEAP_HIT) const_iv (WEAP_SLASH) const_iv (WEAP_PIERCE) const_iv (WEAP_CLEAVE) 1247 const_iv (WEAP_HIT) const_iv (WEAP_SLASH) const_iv (WEAP_PIERCE) const_iv (WEAP_CLEAVE)
1160 const_iv (WEAP_SLICE) const_iv (WEAP_STAB) const_iv (WEAP_WHIP) const_iv (WEAP_CRUSH) 1248 const_iv (WEAP_SLICE) const_iv (WEAP_STAB) const_iv (WEAP_WHIP) const_iv (WEAP_CRUSH)
1161 const_iv (WEAP_BLUD) 1249 const_iv (WEAP_BLUD)
1162 1250
1163 const_iv (FLAG_ALIVE) const_iv (FLAG_WIZ) const_iv (FLAG_REMOVED) const_iv (FLAG_FREED) 1251 const_iv (FLAG_ALIVE) const_iv (FLAG_WIZ) const_iv (FLAG_REMOVED) const_iv (FLAG_FREED)
1164 const_iv (FLAG_WAS_WIZ) const_iv (FLAG_APPLIED) const_iv (FLAG_UNPAID) const_iv (FLAG_USE_SHIELD) 1252 const_iv (FLAG_APPLIED) const_iv (FLAG_UNPAID) const_iv (FLAG_USE_SHIELD)
1165 const_iv (FLAG_NO_PICK) const_iv (FLAG_ANIMATE) const_iv (FLAG_MONSTER) const_iv (FLAG_FRIENDLY) 1253 const_iv (FLAG_NO_PICK) const_iv (FLAG_ANIMATE) const_iv (FLAG_MONSTER) const_iv (FLAG_FRIENDLY)
1166 const_iv (FLAG_GENERATOR) const_iv (FLAG_IS_THROWN) const_iv (FLAG_AUTO_APPLY) const_iv (FLAG_PLAYER_SOLD) 1254 const_iv (FLAG_GENERATOR) const_iv (FLAG_IS_THROWN) const_iv (FLAG_AUTO_APPLY) const_iv (FLAG_PLAYER_SOLD)
1167 const_iv (FLAG_SEE_INVISIBLE) const_iv (FLAG_CAN_ROLL) const_iv (FLAG_OVERLAY_FLOOR) const_iv (FLAG_IS_TURNABLE) 1255 const_iv (FLAG_SEE_INVISIBLE) const_iv (FLAG_CAN_ROLL) const_iv (FLAG_OVERLAY_FLOOR) const_iv (FLAG_IS_TURNABLE)
1168 const_iv (FLAG_IS_USED_UP) const_iv (FLAG_IDENTIFIED) const_iv (FLAG_REFLECTING) const_iv (FLAG_CHANGING) 1256 const_iv (FLAG_IS_USED_UP) const_iv (FLAG_IDENTIFIED) const_iv (FLAG_REFLECTING) const_iv (FLAG_CHANGING)
1169 const_iv (FLAG_SPLITTING) const_iv (FLAG_HITBACK) const_iv (FLAG_STARTEQUIP) const_iv (FLAG_BLOCKSVIEW) 1257 const_iv (FLAG_SPLITTING) const_iv (FLAG_HITBACK) const_iv (FLAG_STARTEQUIP) const_iv (FLAG_BLOCKSVIEW)
1196 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1284 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE)
1197 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) 1285 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1198 1286
1199 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1287 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
1200 1288
1289 const_iv (SP_RAISE_DEAD)
1290 const_iv (SP_RUNE)
1291 const_iv (SP_MAKE_MARK)
1292 const_iv (SP_BOLT)
1293 const_iv (SP_BULLET)
1294 const_iv (SP_EXPLOSION)
1295 const_iv (SP_CONE)
1296 const_iv (SP_BOMB)
1297 const_iv (SP_WONDER)
1298 const_iv (SP_SMITE)
1299 const_iv (SP_MAGIC_MISSILE)
1300 const_iv (SP_SUMMON_GOLEM)
1301 const_iv (SP_DIMENSION_DOOR)
1302 const_iv (SP_MAGIC_MAPPING)
1303 const_iv (SP_MAGIC_WALL)
1304 const_iv (SP_DESTRUCTION)
1305 const_iv (SP_PERCEIVE_SELF)
1306 const_iv (SP_WORD_OF_RECALL)
1307 const_iv (SP_INVISIBLE)
1308 const_iv (SP_PROBE)
1309 const_iv (SP_HEALING)
1310 const_iv (SP_CREATE_FOOD)
1311 const_iv (SP_EARTH_TO_DUST)
1312 const_iv (SP_CHANGE_ABILITY)
1313 const_iv (SP_BLESS)
1314 const_iv (SP_CURSE)
1315 const_iv (SP_SUMMON_MONSTER)
1316 const_iv (SP_CHARGING)
1317 const_iv (SP_POLYMORPH)
1318 const_iv (SP_ALCHEMY)
1319 const_iv (SP_REMOVE_CURSE)
1320 const_iv (SP_IDENTIFY)
1321 const_iv (SP_DETECTION)
1322 const_iv (SP_MOOD_CHANGE)
1323 const_iv (SP_MOVING_BALL)
1324 const_iv (SP_SWARM)
1325 const_iv (SP_CHANGE_MANA)
1326 const_iv (SP_DISPEL_RUNE)
1327 const_iv (SP_CREATE_MISSILE)
1328 const_iv (SP_CONSECRATE)
1329 const_iv (SP_ANIMATE_WEAPON)
1330 const_iv (SP_LIGHT)
1331 const_iv (SP_CHANGE_MAP_LIGHT)
1332 const_iv (SP_FAERY_FIRE)
1333 const_iv (SP_CAUSE_DISEASE)
1334 const_iv (SP_AURA)
1335 const_iv (SP_TOWN_PORTAL)
1336 const_iv (SP_PARTY_SPELL)
1337
1201 const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC) 1338 const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC)
1202 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK) 1339 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK)
1203 const_iv (F_LOCKED) 1340 const_iv (F_LOCKED)
1204 1341
1205 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL) 1342 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL)
1307 } 1444 }
1308} 1445}
1309 1446
1310void _connect_to_perl () 1447void _connect_to_perl ()
1311 1448
1449void _recalc_want ()
1450
1312void _global_reattach () 1451void _global_reattach ()
1313 CODE: 1452 CODE:
1314{ 1453{
1315 // reattach to all attachable objects in the game. 1454 // reattach to all attachable objects in the game.
1316 for_all_clients (ns) 1455 for_all_clients (ns)
1380 default: croak ("cf::rndm requires none, one or two parameters."); break; 1519 default: croak ("cf::rndm requires none, one or two parameters."); break;
1381 } 1520 }
1382 OUTPUT: 1521 OUTPUT:
1383 RETVAL 1522 RETVAL
1384 1523
1524NV clamp (NV value, NV min_value, NV max_value)
1525 CODE:
1526 RETVAL = clamp (value, min_value, max_value);
1527 OUTPUT:
1528 RETVAL
1529
1530NV lerp (NV value, NV min_in, NV max_in, NV min_out, NV max_out)
1531 CODE:
1532 RETVAL = lerp (value, min_in, max_in, min_out, max_out);
1533 OUTPUT:
1534 RETVAL
1535
1536void cede_to_tick ()
1537 CODE:
1538 coroapi::cede_to_tick ();
1539
1385void server_tick () 1540void server_tick ()
1386 CODE: 1541 CODE:
1387 runtime = SvNVx (sv_runtime); 1542 runtime = SvNVx (sv_runtime);
1388 server_tick (); 1543 server_tick ();
1389 1544
1390void 1545void
1546log_backtrace (utf8_string msg)
1547
1548void
1391LOG (int level, utf8_string msg) 1549LOG (int flags, utf8_string msg)
1392 PROTOTYPE: $$ 1550 PROTOTYPE: $$
1393 C_ARGS: (LogLevel)level, "%s", msg 1551 C_ARGS: flags, "%s", msg
1394 1552
1395octet_string path_combine (octet_string base, octet_string path) 1553octet_string path_combine (octet_string base, octet_string path)
1396 PROTOTYPE: $$ 1554 PROTOTYPE: $$
1397 1555
1398octet_string path_combine_and_normalize (octet_string base, octet_string path) 1556octet_string path_combine_and_normalize (octet_string base, octet_string path)
1435 } 1593 }
1436 OUTPUT: RETVAL 1594 OUTPUT: RETVAL
1437 1595
1438void abort () 1596void abort ()
1439 1597
1598void reset_signals ()
1599
1440void fork_abort (octet_string cause = "cf::fork_abort") 1600void fork_abort (octet_string cause = "cf::fork_abort")
1441 1601
1442void cleanup (octet_string cause, bool make_core = false) 1602void cleanup (octet_string cause, bool make_core = false)
1443 1603
1444void emergency_save () 1604void emergency_save ()
1578object *actives (U32 index) 1738object *actives (U32 index)
1579 CODE: 1739 CODE:
1580 RETVAL = index < actives.size () ? actives [index] : 0; 1740 RETVAL = index < actives.size () ? actives [index] : 0;
1581 OUTPUT: RETVAL 1741 OUTPUT: RETVAL
1582 1742
1743const char *slot_save_name (U32 slot)
1744 ALIAS:
1745 slot_use_name = 1
1746 slot_nonuse_name = 2
1747 CODE:
1748{
1749 if (slot >= NUM_BODY_LOCATIONS)
1750 croak ("body slot index out of range");
1751
1752 switch (ix)
1753 {
1754 case 0: RETVAL = body_locations[slot].save_name; break;
1755 case 1: RETVAL = body_locations[slot].use_name; break;
1756 case 2: RETVAL = body_locations[slot].nonuse_name; break;
1757 }
1758}
1759 OUTPUT:
1760 RETVAL
1761
1583# missing properties 1762# missing properties
1584 1763
1585object *head (object *op) 1764object *head (object *op)
1586 PROTOTYPE: $ 1765 PROTOTYPE: $
1587 CODE: 1766 CODE:
1612int 1791int
1613num_animations (object *op) 1792num_animations (object *op)
1614 CODE: 1793 CODE:
1615 RETVAL = NUM_ANIMATIONS (op); 1794 RETVAL = NUM_ANIMATIONS (op);
1616 OUTPUT: RETVAL 1795 OUTPUT: RETVAL
1796
1797int slot_info (object *op, UV slot, int value = 0)
1798 ALIAS:
1799 slot_used = 1
1800 CODE:
1801{
1802 if (slot >= NUM_BODY_LOCATIONS)
1803 croak ("body slot index out of range");
1804
1805 RETVAL = ix ? op->slot[slot].used : op->slot[slot].info;
1806
1807 if (items > 2)
1808 if (ix)
1809 op->slot[slot].used = value;
1810 else
1811 op->slot[slot].info = value;
1812}
1813 OUTPUT:
1814 RETVAL
1617 1815
1618object *find_best_object_match (object *op, utf8_string match) 1816object *find_best_object_match (object *op, utf8_string match)
1619 1817
1620object *find_marked_object (object *op) 1818object *find_marked_object (object *op)
1621 1819
1802void check_score (object *op) 2000void check_score (object *op)
1803 2001
1804void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE) 2002void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE)
1805 CODE: 2003 CODE:
1806 new_draw_info (flags, 0, op, txt); 2004 new_draw_info (flags, 0, op, txt);
1807
1808object *cf_player_send_inventory (object *op)
1809
1810octet_string cf_player_get_ip (object *op)
1811 ALIAS: ip = 0
1812
1813object *cf_player_get_marked_item (object *op)
1814 ALIAS: marked_item = 0
1815
1816void cf_player_set_marked_item (object *op, object *ob)
1817
1818partylist *cf_player_get_party (object *op)
1819 ALIAS: party = 0
1820
1821void cf_player_set_party (object *op, partylist *party)
1822 2005
1823void kill_player (object *op) 2006void kill_player (object *op)
1824 2007
1825void esrv_update_item (object *op, int what, object *item) 2008void esrv_update_item (object *op, int what, object *item)
1826 C_ARGS: what, op, item 2009 C_ARGS: what, op, item
1970 if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0)) 2153 if (SV **elem = av_fetch ((AV *)palette, idx [offs], 0))
1971 { 2154 {
1972 object *ob = get_archetype (SvPVutf8_nolen (*elem)); 2155 object *ob = get_archetype (SvPVutf8_nolen (*elem));
1973 ob->flag [FLAG_NO_MAP_SAVE] = true; 2156 ob->flag [FLAG_NO_MAP_SAVE] = true;
1974 THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY); 2157 THIS->insert (ob, x, y, 0, INS_ABOVE_FLOOR_ONLY);
2158
2159 if (ob->randomitems)
2160 {
2161 if (!ob->above)
2162 {
2163 ob->create_treasure (ob->randomitems);
2164
2165 for (object *op = ob->above; op; op = op->above)
2166 op->flag [FLAG_NO_MAP_SAVE] = true;
2167 }
2168
2169 ob->randomitems = 0;
2170 }
1975 } 2171 }
1976 } 2172 }
1977 } 2173 }
1978 2174
1979 skip_space: ; 2175 skip_space: ;
2225 PROTOTYPE: 2421 PROTOTYPE:
2226 CODE: 2422 CODE:
2227 RETVAL = first_archetype; 2423 RETVAL = first_archetype;
2228 OUTPUT: RETVAL 2424 OUTPUT: RETVAL
2229 2425
2426object *instantiate (archetype *arch)
2427 CODE:
2428 RETVAL = arch_to_object (arch);
2429 OUTPUT:
2430 RETVAL
2431
2230INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h | 2432INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h |
2231 2433
2232MODULE = cf PACKAGE = cf::party 2434MODULE = cf PACKAGE = cf::party
2233 2435
2234partylist *first () 2436partylist *first ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines