… | |
… | |
168 | } |
168 | } |
169 | |
169 | |
170 | void |
170 | void |
171 | attachable::do_destroy () |
171 | attachable::do_destroy () |
172 | { |
172 | { |
173 | invoke (EVENT_ATTACHABLE_DESTROY, DT_END); |
173 | INVOKE_ATTACHABLE (DESTROY, this); |
174 | |
174 | |
175 | if (cb) |
175 | if (cb) |
176 | { |
176 | { |
177 | SvREFCNT_dec (cb); |
177 | SvREFCNT_dec (cb); |
178 | cb = 0; |
178 | cb = 0; |
… | |
… | |
655 | void |
655 | void |
656 | attachable::instantiate () |
656 | attachable::instantiate () |
657 | { |
657 | { |
658 | if (attach) |
658 | if (attach) |
659 | { |
659 | { |
660 | invoke (EVENT_ATTACHABLE_INSTANTIATE, ARG_STRING (attach), DT_END); |
660 | INVOKE_ATTACHABLE (INSTANTIATE, this, ARG_STRING (attach)); |
661 | attach = 0; |
661 | attach = 0; |
662 | } |
662 | } |
663 | } |
663 | } |
664 | |
664 | |
665 | void |
665 | void |
666 | attachable::reattach () |
666 | attachable::reattach () |
667 | { |
667 | { |
668 | optimise (); |
668 | optimise (); |
669 | //TODO: check for _attachment's, very important for restarts |
669 | //TODO: check for _attachment's, very important for restarts |
670 | invoke (EVENT_ATTACHABLE_REATTACH, DT_END); |
670 | INVOKE_ATTACHABLE (REATTACH, this); |
671 | } |
671 | } |
672 | |
672 | |
673 | static event_klass klass_of[NUM_EVENT_TYPES] = { |
673 | static event_klass klass_of[NUM_EVENT_TYPES] = { |
674 | # define def(type,name) KLASS_ ## type, |
674 | # define def(type,name) KLASS_ ## type, |
675 | # include "eventinc.h" |
675 | # include "eventinc.h" |
… | |
… | |
823 | } |
823 | } |
824 | } |
824 | } |
825 | } |
825 | } |
826 | |
826 | |
827 | bool |
827 | bool |
828 | attachable::vinvoke (event_type event, va_list &ap) |
828 | attachable::invoke (event_type event, ...) |
829 | { |
829 | { |
830 | data_type dt; |
830 | data_type dt; |
831 | |
831 | |
832 | // callback call ordering should be: |
832 | // callback call ordering should be: |
833 | // 1. per-object callback |
833 | // 1. per-object callback |
… | |
… | |
839 | gather_callbacks (callbacks, event); |
839 | gather_callbacks (callbacks, event); |
840 | |
840 | |
841 | // short-circuit processing if no callbacks found/defined |
841 | // short-circuit processing if no callbacks found/defined |
842 | if (!callbacks) |
842 | if (!callbacks) |
843 | return 0; |
843 | return 0; |
|
|
844 | |
|
|
845 | va_list ap; |
|
|
846 | va_start (ap, event); |
844 | |
847 | |
845 | CALL_BEGIN (3); |
848 | CALL_BEGIN (3); |
846 | CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays |
849 | CALL_ARG_SV (newSViv (event)); // only used for debugging nowadays |
847 | CALL_ARG_SV (newRV_noinc ((SV *)callbacks)); |
850 | CALL_ARG_SV (newRV_noinc ((SV *)callbacks)); |
848 | |
851 | |
… | |
… | |
2395 | rmp.decoroptions = decoroptions; |
2398 | rmp.decoroptions = decoroptions; |
2396 | rmp.orientation = orientation; |
2399 | rmp.orientation = orientation; |
2397 | rmp.origin_y = origin_y; |
2400 | rmp.origin_y = origin_y; |
2398 | rmp.origin_x = origin_x; |
2401 | rmp.origin_x = origin_x; |
2399 | rmp.random_seed = random_seed; |
2402 | rmp.random_seed = random_seed; |
2400 | rmp.total_map_hp = total_map_hp; |
2403 | rmp.total_map_hp = (uint64_t) total_map_hp; |
2401 | rmp.map_layout_style = map_layout_style; |
2404 | rmp.map_layout_style = map_layout_style; |
2402 | rmp.treasureoptions = treasureoptions; |
2405 | rmp.treasureoptions = treasureoptions; |
2403 | rmp.symmetry_used = symmetry_used; |
2406 | rmp.symmetry_used = symmetry_used; |
2404 | rmp.region = region; |
2407 | rmp.region = region; |
2405 | rmp.custom = custom; |
2408 | rmp.custom = custom; |