--- deliantra/server/include/cfperl.h 2008/11/16 03:52:12 1.100 +++ deliantra/server/include/cfperl.h 2009/10/12 14:00:58 1.108 @@ -5,18 +5,19 @@ * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * - * Deliantra is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Deliantra is free software: you can redistribute it and/or modify it under + * the terms of the Affero GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the Affero GNU General Public License + * and the GNU General Public License along with this program. If not, see + * . * * The authors can be reached via e-mail to */ @@ -85,11 +86,14 @@ if (SvTRUE (ERRSV)) \ LOG (llevError, "runtime error in %s: %s", __func__, SvPVutf8_nolen (ERRSV)); +inline int call_pvsv (const char *ob, I32 flags) { return call_pv (ob, flags); } +inline int call_pvsv (SV *ob, I32 flags) { return call_sv (ob, flags); } + #define CALL_BEGIN(args) dSP; ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, args) #define CALL_ARG_SV(sv) PUSHs (sv_2mortal (sv)) // separate because no refcount inc #define CALL_ARG(expr) PUSHs (sv_2mortal (to_sv (expr))) -#define CALL_CALL(name, flags) PUTBACK; int count = call_pv (name, (flags) | G_EVAL); SPAGAIN; -#define CALL_END CHECK_ERROR; FREETMPS; LEAVE +#define CALL_CALL(name, flags) PUTBACK; int count = call_pvsv (name, (flags) | G_EVAL); SPAGAIN; +#define CALL_END PUTBACK; CHECK_ERROR; FREETMPS; LEAVE ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -101,6 +105,11 @@ void cfperl_make_book (object *book, int level); void cfperl_send_msg (client *ns, int color, const char *type, const char *msg); int cfperl_can_merge (object *ob1, object *ob2); +void cfperl_mapscript_activate (object *ob, int state, object *activator, object *originator = 0); + +bool is_match_expr (const char *expr); +/* applies the match expression and returns true if it matches */ +bool match (const char *expr, object *ob, object *self = 0, object *source = 0, object *originator = 0); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -290,7 +299,7 @@ void put (attachable *ext); // used only for user-defined key-value pairs - void put (const shstr &k, const shstr &v) + void put (shstr_tmp k, shstr_tmp v) { add (k); @@ -324,7 +333,7 @@ put_kw_string (k, v); } - void put (keyword k, const shstr &v) + void put (keyword k, shstr_tmp v) { put_kw_string (k, v); } @@ -368,7 +377,7 @@ void put (keyword k, signed long long v) { put_(k, (sint64)v); } void put (keyword k, unsigned long long v) { put_(k, (sint64)v); } - void put (keyword kbeg, keyword kend, const shstr &v) + void put (keyword kbeg, keyword kend, shstr_tmp v) { force (MAX_KEYWORD_LEN + 1); fadd (keyword_str [kbeg], keyword_len [kbeg]); fadd ('\n');