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.102 by root, Fri Dec 22 16:34:00 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 = QUERY_FLAG (op, flag);
1845 if (items >= 3)
1846 if (value)
1847 SET_FLAG (op, flag);
1848 else
1849 CLEAR_FLAG (op, flag);
1850 OUTPUT: RETVAL
1851
1852object *head (object *op) 1848object *head (object *op)
1853 PROTOTYPE: $ 1849 PROTOTYPE: $
1854 CODE: 1850 CODE:
1855 RETVAL = op->head ? op->head : op; 1851 RETVAL = op->head ? op->head : op;
1856 OUTPUT: RETVAL 1852 OUTPUT: RETVAL
1892object::remove_statbonus () 1888object::remove_statbonus ()
1893 1889
1894object *find_best_object_match (object *op, const char *match) 1890object *find_best_object_match (object *op, const char *match)
1895 1891
1896object *find_marked_object (object *op) 1892object *find_marked_object (object *op)
1897
1898int resistance (object *op, int rtype, int newval = 0)
1899 CODE:
1900 if (rtype < 0 || rtype >= NROFATTACKS)
1901 croak ("resistance out of bounds");
1902 RETVAL = op->resist [rtype];
1903 if (items >= 3)
1904 op->resist [rtype] = newval;
1905 OUTPUT: RETVAL
1906
1907void set_resistance (object *op, int rtype, int val)
1908 CODE:
1909 if (rtype < 0 || rtype >= NROFATTACKS)
1910 op->resist[rtype] = val;
1911 1893
1912int need_identify (const object *obj); 1894int need_identify (const object *obj);
1913 1895
1914int apply_shop_mat (object *shop_mat, object *op); 1896int apply_shop_mat (object *shop_mat, object *op);
1915 1897
2105player *player (object *op) 2087player *player (object *op)
2106 CODE: 2088 CODE:
2107 RETVAL = op->contr; 2089 RETVAL = op->contr;
2108 OUTPUT: RETVAL 2090 OUTPUT: RETVAL
2109 2091
2092void check_score (object *op)
2093
2110void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE) 2094void cf_player_message (object *obj, char *txt, int flags = NDI_ORANGE | NDI_UNIQUE)
2111 2095
2112object *cf_player_send_inventory (object *op) 2096object *cf_player_send_inventory (object *op)
2113 2097
2114char *cf_player_get_ip (object *op) 2098char *cf_player_get_ip (object *op)
2194void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); 2178void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0);
2195 2179
2196player *first () 2180player *first ()
2197 CODE: 2181 CODE:
2198 RETVAL = first_player; 2182 RETVAL = first_player;
2199 OUTPUT: RETVAL
2200
2201player *next (player *pl)
2202 CODE:
2203 RETVAL = pl->next;
2204 OUTPUT: RETVAL 2183 OUTPUT: RETVAL
2205 2184
2206bool 2185bool
2207cell_visible (player *pl, int dx, int dy) 2186cell_visible (player *pl, int dx, int dy)
2208 CODE: 2187 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines