… | |
… | |
65 | typedef struct |
65 | typedef struct |
66 | { |
66 | { |
67 | object* who; |
67 | object* who; |
68 | object* activator; |
68 | object* activator; |
69 | object* third; |
69 | object* third; |
|
|
70 | object* event; |
70 | mapstruct* map; |
71 | mapstruct* map; |
71 | char message[1024]; |
72 | char message[1024]; |
72 | int fix; // seems to be python-only, and should not be part of the API |
73 | int fix; // seems to be python-only, and should not be part of the API |
73 | int event_code; |
74 | int event_code; |
74 | char extension[1024]; // name field, should invoke specific perl extension |
75 | char extension[1024]; // name field, should invoke specific perl extension |
… | |
… | |
310 | HV *hv = newHV (); |
311 | HV *hv = newHV (); |
311 | #define hv_context(type,addr,expr) hv_store (hv, #expr, sizeof (#expr) - 1, newSVcfapi (type, addr context->expr), 0) |
312 | #define hv_context(type,addr,expr) hv_store (hv, #expr, sizeof (#expr) - 1, newSVcfapi (type, addr context->expr), 0) |
312 | hv_context (CFAPI_POBJECT, ,who); |
313 | hv_context (CFAPI_POBJECT, ,who); |
313 | hv_context (CFAPI_POBJECT, ,activator); |
314 | hv_context (CFAPI_POBJECT, ,activator); |
314 | hv_context (CFAPI_POBJECT, ,third); |
315 | hv_context (CFAPI_POBJECT, ,third); |
|
|
316 | hv_context (CFAPI_POBJECT, ,event); |
315 | hv_context (CFAPI_PMAP, ,map); |
317 | hv_context (CFAPI_PMAP, ,map); |
316 | hv_context (CFAPI_STRING , ,message); |
318 | hv_context (CFAPI_STRING , ,message); |
317 | hv_context (CFAPI_INT ,&,fix); |
319 | hv_context (CFAPI_INT ,&,fix); |
318 | hv_context (CFAPI_INT ,&,event_code); |
320 | hv_context (CFAPI_INT ,&,event_code); |
319 | hv_context (CFAPI_STRING , ,options); |
321 | hv_context (CFAPI_STRING , ,options); |
… | |
… | |
617 | { |
619 | { |
618 | static int rv = 0; |
620 | static int rv = 0; |
619 | va_list args; |
621 | va_list args; |
620 | char *buf; |
622 | char *buf; |
621 | CFPContext context; |
623 | CFPContext context; |
622 | object *eob; |
|
|
623 | |
624 | |
624 | if (!perl) |
625 | if (!perl) |
625 | return; |
626 | return; |
626 | |
627 | |
627 | memset (&context, 0, sizeof (context)); |
628 | memset (&context, 0, sizeof (context)); |
… | |
… | |
638 | strncpy (context.message, buf, sizeof (context.message)); |
639 | strncpy (context.message, buf, sizeof (context.message)); |
639 | |
640 | |
640 | context.fix = va_arg (args, int); |
641 | context.fix = va_arg (args, int); |
641 | strncpy (context.extension, va_arg (args, char *), sizeof (context.extension)); |
642 | strncpy (context.extension, va_arg (args, char *), sizeof (context.extension)); |
642 | strncpy (context.options, va_arg (args, char *), sizeof (context.options)); |
643 | strncpy (context.options, va_arg (args, char *), sizeof (context.options)); |
643 | eob = va_arg (args, object *); |
644 | context.event = va_arg (args, object *); |
|
|
645 | va_end (args); |
|
|
646 | |
644 | context.returnvalue = 0; |
647 | context.returnvalue = 0; |
645 | va_end (args); |
|
|
646 | |
648 | |
647 | inject_event ("cf::inject_event", &context); |
649 | inject_event ("cf::inject_event", &context); |
648 | |
650 | |
649 | rv = context.returnvalue; |
651 | rv = context.returnvalue; |
650 | return &rv; |
652 | return &rv; |
… | |
… | |
1634 | player *pl; |
1636 | player *pl; |
1635 | for (pl = first_player; pl; pl = pl->next) |
1637 | for (pl = first_player; pl; pl = pl->next) |
1636 | XPUSHs (newSVcfapi (CFAPI_PPLAYER, pl)); |
1638 | XPUSHs (newSVcfapi (CFAPI_PPLAYER, pl)); |
1637 | } |
1639 | } |
1638 | |
1640 | |
|
|
1641 | bool |
|
|
1642 | peaceful (player *pl, bool new_setting = 0) |
|
|
1643 | PROTOTYPE: $;$ |
|
|
1644 | CODE: |
|
|
1645 | RETVAL = pl->peaceful; |
|
|
1646 | if (items > 1) |
|
|
1647 | pl->peaceful = new_setting; |
|
|
1648 | OUTPUT: |
|
|
1649 | RETVAL |
|
|
1650 | |
1639 | living * |
1651 | living * |
1640 | orig_stats (player *pl) |
1652 | orig_stats (player *pl) |
1641 | CODE: |
1653 | CODE: |
1642 | RETVAL = &pl->orig_stats; |
1654 | RETVAL = &pl->orig_stats; |
1643 | OUTPUT: RETVAL |
1655 | OUTPUT: RETVAL |