… | |
… | |
29 | #include <plugin_common.h> |
29 | #include <plugin_common.h> |
30 | #include <sounds.h> |
30 | #include <sounds.h> |
31 | #include <cstdarg> |
31 | #include <cstdarg> |
32 | #include <sproto.h> |
32 | #include <sproto.h> |
33 | |
33 | |
|
|
34 | #include "loader.h" |
34 | #include "cfperl.h" |
35 | #include "cfperl.h" |
35 | #include "shstr.h" |
36 | #include "shstr.h" |
|
|
37 | |
|
|
38 | #include <unistd.h> |
|
|
39 | #if _POSIX_MEMLOCK |
|
|
40 | # include <sys/mman.h> |
|
|
41 | #endif |
36 | |
42 | |
37 | #include <EXTERN.h> |
43 | #include <EXTERN.h> |
38 | #include <perl.h> |
44 | #include <perl.h> |
39 | #include <XSUB.h> |
45 | #include <XSUB.h> |
40 | |
46 | |
… | |
… | |
94 | |
100 | |
95 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
101 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
96 | |
102 | |
97 | unordered_vector<attachable *> attachable::mortals; |
103 | unordered_vector<attachable *> attachable::mortals; |
98 | |
104 | |
99 | #if 0 |
|
|
100 | attachable *attachable::rc_first; |
|
|
101 | |
|
|
102 | attachable::attachable () |
|
|
103 | { |
|
|
104 | refcnt = 0; |
|
|
105 | rc_next = rc_first; |
|
|
106 | rc_first = this; |
|
|
107 | } |
|
|
108 | #endif |
|
|
109 | |
|
|
110 | attachable::~attachable () |
105 | attachable::~attachable () |
111 | { |
106 | { |
112 | assert (!(flags & F_BORROWED));//D//TODO//remove when stable |
|
|
113 | #if 0 |
|
|
114 | assert (!rc_next); |
|
|
115 | assert (!refcnt); |
107 | assert (!self); |
116 | #endif |
108 | assert (!cb); |
|
|
109 | } |
|
|
110 | |
|
|
111 | int |
|
|
112 | attachable::refcnt_cnt () const |
|
|
113 | { |
|
|
114 | return refcnt + (self ? SvREFCNT (self) - 1 : 0); |
|
|
115 | } |
|
|
116 | |
|
|
117 | void |
|
|
118 | attachable::sever_self () |
|
|
119 | { |
|
|
120 | if (HV *self = this->self) |
|
|
121 | { |
|
|
122 | // keep a refcount because sv_unmagic might call attachable_free, |
|
|
123 | // which might clear self, causing sv_unmagic to crash on a now |
|
|
124 | // invalid object. |
|
|
125 | SvREFCNT_inc (self); |
|
|
126 | hv_clear (self); |
|
|
127 | sv_unmagic ((SV *)self, PERL_MAGIC_ext); |
|
|
128 | SvREFCNT_dec (self); |
|
|
129 | |
|
|
130 | // self *must* be null now because thats sv_unmagic's job. |
|
|
131 | assert (!this->self); |
|
|
132 | } |
|
|
133 | } |
|
|
134 | |
|
|
135 | void |
|
|
136 | attachable::optimise () |
|
|
137 | { |
|
|
138 | if (self |
|
|
139 | && SvREFCNT (self) == 1 |
|
|
140 | && !HvTOTALKEYS (self)) |
|
|
141 | sever_self (); |
117 | } |
142 | } |
118 | |
143 | |
119 | // check wether the object really is dead |
144 | // check wether the object really is dead |
120 | void |
145 | void |
121 | attachable::do_check () |
146 | attachable::do_check () |
122 | { |
147 | { |
123 | if (refcnt > 0) |
148 | if (refcnt_cnt () > 0) |
124 | return; |
149 | return; |
125 | |
150 | |
126 | // try to unborrow the refcnt from perl |
151 | destroy (); |
127 | if (flags & F_BORROWED) |
152 | } |
|
|
153 | |
|
|
154 | void |
|
|
155 | attachable::do_destroy () |
|
|
156 | { |
|
|
157 | invoke (EVENT_ATTACHABLE_DESTROY, DT_END); |
|
|
158 | |
|
|
159 | if (cb) |
128 | { |
160 | { |
129 | assert (self);//D//TODO//remove when stable |
|
|
130 | flags &= ~F_BORROWED; |
|
|
131 | refcnt_inc (); |
|
|
132 | SvREFCNT_dec (self); |
161 | SvREFCNT_dec (cb); |
|
|
162 | cb = 0; |
133 | } |
163 | } |
134 | |
164 | |
135 | if (refcnt > 0 || self) |
165 | if (self) |
136 | return; |
166 | sever_self (); |
137 | |
167 | |
138 | destroy (); |
|
|
139 | } |
|
|
140 | |
|
|
141 | void |
|
|
142 | attachable::do_destroy () |
|
|
143 | { |
|
|
144 | invoke (EVENT_ATTACHABLE_DESTROY, DT_END); |
|
|
145 | |
|
|
146 | //TODO: call generic destroy callback |
|
|
147 | mortals.push_back (this); |
168 | mortals.push_back (this); |
148 | } |
169 | } |
149 | |
170 | |
150 | void |
171 | void |
151 | attachable::destroy () |
172 | attachable::destroy () |
… | |
… | |
155 | |
176 | |
156 | flags |= F_DESTROYED; |
177 | flags |= F_DESTROYED; |
157 | do_destroy (); |
178 | do_destroy (); |
158 | } |
179 | } |
159 | |
180 | |
|
|
181 | void |
160 | void attachable::check_mortals () |
182 | attachable::check_mortals () |
161 | { |
183 | { |
162 | for (int i = 0; i < mortals.size (); ) |
184 | static int i = 0; |
|
|
185 | |
|
|
186 | for (;;) |
163 | { |
187 | { |
|
|
188 | if (i >= mortals.size ()) |
|
|
189 | { |
|
|
190 | i = 0; |
|
|
191 | |
|
|
192 | if (mortals.size () > 1000) |
|
|
193 | fprintf (stderr, "mortal queue size (%d) exceeds 1000.\n", (int)mortals.size ()); |
|
|
194 | |
|
|
195 | break; |
|
|
196 | } |
|
|
197 | |
164 | attachable *obj = mortals [i]; |
198 | attachable *obj = mortals [i]; |
165 | |
199 | |
166 | obj->refcnt_chk (); // unborrow from perl, if necessary |
200 | obj->refcnt_chk (); // unborrow from perl, if necessary |
167 | |
201 | |
|
|
202 | //if (obj->refcnt > 0 || obj->self) |
168 | if (obj->refcnt || obj->self) |
203 | if (obj->refcnt || obj->self) |
169 | { |
204 | { |
170 | #if 0 |
205 | //printf ("%p rc %d\n", obj, obj->refcnt_cnt ());//D |
171 | if (mortals.size() > 5)fprintf (stderr, "%d delaying %d:%p:%s %d (self %p:%d)\n", time(0),i, obj, typeid (*obj).name (), |
|
|
172 | obj->refcnt, obj->self, obj->self ? SvREFCNT(obj->self): - 1);//D |
|
|
173 | #endif |
|
|
174 | |
|
|
175 | ++i; // further delay freeing |
206 | ++i; // further delay freeing |
|
|
207 | |
|
|
208 | if (!(i & 0x3ff)) |
|
|
209 | break; |
176 | }//D |
210 | } |
177 | else |
211 | else |
178 | { |
212 | { |
179 | //Dfprintf (stderr, "deleteing %d:%p:%s\n", i, obj,typeid (*obj).name ());//D |
|
|
180 | mortals.erase (i); |
213 | mortals.erase (i); |
181 | delete obj; |
214 | delete obj; |
182 | } |
215 | } |
183 | } |
216 | } |
184 | } |
217 | } |
… | |
… | |
209 | |
242 | |
210 | static int |
243 | static int |
211 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
244 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
212 | { |
245 | { |
213 | attachable *at = (attachable *)mg->mg_ptr; |
246 | attachable *at = (attachable *)mg->mg_ptr; |
214 | assert (!(at->flags & attachable::F_BORROWED));//D//TODO//remove when stable |
247 | |
|
|
248 | //TODO: check if transaction behaviour is really required here |
|
|
249 | if (SV *self = (SV *)at->self) |
|
|
250 | { |
215 | at->self = 0; |
251 | at->self = 0; |
|
|
252 | SvREFCNT_dec (self); |
|
|
253 | } |
|
|
254 | |
216 | // next line makes sense, but most objects still have refcnt 0 by default |
255 | // next line makes sense, but most objects still have refcnt 0 by default |
217 | //at->refcnt_chk (); |
256 | //at->refcnt_chk (); |
218 | return 0; |
257 | return 0; |
219 | } |
258 | } |
220 | |
259 | |
… | |
… | |
229 | if (!obj->self) |
268 | if (!obj->self) |
230 | { |
269 | { |
231 | obj->self = newHV (); |
270 | obj->self = newHV (); |
232 | sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); |
271 | sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); |
233 | |
272 | |
234 | // borrow the refcnt from the object |
273 | // now bless the object _once_ |
235 | obj->flags |= attachable::F_BORROWED; |
274 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
236 | obj->refcnt_dec (); |
|
|
237 | } |
275 | } |
|
|
276 | else |
|
|
277 | { |
|
|
278 | SV *sv = newRV_inc ((SV *)obj->self); |
238 | |
279 | |
239 | return sv_bless (newRV_inc ((SV *)obj->self), stash); |
280 | if (Gv_AMG (stash)) // handle overload correctly, as the perl core does not |
|
|
281 | SvAMAGIC_on (sv); |
|
|
282 | |
|
|
283 | return sv; |
|
|
284 | } |
240 | } |
285 | } |
241 | |
286 | |
242 | static void |
287 | static void |
243 | clearSVptr (SV *sv) |
288 | clearSVptr (SV *sv) |
244 | { |
289 | { |
… | |
… | |
297 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
342 | inline SV *to_sv (living * v) { return newSVptr (v, stash_cf_living_wrap); } |
298 | |
343 | |
299 | inline SV *to_sv (object & v) { return to_sv (&v); } |
344 | inline SV *to_sv (object & v) { return to_sv (&v); } |
300 | inline SV *to_sv (living & v) { return to_sv (&v); } |
345 | inline SV *to_sv (living & v) { return to_sv (&v); } |
301 | |
346 | |
302 | //TODO: |
|
|
303 | inline SV *to_sv (New_Face * v) { return to_sv (v->name); } |
347 | inline SV *to_sv (facetile * v) { return to_sv (v->name); } |
304 | inline SV *to_sv (treasurelist * v) { return to_sv (v->name); } |
348 | inline SV *to_sv (treasurelist * v) { return to_sv (v->name); } |
305 | |
349 | |
306 | inline SV *to_sv (UUID v) |
350 | inline SV *to_sv (UUID v) |
307 | { |
351 | { |
308 | char buf[128]; |
352 | char buf[128]; |
309 | snprintf (buf, 128, "<1,%" PRIx64 ">", v.seq); |
353 | snprintf (buf, 128, "<1.%" PRIx64 ">", v.seq); |
310 | return newSVpv (buf, 0); |
354 | return newSVpv (buf, 0); |
311 | } |
355 | } |
312 | |
356 | |
313 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } |
357 | inline void sv_to (SV *sv, shstr &v) { v = SvOK (sv) ? SvPV_nolen (sv) : 0; } |
314 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
358 | inline void sv_to (SV *sv, char * &v) { free (v); v = SvOK (sv) ? strdup (SvPV_nolen (sv)) : 0; } |
… | |
… | |
328 | inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); } |
372 | inline void sv_to (SV *sv, client * &v) { v = (client *)(attachable *)SvPTR_ornull (sv, "cf::client"); } |
329 | inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); } |
373 | inline void sv_to (SV *sv, player * &v) { v = (player *)(attachable *)SvPTR_ornull (sv, "cf::player"); } |
330 | inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); } |
374 | inline void sv_to (SV *sv, object * &v) { v = (object *)(attachable *)SvPTR_ornull (sv, "cf::object"); } |
331 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } |
375 | inline void sv_to (SV *sv, archetype * &v) { v = (archetype *)(attachable *)SvPTR_ornull (sv, "cf::arch"); } |
332 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } |
376 | inline void sv_to (SV *sv, maptile * &v) { v = (maptile *)(attachable *)SvPTR_ornull (sv, "cf::map"); } |
|
|
377 | inline void sv_to (SV *sv, attachable * &v) { v = (attachable *)SvPTR_ornull (sv, "cf::attachable"); } |
333 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
378 | inline void sv_to (SV *sv, partylist * &v) { v = (partylist *)SvPTR_ornull (sv, "cf::party"); } |
334 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
379 | inline void sv_to (SV *sv, region * &v) { v = (region *)SvPTR_ornull (sv, "cf::region"); } |
335 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
380 | inline void sv_to (SV *sv, living * &v) { v = (living *)SvPTR_ornull (sv, "cf::living"); } |
336 | |
381 | |
337 | inline void sv_to (SV *sv, New_Face * &v) { v = &new_faces[FindFace (SvPV_nolen (sv), 0)]; } //TODO |
382 | inline void sv_to (SV *sv, facetile * &v) { v = &new_faces[FindFace (SvPV_nolen (sv), 0)]; } |
338 | inline void sv_to (SV *sv, treasurelist * &v) { v = find_treasurelist (SvPV_nolen (sv)); } // TODO |
383 | inline void sv_to (SV *sv, treasurelist * &v) { v = find_treasurelist (SvPV_nolen (sv)); } |
339 | |
384 | |
340 | template<class T> |
385 | template<class T> |
341 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
386 | inline void sv_to (SV *sv, refptr<T> &v) { T *tmp; sv_to (sv, tmp); v = tmp; } |
342 | |
387 | |
343 | template<int N> |
388 | template<int N> |
… | |
… | |
478 | { |
523 | { |
479 | if (!ext->cb) |
524 | if (!ext->cb) |
480 | ext->cb = newAV (); |
525 | ext->cb = newAV (); |
481 | |
526 | |
482 | return newRV_inc ((SV *)ext->cb); |
527 | return newRV_inc ((SV *)ext->cb); |
483 | } |
|
|
484 | |
|
|
485 | #if 0 |
|
|
486 | void attachable::clear () |
|
|
487 | { |
|
|
488 | if (self) |
|
|
489 | { |
|
|
490 | // disconnect Perl from C, to avoid crashes |
|
|
491 | sv_unmagic (SvRV ((SV *)self), PERL_MAGIC_ext); |
|
|
492 | |
|
|
493 | // clear the perl hash, might or might not be a good idea |
|
|
494 | hv_clear ((HV *)SvRV ((SV *)self)); |
|
|
495 | |
|
|
496 | SvREFCNT_dec (self); |
|
|
497 | self = 0; |
|
|
498 | } |
|
|
499 | |
|
|
500 | if (cb) |
|
|
501 | { |
|
|
502 | SvREFCNT_dec (cb); |
|
|
503 | cb = 0; |
|
|
504 | } |
|
|
505 | |
|
|
506 | attach = 0; |
|
|
507 | } |
|
|
508 | #endif |
|
|
509 | |
|
|
510 | void attachable::optimise () |
|
|
511 | { |
|
|
512 | if (self |
|
|
513 | && SvREFCNT (self) == 1 |
|
|
514 | && !HvTOTALKEYS (self)) |
|
|
515 | { |
|
|
516 | flags &= ~F_BORROWED; |
|
|
517 | refcnt_inc (); |
|
|
518 | SvREFCNT_dec ((SV *)self); |
|
|
519 | } |
|
|
520 | } |
528 | } |
521 | |
529 | |
522 | ///////////////////////////////////////////////////////////////////////////// |
530 | ///////////////////////////////////////////////////////////////////////////// |
523 | |
531 | |
524 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
532 | extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr) |
… | |
… | |
597 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
605 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) || perl_run (perl)) |
598 | { |
606 | { |
599 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
607 | printf ("unable to initialize perl-interpreter, aborting.\n"); |
600 | exit (EXIT_FAILURE); |
608 | exit (EXIT_FAILURE); |
601 | } |
609 | } |
|
|
610 | |
|
|
611 | { |
|
|
612 | dSP; |
|
|
613 | |
|
|
614 | PUSHMARK (SP); |
|
|
615 | PUTBACK; |
|
|
616 | call_pv ("cf::init", G_DISCARD | G_VOID); |
|
|
617 | } |
602 | } |
618 | } |
603 | |
619 | |
604 | void cfperl_main () |
620 | void cfperl_main () |
605 | { |
621 | { |
606 | dSP; |
622 | dSP; |
… | |
… | |
820 | } |
836 | } |
821 | |
837 | |
822 | ///////////////////////////////////////////////////////////////////////////// |
838 | ///////////////////////////////////////////////////////////////////////////// |
823 | |
839 | |
824 | void |
840 | void |
825 | maptile::emergency_save () |
841 | cfperl_emergency_save () |
826 | { |
842 | { |
827 | CALL_BEGIN (0); |
843 | CALL_BEGIN (0); |
828 | CALL_CALL ("cf::map::emergency_save", G_VOID); |
844 | CALL_CALL ("cf::emergency_save", G_VOID); |
829 | CALL_END; |
845 | CALL_END; |
830 | } |
846 | } |
831 | |
847 | |
832 | maptile * |
848 | maptile * |
833 | maptile::load_map_sync (const char *path, maptile *origin) |
849 | maptile::find_sync (const char *path, maptile *origin) |
834 | { |
850 | { |
835 | CALL_BEGIN (2); |
851 | CALL_BEGIN (2); |
836 | CALL_ARG (path); |
852 | CALL_ARG (path); |
837 | CALL_ARG (origin); |
853 | CALL_ARG (origin); |
838 | CALL_CALL ("cf::map::load_map_sync", G_SCALAR); |
854 | CALL_CALL ("cf::map::find_sync", G_SCALAR); |
839 | |
855 | |
840 | maptile *retval; |
856 | maptile *retval; |
841 | |
857 | |
842 | if (count) |
858 | if (count) |
843 | sv_to (POPs, retval); |
859 | sv_to (POPs, retval); |
… | |
… | |
845 | retval = 0; |
861 | retval = 0; |
846 | |
862 | |
847 | CALL_END; |
863 | CALL_END; |
848 | |
864 | |
849 | return retval; |
865 | return retval; |
|
|
866 | } |
|
|
867 | |
|
|
868 | maptile * |
|
|
869 | maptile::find_async (const char *path, maptile *origin) |
|
|
870 | { |
|
|
871 | CALL_BEGIN (2); |
|
|
872 | CALL_ARG (path); |
|
|
873 | CALL_ARG (origin); |
|
|
874 | CALL_CALL ("cf::map::find_async", G_SCALAR); |
|
|
875 | |
|
|
876 | maptile *retval; |
|
|
877 | |
|
|
878 | if (count) |
|
|
879 | sv_to (POPs, retval); |
|
|
880 | else |
|
|
881 | retval = 0; |
|
|
882 | |
|
|
883 | CALL_END; |
|
|
884 | |
|
|
885 | return retval; |
|
|
886 | } |
|
|
887 | |
|
|
888 | void |
|
|
889 | maptile::do_load_sync () |
|
|
890 | { |
|
|
891 | CALL_BEGIN (1); |
|
|
892 | CALL_ARG (this); |
|
|
893 | CALL_CALL ("cf::map::do_load_sync", G_SCALAR); |
|
|
894 | CALL_END; |
850 | } |
895 | } |
851 | |
896 | |
852 | void |
897 | void |
853 | maptile::change_all_map_light (int change) |
898 | maptile::change_all_map_light (int change) |
854 | { |
899 | { |
… | |
… | |
887 | void |
932 | void |
888 | iw::alloc () |
933 | iw::alloc () |
889 | { |
934 | { |
890 | pe = GEventAPI->new_idle (0, 0); |
935 | pe = GEventAPI->new_idle (0, 0); |
891 | |
936 | |
|
|
937 | WaREENTRANT_off (pe); |
892 | pe->base.callback = (void *)iw_dispatch; |
938 | pe->base.callback = (void *)iw_dispatch; |
893 | pe->base.ext_data = (void *)this; |
939 | pe->base.ext_data = (void *)this; |
894 | } |
940 | } |
895 | |
941 | |
896 | static void iow_dispatch (pe_event *ev) |
942 | static void iow_dispatch (pe_event *ev) |
… | |
… | |
902 | void |
948 | void |
903 | iow::alloc () |
949 | iow::alloc () |
904 | { |
950 | { |
905 | pe = GEventAPI->new_io (0, 0); |
951 | pe = GEventAPI->new_io (0, 0); |
906 | |
952 | |
|
|
953 | WaREENTRANT_off (pe); |
907 | pe->base.callback = (void *)iow_dispatch; |
954 | pe->base.callback = (void *)iow_dispatch; |
908 | pe->base.ext_data = (void *)this; |
955 | pe->base.ext_data = (void *)this; |
909 | |
956 | |
910 | pe->fd = -1; |
957 | pe->fd = -1; |
911 | pe->poll = 0; |
958 | pe->poll = 0; |
… | |
… | |
1239 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1286 | const_iv (FLAG_ACTIVATE_ON_RELEASE) |
1240 | const_iv (FLAG_IS_WATER) |
1287 | const_iv (FLAG_IS_WATER) |
1241 | const_iv (FLAG_CONTENT_ON_GEN) |
1288 | const_iv (FLAG_CONTENT_ON_GEN) |
1242 | const_iv (FLAG_IS_A_TEMPLATE) |
1289 | const_iv (FLAG_IS_A_TEMPLATE) |
1243 | const_iv (FLAG_IS_BUILDABLE) |
1290 | const_iv (FLAG_IS_BUILDABLE) |
|
|
1291 | const_iv (FLAG_DESTROY_ON_DEATH) |
|
|
1292 | const_iv (FLAG_NO_MAP_SAVE) |
1244 | |
1293 | |
1245 | const_iv (NDI_BLACK) |
1294 | const_iv (NDI_BLACK) |
1246 | const_iv (NDI_WHITE) |
1295 | const_iv (NDI_WHITE) |
1247 | const_iv (NDI_NAVY) |
1296 | const_iv (NDI_NAVY) |
1248 | const_iv (NDI_RED) |
1297 | const_iv (NDI_RED) |
… | |
… | |
1433 | const_iv (ATNR_BLIND) |
1482 | const_iv (ATNR_BLIND) |
1434 | const_iv (ATNR_INTERNAL) |
1483 | const_iv (ATNR_INTERNAL) |
1435 | const_iv (ATNR_LIFE_STEALING) |
1484 | const_iv (ATNR_LIFE_STEALING) |
1436 | const_iv (ATNR_DISEASE) |
1485 | const_iv (ATNR_DISEASE) |
1437 | |
1486 | |
1438 | const_iv (MAP_FLUSH) |
|
|
1439 | const_iv (MAP_PLAYER_UNIQUE) |
|
|
1440 | const_iv (MAP_BLOCK) |
|
|
1441 | const_iv (MAP_STYLE) |
|
|
1442 | const_iv (MAP_OVERLAY) |
|
|
1443 | |
|
|
1444 | const_iv (MAP_IN_MEMORY) |
1487 | const_iv (MAP_IN_MEMORY) |
1445 | const_iv (MAP_SWAPPED) |
1488 | const_iv (MAP_SWAPPED) |
1446 | const_iv (MAP_LOADING) |
1489 | const_iv (MAP_LOADING) |
1447 | const_iv (MAP_SAVING) |
1490 | const_iv (MAP_SAVING) |
1448 | |
1491 | |
… | |
… | |
1461 | const_iv (ST_SETUP) |
1504 | const_iv (ST_SETUP) |
1462 | const_iv (ST_PLAYING) |
1505 | const_iv (ST_PLAYING) |
1463 | const_iv (ST_CUSTOM) |
1506 | const_iv (ST_CUSTOM) |
1464 | |
1507 | |
1465 | const_iv (ST_CHANGE_CLASS) |
1508 | const_iv (ST_CHANGE_CLASS) |
1466 | const_iv (ST_CONFIRM_QUIT) |
|
|
1467 | const_iv (ST_GET_PARTY_PASSWORD) |
|
|
1468 | |
1509 | |
1469 | const_iv (IO_HEADER) |
1510 | const_iv (IO_HEADER) |
1470 | const_iv (IO_OBJECTS) |
1511 | const_iv (IO_OBJECTS) |
1471 | const_iv (IO_UNIQUES) |
1512 | const_iv (IO_UNIQUES) |
1472 | |
1513 | |
… | |
… | |
1526 | |
1567 | |
1527 | void _global_reattach () |
1568 | void _global_reattach () |
1528 | CODE: |
1569 | CODE: |
1529 | { |
1570 | { |
1530 | // reattach to all attachable objects in the game. |
1571 | // reattach to all attachable objects in the game. |
1531 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) |
1572 | for_all_clients (ns) |
1532 | (*i)->reattach (); |
1573 | ns->reattach (); |
1533 | |
1574 | |
1534 | for_all_players (pl) |
1575 | for_all_players (pl) |
1535 | pl->reattach (); |
1576 | pl->reattach (); |
1536 | |
1577 | |
1537 | //TODO |
1578 | //TODO |
1538 | //for (map_container::iterator i = maps.begin (); i != maps.end (); ++i) |
1579 | //for (map_container::iterator i = maps.begin (); i != maps.end (); ++i) |
1539 | // i->second->reattach (); |
1580 | // i->second->reattach (); |
1540 | |
1581 | |
1541 | for (object *op = object::first; op; op = op->next) |
1582 | for_all_objects (op) |
1542 | op->reattach (); |
1583 | op->reattach (); |
1543 | } |
1584 | } |
1544 | |
1585 | |
1545 | NV floor (NV x) |
1586 | NV floor (NV x) |
1546 | |
1587 | |
1547 | NV ceil (NV x) |
1588 | NV ceil (NV x) |
|
|
1589 | |
|
|
1590 | NV rndm (...) |
|
|
1591 | CODE: |
|
|
1592 | switch (items) |
|
|
1593 | { |
|
|
1594 | case 0: RETVAL = rndm (); break; |
|
|
1595 | case 1: RETVAL = rndm (SvUV (ST (0))); break; |
|
|
1596 | case 2: RETVAL = rndm (SvIV (ST (0)), SvIV (ST (1))); break; |
|
|
1597 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
|
|
1598 | } |
|
|
1599 | OUTPUT: |
|
|
1600 | RETVAL |
1548 | |
1601 | |
1549 | void server_tick () |
1602 | void server_tick () |
1550 | CODE: |
1603 | CODE: |
1551 | runtime = SvNVx (sv_runtime); |
1604 | runtime = SvNVx (sv_runtime); |
1552 | server_tick (); |
1605 | server_tick (); |
… | |
… | |
1599 | } |
1652 | } |
1600 | OUTPUT: RETVAL |
1653 | OUTPUT: RETVAL |
1601 | |
1654 | |
1602 | void abort () |
1655 | void abort () |
1603 | |
1656 | |
|
|
1657 | void fork_abort (char *cause = "cf::fork_abort") |
|
|
1658 | |
|
|
1659 | void cleanup (const char *cause, bool make_core = false) |
|
|
1660 | |
1604 | void emergency_save () |
1661 | void emergency_save () |
1605 | |
1662 | |
1606 | void _exit (int status = 0) |
1663 | void _exit (int status = EXIT_SUCCESS) |
|
|
1664 | |
|
|
1665 | UV sv_2watcher (SV *w) |
|
|
1666 | CODE: |
|
|
1667 | RETVAL = (UV)GEventAPI->sv_2watcher (w); |
|
|
1668 | OUTPUT: |
|
|
1669 | RETVAL |
|
|
1670 | |
|
|
1671 | #if _POSIX_MEMLOCK |
|
|
1672 | |
|
|
1673 | int mlockall (int flags = MCL_CURRENT | MCL_FUTURE) |
|
|
1674 | |
|
|
1675 | int munlockall () |
|
|
1676 | |
|
|
1677 | #endif |
1607 | |
1678 | |
1608 | int find_animation (char *text) |
1679 | int find_animation (char *text) |
1609 | PROTOTYPE: $ |
1680 | PROTOTYPE: $ |
1610 | |
1681 | |
1611 | int random_roll (int min, int max, object *op, int goodbad); |
1682 | int random_roll (int min, int max, object *op, int goodbad); |
… | |
… | |
1649 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1720 | RETVAL = newSVpv (resist_plus[atnr], 0); |
1650 | else |
1721 | else |
1651 | XSRETURN_UNDEF; |
1722 | XSRETURN_UNDEF; |
1652 | OUTPUT: RETVAL |
1723 | OUTPUT: RETVAL |
1653 | |
1724 | |
|
|
1725 | bool |
|
|
1726 | load_regions (const char *filename) |
|
|
1727 | CODE: |
|
|
1728 | RETVAL = loader_region ().load (filename); |
|
|
1729 | OUTPUT: RETVAL |
|
|
1730 | |
1654 | MODULE = cf PACKAGE = cf::attachable |
1731 | MODULE = cf PACKAGE = cf::attachable |
1655 | |
1732 | |
1656 | int |
1733 | int |
1657 | valid (SV *obj) |
1734 | valid (SV *obj) |
1658 | CODE: |
1735 | CODE: |
1659 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1736 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1660 | OUTPUT: |
1737 | OUTPUT: |
1661 | RETVAL |
1738 | RETVAL |
1662 | |
1739 | |
1663 | #bool |
1740 | int mortals_size () |
1664 | #destroyed (attachable *at) |
1741 | CODE: |
1665 | # |
1742 | RETVAL = attachable::mortals.size (); |
1666 | #void |
1743 | OUTPUT: RETVAL |
1667 | #destroy (attachable *at) |
1744 | |
|
|
1745 | #object *mortals (U32 index) |
|
|
1746 | # CODE: |
|
|
1747 | # RETVAL = index < attachable::mortals.size () ? attachable::mortals [index] : 0; |
|
|
1748 | # OUTPUT: RETVAL |
|
|
1749 | |
|
|
1750 | INCLUDE: $PERL genacc attachable ../include/cfperl.h | |
1668 | |
1751 | |
1669 | MODULE = cf PACKAGE = cf::global |
1752 | MODULE = cf PACKAGE = cf::global |
1670 | |
1753 | |
1671 | int invoke (SV *klass, int event, ...) |
1754 | int invoke (SV *klass, int event, ...) |
1672 | CODE: |
1755 | CODE: |
… | |
… | |
1688 | RETVAL = op->invoke ((event_type)event, ARG_AV (av), DT_END); |
1771 | RETVAL = op->invoke ((event_type)event, ARG_AV (av), DT_END); |
1689 | OUTPUT: RETVAL |
1772 | OUTPUT: RETVAL |
1690 | |
1773 | |
1691 | SV *registry (object *op) |
1774 | SV *registry (object *op) |
1692 | |
1775 | |
1693 | void mortals () |
1776 | int objects_size () |
1694 | PPCODE: |
1777 | CODE: |
1695 | EXTEND (SP, object::mortals.size ()); |
|
|
1696 | for (AUTODECL (i, object::mortals.begin ()); i != object::mortals.end (); ++i) |
|
|
1697 | PUSHs (to_sv (*i)); |
|
|
1698 | |
|
|
1699 | object *first () |
|
|
1700 | CODE: |
|
|
1701 | RETVAL = object::first; |
1778 | RETVAL = objects.size (); |
|
|
1779 | OUTPUT: RETVAL |
|
|
1780 | |
|
|
1781 | object *objects (U32 index) |
|
|
1782 | CODE: |
|
|
1783 | RETVAL = index < objects.size () ? objects [index] : 0; |
|
|
1784 | OUTPUT: RETVAL |
|
|
1785 | |
|
|
1786 | int actives_size () |
|
|
1787 | CODE: |
|
|
1788 | RETVAL = actives.size (); |
|
|
1789 | OUTPUT: RETVAL |
|
|
1790 | |
|
|
1791 | object *actives (U32 index) |
|
|
1792 | CODE: |
|
|
1793 | RETVAL = index < actives.size () ? actives [index] : 0; |
1702 | OUTPUT: RETVAL |
1794 | OUTPUT: RETVAL |
1703 | |
1795 | |
1704 | # missing properties |
1796 | # missing properties |
1705 | |
1797 | |
1706 | object *head (object *op) |
1798 | object *head (object *op) |
1707 | PROTOTYPE: $ |
1799 | PROTOTYPE: $ |
1708 | CODE: |
1800 | CODE: |
1709 | RETVAL = op->head ? op->head : op; |
1801 | RETVAL = op->head_ (); |
1710 | OUTPUT: RETVAL |
1802 | OUTPUT: RETVAL |
1711 | |
1803 | |
1712 | int is_head (object *op) |
1804 | int is_head (object *op) |
1713 | PROTOTYPE: $ |
1805 | PROTOTYPE: $ |
1714 | CODE: |
1806 | CODE: |
1715 | RETVAL = !op->head; |
1807 | RETVAL = op->head_ () == op; |
1716 | OUTPUT: RETVAL |
1808 | OUTPUT: RETVAL |
1717 | |
1809 | |
1718 | void |
1810 | void |
1719 | inv (object *obj) |
1811 | inv (object *obj) |
1720 | PROTOTYPE: $ |
1812 | PROTOTYPE: $ |
… | |
… | |
1727 | |
1819 | |
1728 | void |
1820 | void |
1729 | set_animation (object *op, int idx) |
1821 | set_animation (object *op, int idx) |
1730 | CODE: |
1822 | CODE: |
1731 | SET_ANIMATION (op, idx); |
1823 | SET_ANIMATION (op, idx); |
|
|
1824 | |
|
|
1825 | int |
|
|
1826 | num_animations (object *op) |
|
|
1827 | CODE: |
|
|
1828 | RETVAL = NUM_ANIMATIONS (op); |
|
|
1829 | OUTPUT: RETVAL |
1732 | |
1830 | |
1733 | object *find_best_object_match (object *op, const char *match) |
1831 | object *find_best_object_match (object *op, const char *match) |
1734 | |
1832 | |
1735 | object *find_marked_object (object *op) |
1833 | object *find_marked_object (object *op) |
1736 | |
1834 | |
… | |
… | |
1811 | |
1909 | |
1812 | void drop (object *who, object *op) |
1910 | void drop (object *who, object *op) |
1813 | |
1911 | |
1814 | void pick_up (object *who, object *op) |
1912 | void pick_up (object *who, object *op) |
1815 | |
1913 | |
1816 | object *cf_object_insert_object (object *op, object *container) |
|
|
1817 | |
|
|
1818 | object *cf_object_insert_in_ob (object *ob, object *where) |
|
|
1819 | |
|
|
1820 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1914 | int cf_object_teleport (object *op, maptile *map, int x, int y) |
1821 | |
1915 | |
1822 | void update_object (object *op, int action) |
1916 | void update_object (object *op, int action) |
1823 | |
1917 | |
1824 | object *cf_create_object_by_name (const char *name) |
1918 | object *cf_create_object_by_name (const char *name) |
… | |
… | |
1943 | void esrv_update_item (object *op, int what, object *item) |
2037 | void esrv_update_item (object *op, int what, object *item) |
1944 | C_ARGS: what, op, item |
2038 | C_ARGS: what, op, item |
1945 | |
2039 | |
1946 | void clear_los (object *op) |
2040 | void clear_los (object *op) |
1947 | |
2041 | |
1948 | int command_teleport (object *op, char *params) |
|
|
1949 | |
|
|
1950 | int command_summon (object *op, char *params) |
2042 | int command_summon (object *op, char *params) |
1951 | |
2043 | |
1952 | int command_arrest (object *op, char *params) |
2044 | int command_arrest (object *op, char *params) |
1953 | |
2045 | |
1954 | int command_kick (object *op, char *params) |
2046 | int command_kick (object *op, char *params) |
… | |
… | |
1976 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
2068 | pl->ob->stats.hp = pl->ob->stats.maxhp; |
1977 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
2069 | pl->ob->stats.sp = pl->ob->stats.maxsp; |
1978 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
2070 | pl->ob->stats.grace = pl->ob->stats.maxgrace; |
1979 | pl->orig_stats = pl->ob->stats; |
2071 | pl->orig_stats = pl->ob->stats; |
1980 | |
2072 | |
1981 | player *cf_player_find (char *name) |
|
|
1982 | PROTOTYPE: $ |
|
|
1983 | |
|
|
1984 | void cf_player_move (player *pl, int dir) |
2073 | void cf_player_move (player *pl, int dir) |
1985 | |
2074 | |
1986 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
2075 | void play_sound_player_only (player *pl, int soundnum, int x = 0, int y = 0); |
1987 | |
|
|
1988 | player *first () |
|
|
1989 | CODE: |
|
|
1990 | RETVAL = first_player; |
|
|
1991 | OUTPUT: RETVAL |
|
|
1992 | |
2076 | |
1993 | bool |
2077 | bool |
1994 | cell_visible (player *pl, int dx, int dy) |
2078 | cell_visible (player *pl, int dx, int dy) |
1995 | CODE: |
2079 | CODE: |
1996 | RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 |
2080 | RETVAL = FABS (dx) <= pl->ns->mapx / 2 && FABS (dy) <= pl->ns->mapy / 2 |
… | |
… | |
2033 | if (y) sv_to (y, pl->bed_y); |
2117 | if (y) sv_to (y, pl->bed_y); |
2034 | |
2118 | |
2035 | void |
2119 | void |
2036 | list () |
2120 | list () |
2037 | PPCODE: |
2121 | PPCODE: |
2038 | for (player *pl = first_player; pl; pl = pl->next) |
2122 | for_all_players (pl) |
2039 | XPUSHs (sv_2mortal (to_sv (pl))); |
2123 | XPUSHs (sv_2mortal (to_sv (pl))); |
2040 | |
|
|
2041 | bool |
|
|
2042 | peaceful (player *pl, bool new_setting = 0) |
|
|
2043 | PROTOTYPE: $;$ |
|
|
2044 | CODE: |
|
|
2045 | RETVAL = pl->peaceful; |
|
|
2046 | if (items > 1) |
|
|
2047 | pl->peaceful = new_setting; |
|
|
2048 | OUTPUT: |
|
|
2049 | RETVAL |
|
|
2050 | |
|
|
2051 | living * |
|
|
2052 | orig_stats (player *pl) |
|
|
2053 | CODE: |
|
|
2054 | RETVAL = &pl->orig_stats; |
|
|
2055 | OUTPUT: RETVAL |
|
|
2056 | |
|
|
2057 | living * |
|
|
2058 | last_stats (player *pl) |
|
|
2059 | CODE: |
|
|
2060 | RETVAL = &pl->last_stats; |
|
|
2061 | OUTPUT: RETVAL |
|
|
2062 | |
2124 | |
2063 | |
2125 | |
2064 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2126 | MODULE = cf PACKAGE = cf::map PREFIX = cf_map_ |
2065 | |
2127 | |
2066 | int invoke (maptile *map, int event, ...) |
2128 | int invoke (maptile *map, int event, ...) |
… | |
… | |
2082 | PROTOTYPE: |
2144 | PROTOTYPE: |
2083 | CODE: |
2145 | CODE: |
2084 | RETVAL = new maptile; |
2146 | RETVAL = new maptile; |
2085 | OUTPUT: |
2147 | OUTPUT: |
2086 | RETVAL |
2148 | RETVAL |
2087 | |
|
|
2088 | void |
|
|
2089 | maptile::destroy () |
|
|
2090 | |
2149 | |
2091 | void |
2150 | void |
2092 | maptile::players () |
2151 | maptile::players () |
2093 | PPCODE: |
2152 | PPCODE: |
2094 | if (GIMME_V == G_SCALAR) |
2153 | if (GIMME_V == G_SCALAR) |
… | |
… | |
2099 | for_all_players (pl) |
2158 | for_all_players (pl) |
2100 | if (pl->ob && pl->ob->map == THIS) |
2159 | if (pl->ob && pl->ob->map == THIS) |
2101 | PUSHs (sv_2mortal (to_sv (pl->ob))); |
2160 | PUSHs (sv_2mortal (to_sv (pl->ob))); |
2102 | } |
2161 | } |
2103 | |
2162 | |
|
|
2163 | void |
|
|
2164 | maptile::set_regiondata (SV *data, SV *plt) |
|
|
2165 | CODE: |
|
|
2166 | { |
|
|
2167 | if (!SvROK (plt) || SvTYPE (SvRV (plt)) != SVt_PVAV) |
|
|
2168 | croak ("maptile::set_regiondata needs arrayref as plt arg"); |
|
|
2169 | |
|
|
2170 | AV *av = (AV *)SvRV (plt); |
|
|
2171 | |
|
|
2172 | region **regionmap = (region **)malloc ((av_len (av) + 1) * sizeof (region *)); |
|
|
2173 | |
|
|
2174 | for (int i = av_len (av) + 1; i--; ) |
|
|
2175 | regionmap [i] = region::find (SvPVutf8_nolen (*av_fetch (av, i, 1))); |
|
|
2176 | |
|
|
2177 | THIS->regions = salloc<uint8_t> (THIS->size (), (uint8_t *)SvPVbyte_nolen (data)); |
|
|
2178 | THIS->regionmap = regionmap; |
|
|
2179 | } |
|
|
2180 | |
2104 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
2181 | void play_sound_map (maptile *map, int x, int y, int sound_num) |
2105 | |
2182 | |
2106 | int out_of_map (maptile *map, int x, int y) |
2183 | int out_of_map (maptile *map, int x, int y) |
2107 | |
2184 | |
2108 | void |
2185 | void |
… | |
… | |
2124 | |
2201 | |
2125 | object* cf_map_present_arch_by_name (maptile *map, const char* str, int nx, int ny) |
2202 | object* cf_map_present_arch_by_name (maptile *map, const char* str, int nx, int ny) |
2126 | C_ARGS: str, map, nx, ny |
2203 | C_ARGS: str, map, nx, ny |
2127 | |
2204 | |
2128 | void |
2205 | void |
2129 | cf_map_normalise (maptile *map, int x, int y) |
2206 | get_map_flags (maptile *map, int x, int y) |
2130 | PPCODE: |
2207 | PPCODE: |
2131 | { |
2208 | { |
2132 | maptile *nmap = 0; |
2209 | maptile *nmap = 0; |
2133 | I16 nx = 0, ny = 0; |
2210 | I16 nx = 0, ny = 0; |
2134 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
2211 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
… | |
… | |
2189 | |
2266 | |
2190 | void fix_walls (maptile *map, int x, int y) |
2267 | void fix_walls (maptile *map, int x, int y) |
2191 | |
2268 | |
2192 | void fix_walls_around (maptile *map, int x, int y) |
2269 | void fix_walls_around (maptile *map, int x, int y) |
2193 | |
2270 | |
2194 | const char * |
|
|
2195 | region_name (maptile *m) |
|
|
2196 | CODE: |
|
|
2197 | RETVAL = get_name_of_region_for_map (m); |
|
|
2198 | OUTPUT: RETVAL |
|
|
2199 | |
|
|
2200 | # worst xs function of my life |
2271 | # worst xs function of my life |
2201 | maptile * |
2272 | bool |
2202 | _create_random_map (\ |
2273 | _create_random_map (\ |
2203 | char *path,\ |
2274 | maptile *self,\ |
2204 | char *wallstyle,\ |
2275 | char *wallstyle,\ |
2205 | char *wall_name,\ |
2276 | char *wall_name,\ |
2206 | char *floorstyle,\ |
2277 | char *floorstyle,\ |
2207 | char *monsterstyle,\ |
2278 | char *monsterstyle,\ |
2208 | char *treasurestyle,\ |
2279 | char *treasurestyle,\ |
… | |
… | |
2212 | char *origin_map,\ |
2283 | char *origin_map,\ |
2213 | char *final_map,\ |
2284 | char *final_map,\ |
2214 | char *exitstyle,\ |
2285 | char *exitstyle,\ |
2215 | char *this_map,\ |
2286 | char *this_map,\ |
2216 | char *exit_on_final_map,\ |
2287 | char *exit_on_final_map,\ |
2217 | int Xsize,\ |
2288 | int xsize,\ |
2218 | int Ysize,\ |
2289 | int ysize,\ |
2219 | int expand2x,\ |
2290 | int expand2x,\ |
2220 | int layoutoptions1,\ |
2291 | int layoutoptions1,\ |
2221 | int layoutoptions2,\ |
2292 | int layoutoptions2,\ |
2222 | int layoutoptions3,\ |
2293 | int layoutoptions3,\ |
2223 | int symmetry,\ |
2294 | int symmetry,\ |
… | |
… | |
2228 | int dungeon_depth,\ |
2299 | int dungeon_depth,\ |
2229 | int decoroptions,\ |
2300 | int decoroptions,\ |
2230 | int orientation,\ |
2301 | int orientation,\ |
2231 | int origin_y,\ |
2302 | int origin_y,\ |
2232 | int origin_x,\ |
2303 | int origin_x,\ |
2233 | int random_seed,\ |
2304 | U32 random_seed,\ |
2234 | val64 total_map_hp,\ |
2305 | val64 total_map_hp,\ |
2235 | int map_layout_style,\ |
2306 | int map_layout_style,\ |
2236 | int treasureoptions,\ |
2307 | int treasureoptions,\ |
2237 | int symmetry_used,\ |
2308 | int symmetry_used,\ |
2238 | region *region\ |
2309 | region *region,\ |
|
|
2310 | char *custom\ |
2239 | ) |
2311 | ) |
2240 | CODE: |
2312 | CODE: |
2241 | { |
2313 | { |
2242 | random_map_params rmp; |
2314 | random_map_params rmp; |
2243 | |
2315 | |
… | |
… | |
2253 | assign (rmp.exit_on_final_map, exit_on_final_map); |
2325 | assign (rmp.exit_on_final_map, exit_on_final_map); |
2254 | |
2326 | |
2255 | rmp.origin_map = origin_map; |
2327 | rmp.origin_map = origin_map; |
2256 | rmp.final_map = final_map; |
2328 | rmp.final_map = final_map; |
2257 | rmp.this_map = this_map; |
2329 | rmp.this_map = this_map; |
2258 | rmp.Xsize = Xsize; |
2330 | rmp.xsize = xsize; |
2259 | rmp.Ysize = Ysize; |
2331 | rmp.ysize = ysize; |
2260 | rmp.expand2x = expand2x; |
2332 | rmp.expand2x = expand2x; |
2261 | rmp.layoutoptions1 = layoutoptions1; |
2333 | rmp.layoutoptions1 = layoutoptions1; |
2262 | rmp.layoutoptions2 = layoutoptions2; |
2334 | rmp.layoutoptions2 = layoutoptions2; |
2263 | rmp.layoutoptions3 = layoutoptions3; |
2335 | rmp.layoutoptions3 = layoutoptions3; |
2264 | rmp.symmetry = symmetry; |
2336 | rmp.symmetry = symmetry; |
… | |
… | |
2275 | rmp.total_map_hp = total_map_hp; |
2347 | rmp.total_map_hp = total_map_hp; |
2276 | rmp.map_layout_style = map_layout_style; |
2348 | rmp.map_layout_style = map_layout_style; |
2277 | rmp.treasureoptions = treasureoptions; |
2349 | rmp.treasureoptions = treasureoptions; |
2278 | rmp.symmetry_used = symmetry_used; |
2350 | rmp.symmetry_used = symmetry_used; |
2279 | rmp.region = region; |
2351 | rmp.region = region; |
|
|
2352 | rmp.custom = custom; |
2280 | |
2353 | |
2281 | RETVAL = generate_random_map (path, &rmp); |
2354 | RETVAL = self->generate_random_map (&rmp); |
2282 | } |
2355 | } |
2283 | OUTPUT: |
2356 | OUTPUT: |
2284 | RETVAL |
2357 | RETVAL |
2285 | |
2358 | |
2286 | MODULE = cf PACKAGE = cf::arch |
2359 | MODULE = cf PACKAGE = cf::arch |
… | |
… | |
2309 | |
2382 | |
2310 | INCLUDE: $PERL genacc partylist ../include/player.h | |
2383 | INCLUDE: $PERL genacc partylist ../include/player.h | |
2311 | |
2384 | |
2312 | MODULE = cf PACKAGE = cf::region |
2385 | MODULE = cf PACKAGE = cf::region |
2313 | |
2386 | |
2314 | region *first () |
2387 | void |
2315 | PROTOTYPE: |
2388 | list () |
2316 | CODE: |
2389 | PPCODE: |
2317 | RETVAL = first_region; |
2390 | for_all_regions (rgn) |
2318 | OUTPUT: RETVAL |
2391 | XPUSHs (sv_2mortal (to_sv (rgn))); |
2319 | |
2392 | |
2320 | region *find (char *name) |
2393 | region *find (char *name) |
2321 | PROTOTYPE: $ |
2394 | PROTOTYPE: $ |
2322 | CODE: |
2395 | CODE: |
2323 | RETVAL = get_region_by_name (name); |
2396 | RETVAL = region::find (name); |
|
|
2397 | OUTPUT: RETVAL |
|
|
2398 | |
|
|
2399 | region *find_fuzzy (char *name) |
|
|
2400 | PROTOTYPE: $ |
|
|
2401 | CODE: |
|
|
2402 | RETVAL = region::find_fuzzy (name); |
2324 | OUTPUT: RETVAL |
2403 | OUTPUT: RETVAL |
2325 | |
2404 | |
2326 | INCLUDE: $PERL genacc region ../include/map.h | |
2405 | INCLUDE: $PERL genacc region ../include/map.h | |
2327 | |
2406 | |
2328 | MODULE = cf PACKAGE = cf::living |
2407 | MODULE = cf PACKAGE = cf::living |
… | |
… | |
2362 | char *buf = SvPVbyte (packet, len); |
2441 | char *buf = SvPVbyte (packet, len); |
2363 | |
2442 | |
2364 | THIS->send_packet (buf, len); |
2443 | THIS->send_packet (buf, len); |
2365 | } |
2444 | } |
2366 | |
2445 | |
2367 | void |
|
|
2368 | client::destroy () |
|
|
2369 | |
|
|