ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/cfperl/cfperl.xs
(Generate patch)

Comparing deliantra/server/plugins/cfperl/cfperl.xs (file contents):
Revision 1.53 by root, Sun Jun 11 15:02:16 2006 UTC vs.
Revision 1.55 by root, Mon Jun 26 15:40:15 2006 UTC

442 "use cf;" 442 "use cf;"
443 }; 443 };
444 444
445 perl = perl_alloc (); 445 perl = perl_alloc ();
446 perl_construct (perl); 446 perl_construct (perl);
447
448 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
447 449
448 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) 450 if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl))
449 { 451 {
450 printf ("unable to initialize perl-interpreter, continuing without.\n"); 452 printf ("unable to initialize perl-interpreter, continuing without.\n");
451 453
1127 const_iv (SOUND_CLOCK) 1129 const_iv (SOUND_CLOCK)
1128 const_iv (SOUND_TURN_HANDLE) 1130 const_iv (SOUND_TURN_HANDLE)
1129 const_iv (SOUND_FALL_HOLE) 1131 const_iv (SOUND_FALL_HOLE)
1130 const_iv (SOUND_DRINK_POISON) 1132 const_iv (SOUND_DRINK_POISON)
1131 const_iv (SOUND_CAST_SPELL_0) 1133 const_iv (SOUND_CAST_SPELL_0)
1134
1135 const_iv (MAP_FLUSH)
1136 const_iv (MAP_PLAYER_UNIQUE)
1137 const_iv (MAP_BLOCK)
1138 const_iv (MAP_STYLE)
1139 const_iv (MAP_OVERLAY)
1140
1141 const_iv (MAP_IN_MEMORY)
1142 const_iv (MAP_SWAPPED)
1143 const_iv (MAP_LOADING)
1144 const_iv (MAP_SAVING)
1132 }; 1145 };
1133 1146
1134 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1147 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1135 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 1148 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1136 1149
1324void 1337void
1325LOG (int level, char *msg) 1338LOG (int level, char *msg)
1326 PROTOTYPE: $$ 1339 PROTOTYPE: $$
1327 C_ARGS: level, "%s", msg 1340 C_ARGS: level, "%s", msg
1328 1341
1342char *path_combine (char *base, char *path)
1343 PROTOTYPE: $$
1344
1345char *path_combine_and_normalize (char *base, char *path)
1346 PROTOTYPE: $$
1347
1329char * 1348char *
1330cf_get_maps_directory (char *path) 1349cf_get_maps_directory (char *path)
1331 PROTOTYPE: $ 1350 PROTOTYPE: $
1332 ALIAS: maps_directory = 0 1351 ALIAS: maps_directory = 0
1333 1352
1644player *next (player *pl) 1663player *next (player *pl)
1645 CODE: 1664 CODE:
1646 RETVAL = pl->next; 1665 RETVAL = pl->next;
1647 OUTPUT: RETVAL 1666 OUTPUT: RETVAL
1648 1667
1668bool
1669cell_visible (player *pl, int dx, int dy)
1670 CODE:
1671 RETVAL = FABS (dx) <= pl->socket.mapx / 2 && FABS (dy) <= pl->socket.mapy / 2
1672 && !pl->blocked_los [dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2];
1673 OUTPUT:
1674 RETVAL
1675
1649void 1676void
1650send (player *pl, SV *packet) 1677send (player *pl, SV *packet)
1651 CODE: 1678 CODE:
1652{ 1679{
1653 STRLEN len; 1680 STRLEN len;
1750 1777
1751mapstruct *cf_map_get_map (char *name) 1778mapstruct *cf_map_get_map (char *name)
1752 PROTOTYPE: $ 1779 PROTOTYPE: $
1753 ALIAS: map = 0 1780 ALIAS: map = 0
1754 1781
1782mapstruct *has_been_loaded (char *name)
1783 PROTOTYPE: $
1784
1755mapstruct *cf_map_get_first () 1785mapstruct *cf_map_get_first ()
1756 PROTOTYPE: 1786 PROTOTYPE:
1757 ALIAS: first = 0 1787 ALIAS: first = 0
1758 1788
1759# whoever "designed" the plug-in api should have wasted 1789# whoever "designed" the plug-in api should have wasted
1760# his/her time with staying away form the project - would have 1790# his/her time with staying away from the project - would have
1761# saved others a lot of time, without doubt. 1791# saved others a lot of time, without doubt.
1762void set_path (mapstruct *where, char *path) 1792void set_path (mapstruct *where, char *path)
1763 CODE: 1793 CODE:
1764 strcpy (where->path, path); 1794 strcpy (where->path, path);
1795
1796int in_memory (mapstruct *map)
1797 CODE:
1798 RETVAL = map->in_memory;
1799 OUTPUT:
1800 RETVAL
1765 1801
1766bool unique (mapstruct *map) 1802bool unique (mapstruct *map)
1767 CODE: 1803 CODE:
1768 RETVAL = map->unique; 1804 RETVAL = map->unique;
1769 OUTPUT: 1805 OUTPUT:
1778object *cf_map_insert_object (mapstruct *where, object* op, int x, int y) 1814object *cf_map_insert_object (mapstruct *where, object* op, int x, int y)
1779 1815
1780object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) 1816object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny)
1781 C_ARGS: str, map, nx, ny 1817 C_ARGS: str, map, nx, ny
1782 1818
1783#int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny)
1784
1785void 1819void
1820cf_map_normalise (mapstruct *map, int x, int y)
1821 PPCODE:
1822{
1823 mapstruct *nmap = 0;
1824 I16 nx = 0, ny = 0;
1825 int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny);
1826
1827 EXTEND (SP, 4);
1828 PUSHs (sv_2mortal (newSViv (flags)));
1829
1830 if (GIMME_V == G_ARRAY)
1831 {
1832 PUSHs (sv_2mortal (newSVcfapi (CFAPI_PMAP, nmap)));
1833 PUSHs (sv_2mortal (newSViv (nx)));
1834 PUSHs (sv_2mortal (newSViv (ny)));
1835 }
1836}
1837
1838void
1786at (mapstruct *obj, unsigned int x, unsigned int y) 1839at (mapstruct *map, unsigned int x, unsigned int y)
1787 PROTOTYPE: $$$ 1840 PROTOTYPE: $$$
1788 INIT:
1789 if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_EMPTY;
1790 PPCODE: 1841 PPCODE:
1791{ 1842{
1792 object *o; 1843 object *o;
1793 1844 mapstruct *nmap = 0;
1845 I16 nx, ny;
1846
1847 cf_map_get_flags (map, &nmap, x, y, &nx, &ny);
1848
1849 if (nmap)
1794 for (o = GET_MAP_OB (obj, x, y); o; o = o->above) 1850 for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above)
1795 XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); 1851 XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o)));
1796} 1852}
1797 1853
1798SV * 1854SV *
1799bot_at (mapstruct *obj, unsigned int x, unsigned int y) 1855bot_at (mapstruct *obj, unsigned int x, unsigned int y)
1800 PROTOTYPE: $$$ 1856 PROTOTYPE: $$$

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines