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.97 by root, Thu Dec 21 22:41:35 2006 UTC vs.
Revision 1.100 by root, Fri Dec 22 02:04:21 2006 UTC

361 361
362 HV *hv = (HV *)SvRV ((SV *)self); 362 HV *hv = (HV *)SvRV ((SV *)self);
363 363
364 if (SvREFCNT ((SV *)self) == 1 364 if (SvREFCNT ((SV *)self) == 1
365 && SvREFCNT ((SV *)hv) == 1 365 && SvREFCNT ((SV *)hv) == 1
366 && !HvKEYS (hv)) 366 && !HvTOTALKEYS (hv))
367 { 367 {
368 SvREFCNT_dec ((SV *)self); 368 SvREFCNT_dec ((SV *)self);
369 self = 0; 369 self = 0;
370 } 370 }
371} 371}
1008 1008
1009 switch (KLASS_OF (event)) 1009 switch (KLASS_OF (event))
1010 { 1010 {
1011 case KLASS_OBJECT: PUSHs (sv_2mortal (newSVdt (DT_OBJECT, op))); break; 1011 case KLASS_OBJECT: PUSHs (sv_2mortal (newSVdt (DT_OBJECT, op))); break;
1012 case KLASS_PLAYER: PUSHs (sv_2mortal (newSVdt (DT_PLAYER, pl))); break; 1012 case KLASS_PLAYER: PUSHs (sv_2mortal (newSVdt (DT_PLAYER, pl))); break;
1013 case KLASS_CLIENT: PUSHs (sv_2mortal (newSVdt (DT_CLIENT, pl))); break; 1013 case KLASS_CLIENT: PUSHs (sv_2mortal (newSVdt (DT_CLIENT, ns))); break;
1014 case KLASS_MAP: PUSHs (sv_2mortal (newSVdt (DT_MAP, map))); break; 1014 case KLASS_MAP: PUSHs (sv_2mortal (newSVdt (DT_MAP, map))); break;
1015 } 1015 }
1016 1016
1017 for (;;) 1017 for (;;)
1018 { 1018 {
1621 const_iv (KLASS_GLOBAL) 1621 const_iv (KLASS_GLOBAL)
1622 const_iv (KLASS_OBJECT) 1622 const_iv (KLASS_OBJECT)
1623 const_iv (KLASS_CLIENT) 1623 const_iv (KLASS_CLIENT)
1624 const_iv (KLASS_PLAYER) 1624 const_iv (KLASS_PLAYER)
1625 const_iv (KLASS_MAP) 1625 const_iv (KLASS_MAP)
1626
1627 const_iv (CS_QUERY_YESNO)
1628 const_iv (CS_QUERY_SINGLECHAR)
1629 const_iv (CS_QUERY_HIDEINPUT)
1630
1631 const_iv (ST_DEAD)
1632 const_iv (ST_SETUP)
1633 const_iv (ST_PLAYING)
1634 const_iv (ST_CUSTOM)
1635
1636 const_iv (ST_PLAY_AGAIN)
1637 const_iv (ST_ROLL_STAT)
1638 const_iv (ST_CHANGE_CLASS)
1639 const_iv (ST_CONFIRM_QUIT)
1640 const_iv (ST_CONFIGURE)
1641 const_iv (ST_GET_NAME)
1642 const_iv (ST_GET_PASSWORD)
1643 const_iv (ST_CONFIRM_PASSWORD)
1644 const_iv (ST_GET_PARTY_PASSWORD)
1626 }; 1645 };
1627 1646
1628 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1647 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1629 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 1648 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1630 1649
1851 PROTOTYPE: $ 1870 PROTOTYPE: $
1852 PPCODE: 1871 PPCODE:
1853{ 1872{
1854 object *o; 1873 object *o;
1855 for (o = obj->inv; o; o = o->below) 1874 for (o = obj->inv; o; o = o->below)
1856 XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); 1875 XPUSHs (sv_2mortal (to_sv (o)));
1857} 1876}
1858 1877
1859object *find_best_object_match (object *op, const char *match) 1878object *find_best_object_match (object *op, const char *match)
1860 1879
1861object *find_marked_object (object *op) 1880object *find_marked_object (object *op)
2137 OUTPUT: RETVAL 2156 OUTPUT: RETVAL
2138 2157
2139bool 2158bool
2140cell_visible (player *pl, int dx, int dy) 2159cell_visible (player *pl, int dx, int dy)
2141 CODE: 2160 CODE:
2142 RETVAL = FABS (dx) <= pl->socket->mapx / 2 && FABS (dy) <= pl->socket->mapy / 2 2161 RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2
2143 && !pl->blocked_los [dx + pl->socket->mapx / 2][dy + pl->socket->mapy / 2]; 2162 && !pl->blocked_los [dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2];
2144 OUTPUT: 2163 OUTPUT:
2145 RETVAL 2164 RETVAL
2146 2165
2147void 2166void
2148send (player *pl, SV *packet) 2167send (player *pl, SV *packet)
2149 CODE: 2168 CODE:
2150{ 2169{
2151 STRLEN len; 2170 STRLEN len;
2152 char *buf = SvPVbyte (packet, len); 2171 char *buf = SvPVbyte (packet, len);
2153 2172
2173 if (pl->ns)
2154 pl->socket->send_packet (buf, len); 2174 pl->ns->send_packet (buf, len);
2155} 2175}
2156 2176
2157int 2177int
2158listening (player *pl, int new_value = -1) 2178listening (player *pl, int new_value = -1)
2159 CODE: 2179 CODE:
2178 if (y) sv_to (y, pl->bed_y); 2198 if (y) sv_to (y, pl->bed_y);
2179 2199
2180void 2200void
2181list () 2201list ()
2182 PPCODE: 2202 PPCODE:
2183{
2184 player *pl;
2185 for (pl = first_player; pl; pl = pl->next) 2203 for (player *pl = first_player; pl; pl = pl->next)
2186 XPUSHs (newSVcfapi (CFAPI_PPLAYER, pl)); 2204 XPUSHs (sv_2mortal (to_sv (pl)));
2187}
2188 2205
2189bool 2206bool
2190peaceful (player *pl, bool new_setting = 0) 2207peaceful (player *pl, bool new_setting = 0)
2191 PROTOTYPE: $;$ 2208 PROTOTYPE: $;$
2192 CODE: 2209 CODE:
2454 RETVAL = INVOKE_((event_type)event, ARG_CLIENT (ns), ARG_AV (av)); 2471 RETVAL = INVOKE_((event_type)event, ARG_CLIENT (ns), ARG_AV (av));
2455 OUTPUT: RETVAL 2472 OUTPUT: RETVAL
2456 2473
2457SV *registry (client *ns) 2474SV *registry (client *ns)
2458 2475
2476void
2477list ()
2478 PPCODE:
2479 EXTEND (SP, clients.size ());
2480 for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i)
2481 PUSHs (sv_2mortal (to_sv (*i)));
2482
2459client * 2483client *
2460create (int fd, const char *peername) 2484create (int fd, const char *peername)
2461 CODE: 2485 CODE:
2462 RETVAL = client::create (fd, peername); 2486 RETVAL = client::create (fd, peername);
2463 OUTPUT: 2487 OUTPUT:
2464 RETVAL 2488 RETVAL
2465 2489
2466void 2490void
2491client::send_packet (SV *packet)
2492 CODE:
2493{
2494 STRLEN len;
2495 char *buf = SvPVbyte (packet, len);
2496
2497 THIS->send_packet (buf, len);
2498}
2499
2500void
2467client::destroy () 2501client::destroy ()
2468 2502

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines