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.105 by root, Sat Dec 23 06:45:33 2006 UTC vs.
Revision 1.106 by root, Sat Dec 23 15:49:40 2006 UTC

19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 * 20 *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 * Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24*/ 24 */
25 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#include <plugin_common.h> 29#include <plugin_common.h>
192inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } 192inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; }
193 193
194template<int N> 194template<int N>
195inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); } 195inline void sv_to (SV *sv, char (&v)[N]) { assign (v, SvPV_nolen (sv)); }
196 196
197inline void sv_to (SV *sv, rangetype &v) { v = (rangetype) SvIV (sv); }
198inline void sv_to (SV *sv, bowtype_t &v) { v = (bowtype_t) SvIV (sv); }
199inline void sv_to (SV *sv, petmode_t &v) { v = (petmode_t) SvIV (sv); }
200inline void sv_to (SV *sv, usekeytype &v) { v = (usekeytype) SvIV (sv); }
201inline void sv_to (SV *sv, unapplymode &v) { v = (unapplymode) SvIV (sv); }
202
197inline void sv_to (SV *sv, UUID &v) 203inline void sv_to (SV *sv, UUID &v)
198{ 204{
199 unsigned int version; 205 unsigned int version;
200 206
201 if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version) 207 if (2 != sscanf (SvPV_nolen (sv), "<%d.%" SCNx64 ">", &version, &v.seq) || 1 != version)
202 croak ("unparsable uuid: %s", SvPV_nolen (sv)); 208 croak ("unparsable uuid: %s", SvPV_nolen (sv));
203} 209}
210
211inline void sv_to (SV *sv, object::flags_t::reference v) { v = boolSV (sv); }
204 212
205static SV * 213static SV *
206newSVdt_va (va_list &ap, data_type type) 214newSVdt_va (va_list &ap, data_type type)
207{ 215{
208 SV *sv; 216 SV *sv;
1410 const_iv (FLAG_ACTIVATE_ON_RELEASE) 1418 const_iv (FLAG_ACTIVATE_ON_RELEASE)
1411 const_iv (FLAG_IS_WATER) 1419 const_iv (FLAG_IS_WATER)
1412 const_iv (FLAG_CONTENT_ON_GEN) 1420 const_iv (FLAG_CONTENT_ON_GEN)
1413 const_iv (FLAG_IS_A_TEMPLATE) 1421 const_iv (FLAG_IS_A_TEMPLATE)
1414 const_iv (FLAG_IS_BUILDABLE) 1422 const_iv (FLAG_IS_BUILDABLE)
1415 const_iv (FLAG_AFK)
1416 1423
1417 const_iv (NDI_BLACK) 1424 const_iv (NDI_BLACK)
1418 const_iv (NDI_WHITE) 1425 const_iv (NDI_WHITE)
1419 const_iv (NDI_NAVY) 1426 const_iv (NDI_NAVY)
1420 const_iv (NDI_RED) 1427 const_iv (NDI_RED)
1836 RETVAL = object::first; 1843 RETVAL = object::first;
1837 OUTPUT: RETVAL 1844 OUTPUT: RETVAL
1838 1845
1839# missing properties 1846# missing properties
1840 1847
1841int flag (object *op, int flag, int value = 1)
1842 PROTOTYPE: $$;$
1843 CODE:
1844 RETVAL = op->flag [flag];
1845 if (items >= 3)
1846 op->flag [flag] = value;
1847 OUTPUT: RETVAL
1848
1849object *head (object *op) 1848object *head (object *op)
1850 PROTOTYPE: $ 1849 PROTOTYPE: $
1851 CODE: 1850 CODE:
1852 RETVAL = op->head ? op->head : op; 1851 RETVAL = op->head ? op->head : op;
1853 OUTPUT: RETVAL 1852 OUTPUT: RETVAL
1889object::remove_statbonus () 1888object::remove_statbonus ()
1890 1889
1891object *find_best_object_match (object *op, const char *match) 1890object *find_best_object_match (object *op, const char *match)
1892 1891
1893object *find_marked_object (object *op) 1892object *find_marked_object (object *op)
1894
1895int resistance (object *op, int rtype, int newval = 0)
1896 CODE:
1897 if (rtype < 0 || rtype >= NROFATTACKS)
1898 croak ("resistance out of bounds");
1899 RETVAL = op->resist [rtype];
1900 if (items >= 3)
1901 op->resist [rtype] = newval;
1902 OUTPUT: RETVAL
1903
1904void set_resistance (object *op, int rtype, int val)
1905 CODE:
1906 if (rtype < 0 || rtype >= NROFATTACKS)
1907 op->resist[rtype] = val;
1908 1893
1909int need_identify (const object *obj); 1894int need_identify (const object *obj);
1910 1895
1911int apply_shop_mat (object *shop_mat, object *op); 1896int apply_shop_mat (object *shop_mat, object *op);
1912 1897

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines