… | |
… | |
230 | do_destroy (); |
230 | do_destroy (); |
231 | sever_self (); |
231 | sever_self (); |
232 | } |
232 | } |
233 | |
233 | |
234 | void |
234 | void |
|
|
235 | attachable::do_delete () |
|
|
236 | { |
|
|
237 | delete this; |
|
|
238 | } |
|
|
239 | |
|
|
240 | void |
235 | attachable::check_mortals () |
241 | attachable::check_mortals () |
236 | { |
242 | { |
237 | static int i = 0; |
243 | static int i = 0; |
238 | |
244 | |
239 | for (;;) |
245 | for (;;) |
… | |
… | |
252 | |
258 | |
253 | if (0) |
259 | if (0) |
254 | { |
260 | { |
255 | for (int j = 0; j < mortals.size (); ++j)//D |
261 | for (int j = 0; j < mortals.size (); ++j)//D |
256 | fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D |
262 | fprintf (stderr, "%d:%s %p ", j, &((object *)mortals[j])->name, mortals[j]);//D |
|
|
263 | |
257 | fprintf (stderr, "\n");//D |
264 | fprintf (stderr, "\n");//D |
258 | } |
265 | } |
259 | } |
266 | } |
260 | } |
267 | } |
261 | |
268 | |
… | |
… | |
281 | } |
288 | } |
282 | else |
289 | else |
283 | { |
290 | { |
284 | mortals.erase (i); |
291 | mortals.erase (i); |
285 | obj->sever_self (); |
292 | obj->sever_self (); |
286 | delete obj; |
293 | obj->do_delete (); |
287 | } |
294 | } |
288 | } |
295 | } |
289 | } |
296 | } |
290 | |
297 | |
291 | void |
298 | void |
… | |
… | |
1132 | |
1139 | |
1133 | return retval; |
1140 | return retval; |
1134 | } |
1141 | } |
1135 | |
1142 | |
1136 | maptile * |
1143 | maptile * |
1137 | find_style (const_utf8_string dirname, const_utf8_string stylename, int difficulty) |
1144 | find_style (const_utf8_string dirname, const_utf8_string stylename, int difficulty, bool recurse) |
1138 | { |
1145 | { |
1139 | CALL_BEGIN (3); |
1146 | CALL_BEGIN (4); |
1140 | CALL_ARG (dirname); |
1147 | CALL_ARG (dirname); |
1141 | CALL_ARG (stylename); |
1148 | CALL_ARG (stylename); |
1142 | CALL_ARG (difficulty); |
1149 | CALL_ARG (difficulty); |
|
|
1150 | CALL_ARG (recurse); |
1143 | CALL_CALL ("ext::map_random::find_style", G_SCALAR); |
1151 | CALL_CALL ("ext::map_random::find_style", G_SCALAR); |
1144 | |
1152 | |
1145 | maptile *retval = 0; |
1153 | maptile *retval = 0; |
1146 | if (count) sv_to (POPs, retval); |
1154 | if (count) sv_to (POPs, retval); |
1147 | |
1155 | |
… | |
… | |
1224 | object::ref () const |
1232 | object::ref () const |
1225 | { |
1233 | { |
1226 | if (type == PLAYER) |
1234 | if (type == PLAYER) |
1227 | return format ("player/<1.%llx>/%s", (unsigned long long)uuid.seq, &name); |
1235 | return format ("player/<1.%llx>/%s", (unsigned long long)uuid.seq, &name); |
1228 | else |
1236 | else |
|
|
1237 | // TODO: should be able to save references within the same map, at least |
1229 | return 0; |
1238 | return 0; |
1230 | } |
1239 | } |
1231 | |
1240 | |
1232 | object * |
1241 | object * |
1233 | object::deref (const_utf8_string ref) |
1242 | object::deref (const_utf8_string ref) |
… | |
… | |
1460 | const_iv (MAP_INACTIVE) |
1469 | const_iv (MAP_INACTIVE) |
1461 | |
1470 | |
1462 | const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) |
1471 | const_iv (KLASS_ATTACHABLE) const_iv (KLASS_GLOBAL) const_iv (KLASS_OBJECT) |
1463 | const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) |
1472 | const_iv (KLASS_CLIENT) const_iv (KLASS_PLAYER) const_iv (KLASS_MAP) |
1464 | |
1473 | |
1465 | const_iv (VERSION_CS) const_iv (VERSION_SC) |
|
|
1466 | |
|
|
1467 | const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) |
1474 | const_iv (CS_QUERY_YESNO) const_iv (CS_QUERY_SINGLECHAR) const_iv (CS_QUERY_HIDEINPUT) |
1468 | |
1475 | |
1469 | const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES) |
1476 | const_iv (IO_HEADER) const_iv (IO_OBJECTS) const_iv (IO_UNIQUES) |
1470 | }; |
1477 | }; |
1471 | |
1478 | |
… | |
… | |
1658 | switch (items) |
1665 | switch (items) |
1659 | { |
1666 | { |
1660 | case 0: RETVAL = gen (); break; |
1667 | case 0: RETVAL = gen (); break; |
1661 | case 1: RETVAL = gen (SvUV (ST (0))); break; |
1668 | case 1: RETVAL = gen (SvUV (ST (0))); break; |
1662 | case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break; |
1669 | case 2: RETVAL = gen (SvIV (ST (0)), SvIV (ST (1))); break; |
1663 | default: croak ("cf::rndm requires none, one or two parameters."); break; |
1670 | default: croak ("cf::rndm requires zero, one or two parameters."); break; |
1664 | } |
1671 | } |
1665 | } |
1672 | } |
1666 | OUTPUT: |
1673 | OUTPUT: |
1667 | RETVAL |
1674 | RETVAL |
1668 | |
1675 | |
… | |
… | |
1684 | PROTOTYPE: @ |
1691 | PROTOTYPE: @ |
1685 | CODE: |
1692 | CODE: |
1686 | while (items > 0) |
1693 | while (items > 0) |
1687 | sv_rvweaken (ST (--items)); |
1694 | sv_rvweaken (ST (--items)); |
1688 | |
1695 | |
1689 | void |
1696 | void log_suspend () |
|
|
1697 | |
|
|
1698 | void log_resume () |
|
|
1699 | |
1690 | log_backtrace (utf8_string msg) |
1700 | void log_backtrace (utf8_string msg) |
1691 | |
1701 | |
1692 | void |
|
|
1693 | LOG (int flags, utf8_string msg) |
1702 | void LOG (int flags, utf8_string msg) |
1694 | PROTOTYPE: $$ |
1703 | PROTOTYPE: $$ |
1695 | C_ARGS: flags, "%s", msg |
1704 | C_ARGS: flags, "%s", msg |
1696 | |
1705 | |
1697 | octet_string path_combine (octet_string base, octet_string path) |
1706 | octet_string path_combine (octet_string base, octet_string path) |
1698 | PROTOTYPE: $$ |
1707 | PROTOTYPE: $$ |
… | |
… | |
2158 | PROTOTYPE: $$;$ |
2167 | PROTOTYPE: $$;$ |
2159 | PPCODE: |
2168 | PPCODE: |
2160 | { |
2169 | { |
2161 | rv_vector rv; |
2170 | rv_vector rv; |
2162 | |
2171 | |
2163 | PUTBACK; |
|
|
2164 | get_rangevector (ob, other, &rv, flags); |
2172 | get_rangevector (ob, other, &rv, flags); |
2165 | SPAGAIN; |
|
|
2166 | |
2173 | |
2167 | EXTEND (SP, 5); |
2174 | EXTEND (SP, 5); |
2168 | PUSHs (newSVuv (rv.distance)); |
2175 | PUSHs (sv_2mortal (newSVuv (rv.distance))); |
2169 | PUSHs (newSViv (rv.distance_x)); |
2176 | PUSHs (sv_2mortal (newSViv (rv.distance_x))); |
2170 | PUSHs (newSViv (rv.distance_y)); |
2177 | PUSHs (sv_2mortal (newSViv (rv.distance_y))); |
2171 | PUSHs (newSViv (rv.direction)); |
2178 | PUSHs (sv_2mortal (newSViv (rv.direction))); |
2172 | PUSHs (to_sv (rv.part)); |
2179 | PUSHs (sv_2mortal (to_sv (rv.part))); |
2173 | } |
2180 | } |
2174 | |
2181 | |
2175 | bool on_same_map_as (object *ob, object *other) |
2182 | bool on_same_map_as (object *ob, object *other) |
2176 | CODE: |
2183 | CODE: |
2177 | RETVAL = on_same_map (ob, other); |
2184 | RETVAL = on_same_map (ob, other); |
… | |
… | |
2801 | while (!RETVAL); // crude way to leave index 0 |
2808 | while (!RETVAL); // crude way to leave index 0 |
2802 | |
2809 | |
2803 | faces [RETVAL].name = name; |
2810 | faces [RETVAL].name = name; |
2804 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2811 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2805 | |
2812 | |
2806 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2813 | if (!strcmp (name, BLANK_FACE_NAME )) blank_face = RETVAL; |
2807 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2814 | if (!strcmp (name, EMPTY_FACE_NAME )) empty_face = RETVAL; |
|
|
2815 | if (!strcmp (name, MAGICMOUTH_FACE_NAME)) magicmouth_face = RETVAL; |
2808 | } |
2816 | } |
2809 | OUTPUT: RETVAL |
2817 | OUTPUT: RETVAL |
2810 | |
2818 | |
2811 | void set_type (faceidx idx, int value) |
2819 | void set_type (faceidx idx, int value) |
2812 | ALIAS: |
2820 | ALIAS: |