… | |
… | |
59 | |
59 | |
60 | typedef double val64; |
60 | typedef double val64; |
61 | #define newSVval64 newSVnv |
61 | #define newSVval64 newSVnv |
62 | #define SvVAL64 SvNV |
62 | #define SvVAL64 SvNV |
63 | |
63 | |
64 | static f_plug_api gethook; |
64 | static f_plug_api gethook = cfapi_get_hooks; |
65 | static f_plug_api systemDirectory; |
65 | static f_plug_api object_set_property = cfapi_object_set_property; |
66 | static f_plug_api object_set_property; |
66 | static f_plug_api map_get_map = cfapi_map_get_map; |
67 | static f_plug_api map_get_map; |
67 | static f_plug_api object_insert = cfapi_object_insert; |
68 | static f_plug_api object_insert; |
|
|
69 | |
68 | |
70 | /* this is a stupid way to do things, and awkward to use for plug-in authors */ |
69 | /* this is a stupid way to do things, and awkward to use for plug-in authors */ |
71 | typedef struct |
70 | typedef struct |
72 | { |
71 | { |
73 | object* who; |
72 | object* who; |
… | |
… | |
481 | |
480 | |
482 | ///////////////////////////////////////////////////////////////////////////// |
481 | ///////////////////////////////////////////////////////////////////////////// |
483 | |
482 | |
484 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
483 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
485 | { |
484 | { |
486 | gethook = gethooksptr; |
|
|
487 | |
|
|
488 | return 0; |
485 | return 0; |
489 | } |
486 | } |
490 | |
487 | |
491 | static CommArray_s rtn_cmd; |
488 | static CommArray_s rtn_cmd; |
492 | |
489 | |
… | |
… | |
571 | |
568 | |
572 | extern "C" int cfperl_postInitPlugin () |
569 | extern "C" int cfperl_postInitPlugin () |
573 | { |
570 | { |
574 | int hooktype = 1; |
571 | int hooktype = 1; |
575 | int rtype = 0; |
572 | int rtype = 0; |
576 | |
|
|
577 | systemDirectory = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_system_directory"); |
|
|
578 | object_set_property = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_set_property"); |
|
|
579 | map_get_map = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_map_get_map"); |
|
|
580 | object_insert = (void* (*)(int*, ...)) gethook (&rtype, hooktype, "cfapi_object_insert"); |
|
|
581 | |
573 | |
582 | cf_init_plugin (gethook); |
574 | cf_init_plugin (gethook); |
583 | |
575 | |
584 | return 0; |
576 | return 0; |
585 | } |
577 | } |
… | |
… | |
1521 | PROTOTYPE: $$ |
1513 | PROTOTYPE: $$ |
1522 | |
1514 | |
1523 | char *path_combine_and_normalize (char *base, char *path) |
1515 | char *path_combine_and_normalize (char *base, char *path) |
1524 | PROTOTYPE: $$ |
1516 | PROTOTYPE: $$ |
1525 | |
1517 | |
1526 | char * |
1518 | const char * |
1527 | cf_get_maps_directory (char *path) |
1519 | get_maps_directory (char *path) |
1528 | PROTOTYPE: $ |
1520 | PROTOTYPE: $ |
1529 | ALIAS: maps_directory = 0 |
1521 | ALIAS: maps_directory = 0 |
|
|
1522 | CODE: |
|
|
1523 | RETVAL = create_pathname (path); |
|
|
1524 | OUTPUT: RETVAL |
1530 | |
1525 | |
1531 | void |
1526 | void |
1532 | sub_generation_inc () |
1527 | sub_generation_inc () |
1533 | CODE: |
1528 | CODE: |
1534 | PL_sub_generation++; |
1529 | PL_sub_generation++; |
… | |
… | |
1543 | confdir = 3 |
1538 | confdir = 3 |
1544 | localdir = 4 |
1539 | localdir = 4 |
1545 | playerdir = 5 |
1540 | playerdir = 5 |
1546 | datadir = 6 |
1541 | datadir = 6 |
1547 | CODE: |
1542 | CODE: |
1548 | { |
1543 | switch (ix) |
1549 | int unused_type; |
1544 | { |
1550 | RETVAL = (char *)systemDirectory (&unused_type, ix); |
1545 | case 0: RETVAL = settings.mapdir ; break; |
1551 | } |
1546 | case 1: RETVAL = settings.uniquedir; break; |
|
|
1547 | case 2: RETVAL = settings.tmpdir ; break; |
|
|
1548 | case 3: RETVAL = settings.confdir ; break; |
|
|
1549 | case 4: RETVAL = settings.localdir ; break; |
|
|
1550 | case 5: RETVAL = settings.playerdir; break; |
|
|
1551 | case 6: RETVAL = settings.datadir ; break; |
|
|
1552 | } |
1552 | OUTPUT: RETVAL |
1553 | OUTPUT: RETVAL |
1553 | |
1554 | |
1554 | int |
1555 | int |
1555 | cf_find_animation (char *text) |
1556 | cf_find_animation (char *text) |
1556 | PROTOTYPE: $ |
1557 | PROTOTYPE: $ |
… | |
… | |
2154 | cf_map_normalise (mapstruct *map, int x, int y) |
2155 | cf_map_normalise (mapstruct *map, int x, int y) |
2155 | PPCODE: |
2156 | PPCODE: |
2156 | { |
2157 | { |
2157 | mapstruct *nmap = 0; |
2158 | mapstruct *nmap = 0; |
2158 | I16 nx = 0, ny = 0; |
2159 | I16 nx = 0, ny = 0; |
2159 | int flags = cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2160 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
2160 | |
2161 | |
2161 | EXTEND (SP, 4); |
2162 | EXTEND (SP, 4); |
2162 | PUSHs (sv_2mortal (newSViv (flags))); |
2163 | PUSHs (sv_2mortal (newSViv (flags))); |
2163 | |
2164 | |
2164 | if (GIMME_V == G_ARRAY) |
2165 | if (GIMME_V == G_ARRAY) |
… | |
… | |
2176 | { |
2177 | { |
2177 | object *o; |
2178 | object *o; |
2178 | mapstruct *nmap = 0; |
2179 | mapstruct *nmap = 0; |
2179 | I16 nx, ny; |
2180 | I16 nx, ny; |
2180 | |
2181 | |
2181 | cf_map_get_flags (map, &nmap, x, y, &nx, &ny); |
2182 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
2182 | |
2183 | |
2183 | if (nmap) |
2184 | if (nmap) |
2184 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2185 | for (o = GET_MAP_OB (nmap, nx, ny); o; o = o->above) |
2185 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2186 | XPUSHs (sv_2mortal (newSVcfapi (CFAPI_POBJECT, o))); |
2186 | } |
2187 | } |
… | |
… | |
2245 | } |
2246 | } |
2246 | } |
2247 | } |
2247 | } |
2248 | } |
2248 | |
2249 | |
2249 | |
2250 | |
2250 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
2251 | MODULE = cf PACKAGE = cf::arch |
2251 | |
2252 | |
2252 | archetype *cf_archetype_get_first() |
2253 | archetype *first() |
2253 | PROTOTYPE: |
2254 | PROTOTYPE: |
2254 | ALIAS: first = 0 |
2255 | CODE: |
|
|
2256 | RETVAL = first_archetype; |
|
|
2257 | OUTPUT: RETVAL |
2255 | |
2258 | |
2256 | archetype *cf_archetype_get_next (archetype *arch) |
2259 | archetype *next (archetype *arch) |
2257 | ALIAS: next = 0 |
2260 | CODE: |
|
|
2261 | RETVAL = arch->next; |
|
|
2262 | OUTPUT: RETVAL |
2258 | |
2263 | |
2259 | archetype *cf_archetype_get_head (archetype *arch) |
2264 | archetype *head (archetype *arch) |
2260 | ALIAS: head = 0 |
2265 | CODE: |
|
|
2266 | RETVAL = arch->head; |
|
|
2267 | OUTPUT: RETVAL |
2261 | |
2268 | |
2262 | archetype *cf_archetype_get_more (archetype *arch) |
2269 | archetype *more (archetype *arch) |
2263 | ALIAS: more = 0 |
2270 | CODE: |
|
|
2271 | RETVAL = arch->more; |
|
|
2272 | OUTPUT: RETVAL |
2264 | |
2273 | |
2265 | const char *cf_archetype_get_name (archetype *arch) |
2274 | const char *name (archetype *arch) |
2266 | ALIAS: name = 0 |
2275 | CODE: |
|
|
2276 | RETVAL = arch->name; |
|
|
2277 | OUTPUT: RETVAL |
2267 | |
2278 | |
2268 | object *cf_archetype_get_clone (archetype *arch) |
2279 | object *clone (archetype *arch) |
2269 | ALIAS: clone = 0 |
2280 | CODE: |
|
|
2281 | RETVAL = &arch->clone; |
|
|
2282 | OUTPUT: RETVAL |
2270 | |
2283 | |
2271 | MODULE = cf PACKAGE = cf::party PREFIX = cf_party_ |
2284 | MODULE = cf PACKAGE = cf::party |
2272 | |
2285 | |
2273 | partylist *cf_party_get_first () |
2286 | partylist *first () |
2274 | PROTOTYPE: |
2287 | PROTOTYPE: |
2275 | ALIAS: first = 0 |
2288 | CODE: |
|
|
2289 | RETVAL = get_firstparty (); |
|
|
2290 | OUTPUT: RETVAL |
2276 | |
2291 | |
2277 | partylist *cf_party_get_next (partylist *party) |
2292 | partylist *next (partylist *party) |
2278 | ALIAS: next = 0 |
2293 | CODE: |
|
|
2294 | RETVAL = party->next; |
|
|
2295 | OUTPUT: RETVAL |
2279 | |
2296 | |
2280 | const char *cf_party_get_name (partylist *party) |
2297 | const char *name (partylist *party) |
|
|
2298 | CODE: |
|
|
2299 | RETVAL = party->partyname; |
|
|
2300 | OUTPUT: RETVAL |
2281 | |
2301 | |
2282 | const char *cf_party_get_password (partylist *party) |
2302 | const char *password (partylist *party) |
2283 | ALIAS: password = 0 |
2303 | CODE: |
|
|
2304 | RETVAL = party->passwd; |
|
|
2305 | OUTPUT: RETVAL |
2284 | |
2306 | |
2285 | player *cf_party_get_first_player (partylist *party) |
2307 | MODULE = cf PACKAGE = cf::region |
2286 | ALIAS: first_player = 0 |
|
|
2287 | |
2308 | |
2288 | player *cf_party_get_next_player (partylist *party, player *op) |
2309 | region *first () |
2289 | ALIAS: next_player = 0 |
|
|
2290 | |
|
|
2291 | |
|
|
2292 | MODULE = cf PACKAGE = cf::region PREFIX = cf_region_ |
|
|
2293 | |
|
|
2294 | region *cf_region_get_first () |
|
|
2295 | PROTOTYPE: |
2310 | PROTOTYPE: |
2296 | ALIAS: first = 0 |
2311 | CODE: |
|
|
2312 | RETVAL = first_region; |
|
|
2313 | OUTPUT: RETVAL |
2297 | |
2314 | |
|
|
2315 | region *next (region *reg) |
|
|
2316 | CODE: |
|
|
2317 | RETVAL = reg->next; |
|
|
2318 | OUTPUT: RETVAL |
|
|
2319 | |
|
|
2320 | const char *name (region *reg) |
|
|
2321 | CODE: |
|
|
2322 | RETVAL = reg->name; |
|
|
2323 | OUTPUT: RETVAL |
|
|
2324 | |
|
|
2325 | region *parent (region *reg) |
|
|
2326 | CODE: |
|
|
2327 | RETVAL = reg->parent; |
|
|
2328 | OUTPUT: RETVAL |
|
|
2329 | |
2298 | const char *cf_region_get_name (region *reg) |
2330 | const char *longname (region *reg) |
2299 | ALIAS: name = 0 |
2331 | CODE: |
|
|
2332 | RETVAL = reg->longname; |
|
|
2333 | OUTPUT: RETVAL |
2300 | |
2334 | |
2301 | region *cf_region_get_next (region *reg) |
2335 | const char *msg (region *reg) |
2302 | ALIAS: next = 0 |
2336 | CODE: |
|
|
2337 | RETVAL = reg->msg; |
|
|
2338 | OUTPUT: RETVAL |
2303 | |
2339 | |
2304 | region *cf_region_get_parent (region *reg) |
2340 | MODULE = cf PACKAGE = cf::living |
2305 | ALIAS: parent = 0 |
|
|
2306 | |
|
|
2307 | const char *cf_region_get_longname (region *reg) |
|
|
2308 | ALIAS: longname = 0 |
|
|
2309 | |
|
|
2310 | const char *cf_region_get_message (region *reg) |
|
|
2311 | ALIAS: message = 0 |
|
|
2312 | |
|
|
2313 | |
|
|
2314 | MODULE = cf PACKAGE = cf::living PREFIX = cf_living_ |
|
|
2315 | |
2341 | |
2316 | val64 |
2342 | val64 |
2317 | exp (living *liv, val64 new_val = 0) |
2343 | exp (living *liv, val64 new_val = 0) |
2318 | PROTOTYPE: $;$ |
2344 | PROTOTYPE: $;$ |
2319 | ALIAS: |
2345 | ALIAS: |