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.210 by root, Sat May 19 00:08:12 2007 UTC vs.
Revision 1.217 by root, Sun Jun 3 17:42:39 2007 UTC

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 it
10 * it under the terms of the GNU General Public License as published by 9 * under the terms of the GNU General Public License as published by the Free
11 * the Free Software Foundation; either version 2 of the License, or 10 * Software Foundation; either version 2 of the License, or (at your option)
12 * (at your option) any later version. 11 * 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, but
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * GNU General Public License for more details. 16 * 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 along
20 * along with this program; if not, write to the Free Software 19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
21 * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
22 */ 23 */
23 24
24#include "autoconf.h" 25#include "autoconf.h"
25 26
26#define PLUGIN_NAME "perl" 27#define PLUGIN_NAME "perl"
168} 169}
169 170
170void 171void
171attachable::do_destroy () 172attachable::do_destroy ()
172{ 173{
173 invoke (EVENT_ATTACHABLE_DESTROY, DT_END); 174 INVOKE_ATTACHABLE (DESTROY, this);
174 175
175 if (cb) 176 if (cb)
176 { 177 {
177 SvREFCNT_dec (cb); 178 SvREFCNT_dec (cb);
178 cb = 0; 179 cb = 0;
655void 656void
656attachable::instantiate () 657attachable::instantiate ()
657{ 658{
658 if (attach) 659 if (attach)
659 { 660 {
660 invoke (EVENT_ATTACHABLE_INSTANTIATE, ARG_STRING (attach), DT_END); 661 INVOKE_ATTACHABLE (INSTANTIATE, this, ARG_STRING (attach));
661 attach = 0; 662 attach = 0;
662 } 663 }
663} 664}
664 665
665void 666void
666attachable::reattach () 667attachable::reattach ()
667{ 668{
668 optimise (); 669 optimise ();
669 //TODO: check for _attachment's, very important for restarts 670 //TODO: check for _attachment's, very important for restarts
670 invoke (EVENT_ATTACHABLE_REATTACH, DT_END); 671 INVOKE_ATTACHABLE (REATTACH, this);
671} 672}
672 673
673static event_klass klass_of[NUM_EVENT_TYPES] = { 674static event_klass klass_of[NUM_EVENT_TYPES] = {
674# define def(type,name) KLASS_ ## type, 675# define def(type,name) KLASS_ ## type,
675# include "eventinc.h" 676# include "eventinc.h"
823 } 824 }
824 } 825 }
825} 826}
826 827
827bool 828bool
828attachable::vinvoke (event_type event, va_list &ap) 829attachable::invoke (event_type event, ...)
829{ 830{
830 data_type dt; 831 data_type dt;
831 832
832 // callback call ordering should be: 833 // callback call ordering should be:
833 // 1. per-object callback 834 // 1. per-object callback
839 gather_callbacks (callbacks, event); 840 gather_callbacks (callbacks, event);
840 841
841 // short-circuit processing if no callbacks found/defined 842 // short-circuit processing if no callbacks found/defined
842 if (!callbacks) 843 if (!callbacks)
843 return 0; 844 return 0;
845
846 va_list ap;
847 va_start (ap, event);
844 848
845 CALL_BEGIN (3); 849 CALL_BEGIN (3);
846 CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays 850 CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays
847 CALL_ARG_SV (newRV_noinc ((SV *)callbacks)); 851 CALL_ARG_SV (newRV_noinc ((SV *)callbacks));
848 852
922cfperl_cleanup (int make_core) 926cfperl_cleanup (int make_core)
923{ 927{
924 CALL_BEGIN (1); 928 CALL_BEGIN (1);
925 CALL_ARG (make_core); 929 CALL_ARG (make_core);
926 CALL_CALL ("cf::post_cleanup", G_VOID); 930 CALL_CALL ("cf::post_cleanup", G_VOID);
931 CALL_END;
932}
933
934void
935cfperl_make_book (object *book, int level)
936{
937 CALL_BEGIN (2);
938 CALL_ARG (book);
939 CALL_ARG (level);
940 CALL_CALL ("ext::books::make_book", G_VOID);
927 CALL_END; 941 CALL_END;
928} 942}
929 943
930maptile * 944maptile *
931maptile::find_sync (const char *path, maptile *origin) 945maptile::find_sync (const char *path, maptile *origin)
1274 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE) 1288 const_iv (UPD_LOCATION) const_iv (UPD_FLAGS) const_iv (UPD_WEIGHT) const_iv (UPD_FACE)
1275 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF) 1289 const_iv (UPD_NAME) const_iv (UPD_ANIM) const_iv (UPD_ANIMSPEED) const_iv (UPD_NROF)
1276 1290
1277 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE) 1291 const_iv (UPD_SP_MANA) const_iv (UPD_SP_GRACE) const_iv (UPD_SP_DAMAGE)
1278 1292
1293 const_iv (SP_RAISE_DEAD)
1294 const_iv (SP_RUNE)
1295 const_iv (SP_MAKE_MARK)
1296 const_iv (SP_BOLT)
1297 const_iv (SP_BULLET)
1298 const_iv (SP_EXPLOSION)
1299 const_iv (SP_CONE)
1300 const_iv (SP_BOMB)
1301 const_iv (SP_WONDER)
1302 const_iv (SP_SMITE)
1303 const_iv (SP_MAGIC_MISSILE)
1304 const_iv (SP_SUMMON_GOLEM)
1305 const_iv (SP_DIMENSION_DOOR)
1306 const_iv (SP_MAGIC_MAPPING)
1307 const_iv (SP_MAGIC_WALL)
1308 const_iv (SP_DESTRUCTION)
1309 const_iv (SP_PERCEIVE_SELF)
1310 const_iv (SP_WORD_OF_RECALL)
1311 const_iv (SP_INVISIBLE)
1312 const_iv (SP_PROBE)
1313 const_iv (SP_HEALING)
1314 const_iv (SP_CREATE_FOOD)
1315 const_iv (SP_EARTH_TO_DUST)
1316 const_iv (SP_CHANGE_ABILITY)
1317 const_iv (SP_BLESS)
1318 const_iv (SP_CURSE)
1319 const_iv (SP_SUMMON_MONSTER)
1320 const_iv (SP_CHARGING)
1321 const_iv (SP_POLYMORPH)
1322 const_iv (SP_ALCHEMY)
1323 const_iv (SP_REMOVE_CURSE)
1324 const_iv (SP_IDENTIFY)
1325 const_iv (SP_DETECTION)
1326 const_iv (SP_MOOD_CHANGE)
1327 const_iv (SP_MOVING_BALL)
1328 const_iv (SP_SWARM)
1329 const_iv (SP_CHANGE_MANA)
1330 const_iv (SP_DISPEL_RUNE)
1331 const_iv (SP_CREATE_MISSILE)
1332 const_iv (SP_CONSECRATE)
1333 const_iv (SP_ANIMATE_WEAPON)
1334 const_iv (SP_LIGHT)
1335 const_iv (SP_CHANGE_MAP_LIGHT)
1336 const_iv (SP_FAERY_FIRE)
1337 const_iv (SP_CAUSE_DISEASE)
1338 const_iv (SP_AURA)
1339 const_iv (SP_TOWN_PORTAL)
1340 const_iv (SP_PARTY_SPELL)
1341
1279 const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC) 1342 const_iv (F_APPLIED) const_iv (F_LOCATION) const_iv (F_UNPAID) const_iv (F_MAGIC)
1280 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK) 1343 const_iv (F_CURSED) const_iv (F_DAMNED) const_iv (F_OPEN) const_iv (F_NOPICK)
1281 const_iv (F_LOCKED) 1344 const_iv (F_LOCKED)
1282 1345
1283 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL) 1346 const_iv (F_BUY) const_iv (F_SHOP) const_iv (F_SELL)
1679object *actives (U32 index) 1742object *actives (U32 index)
1680 CODE: 1743 CODE:
1681 RETVAL = index < actives.size () ? actives [index] : 0; 1744 RETVAL = index < actives.size () ? actives [index] : 0;
1682 OUTPUT: RETVAL 1745 OUTPUT: RETVAL
1683 1746
1684const char *slot_save_name (U32 slot) 1747const char *slot_use_name (U32 slot)
1685 ALIAS: 1748 ALIAS:
1686 slot_use_name = 1
1687 slot_nonuse_name = 2 1749 slot_nonuse_name = 1
1688 CODE: 1750 CODE:
1689{ 1751{
1690 if (slot >= NUM_BODY_LOCATIONS) 1752 if (slot >= NUM_BODY_LOCATIONS)
1691 croak ("body slot index out of range"); 1753 croak ("body slot index out of range");
1692 1754
1693 switch (ix) 1755 switch (ix)
1694 { 1756 {
1695 case 0: RETVAL = body_locations[slot].save_name; break;
1696 case 1: RETVAL = body_locations[slot].use_name; break; 1757 case 0: RETVAL = body_locations[slot].use_name; break;
1697 case 2: RETVAL = body_locations[slot].nonuse_name; break; 1758 case 1: RETVAL = body_locations[slot].nonuse_name; break;
1698 } 1759 }
1699} 1760}
1700 OUTPUT: 1761 OUTPUT:
1701 RETVAL 1762 RETVAL
1702 1763
1942 2003
1943void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE) 2004void message (object *op, utf8_string txt, int flags = NDI_ORANGE | NDI_UNIQUE)
1944 CODE: 2005 CODE:
1945 new_draw_info (flags, 0, op, txt); 2006 new_draw_info (flags, 0, op, txt);
1946 2007
1947object *cf_player_send_inventory (object *op)
1948
1949octet_string cf_player_get_ip (object *op)
1950 ALIAS: ip = 0
1951
1952object *cf_player_get_marked_item (object *op)
1953 ALIAS: marked_item = 0
1954
1955void cf_player_set_marked_item (object *op, object *ob)
1956
1957partylist *cf_player_get_party (object *op)
1958 ALIAS: party = 0
1959
1960void cf_player_set_party (object *op, partylist *party)
1961
1962void kill_player (object *op) 2008void kill_player (object *op)
1963 2009
1964void esrv_update_item (object *op, int what, object *item) 2010void esrv_update_item (object *op, int what, object *item)
1965 C_ARGS: what, op, item 2011 C_ARGS: what, op, item
1966
1967void clear_los (object *op)
1968 2012
1969int command_summon (object *op, utf8_string params) 2013int command_summon (object *op, utf8_string params)
1970 2014
1971int command_arrest (object *op, utf8_string params) 2015int command_arrest (object *op, utf8_string params)
1972 2016
1990 CODE: 2034 CODE:
1991 pl->ob->stats.hp = pl->ob->stats.maxhp; 2035 pl->ob->stats.hp = pl->ob->stats.maxhp;
1992 pl->ob->stats.sp = pl->ob->stats.maxsp; 2036 pl->ob->stats.sp = pl->ob->stats.maxsp;
1993 pl->ob->stats.grace = pl->ob->stats.maxgrace; 2037 pl->ob->stats.grace = pl->ob->stats.maxgrace;
1994 pl->orig_stats = pl->ob->stats; 2038 pl->orig_stats = pl->ob->stats;
2039
2040void clear_los (player *pl)
1995 2041
1996void cf_player_move (player *pl, int dir) 2042void cf_player_move (player *pl, int dir)
1997 2043
1998void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); 2044void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0);
1999 2045
2351 rmp.decoroptions = decoroptions; 2397 rmp.decoroptions = decoroptions;
2352 rmp.orientation = orientation; 2398 rmp.orientation = orientation;
2353 rmp.origin_y = origin_y; 2399 rmp.origin_y = origin_y;
2354 rmp.origin_x = origin_x; 2400 rmp.origin_x = origin_x;
2355 rmp.random_seed = random_seed; 2401 rmp.random_seed = random_seed;
2356 rmp.total_map_hp = total_map_hp; 2402 rmp.total_map_hp = (uint64_t) total_map_hp;
2357 rmp.map_layout_style = map_layout_style; 2403 rmp.map_layout_style = map_layout_style;
2358 rmp.treasureoptions = treasureoptions; 2404 rmp.treasureoptions = treasureoptions;
2359 rmp.symmetry_used = symmetry_used; 2405 rmp.symmetry_used = symmetry_used;
2360 rmp.region = region; 2406 rmp.region = region;
2361 rmp.custom = custom; 2407 rmp.custom = custom;
2376archetype *first() 2422archetype *first()
2377 PROTOTYPE: 2423 PROTOTYPE:
2378 CODE: 2424 CODE:
2379 RETVAL = first_archetype; 2425 RETVAL = first_archetype;
2380 OUTPUT: RETVAL 2426 OUTPUT: RETVAL
2427
2428object *instantiate (archetype *arch)
2429 CODE:
2430 RETVAL = arch_to_object (arch);
2431 OUTPUT:
2432 RETVAL
2381 2433
2382INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h | 2434INCLUDE: $PERL $srcdir/genacc archetype ../include/object.h |
2383 2435
2384MODULE = cf PACKAGE = cf::party 2436MODULE = cf PACKAGE = cf::party
2385 2437

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines