… | |
… | |
80 | // all objects no longer referenced and empty are |
80 | // all objects no longer referenced and empty are |
81 | // eligible for destruction. |
81 | // eligible for destruction. |
82 | void |
82 | void |
83 | clean_obj_cache () |
83 | clean_obj_cache () |
84 | { |
84 | { |
|
|
85 | return; // killing neko-san gives me an unreferenced scalar |
85 | int todo = 10; |
86 | int todo = 10; |
86 | do |
87 | do |
87 | { |
88 | { |
88 | I32 klen; |
89 | I32 klen; |
89 | char *key; |
90 | char *key; |
90 | HE *he = hv_iternext (obj_cache); |
91 | HE *he = hv_iternext (obj_cache); |
91 | |
92 | |
92 | if (he) |
93 | if (he) |
93 | { |
94 | { |
94 | SV *sv = SvRV (hv_iterval (obj_cache, he)); |
95 | SV *sv = hv_iterval (obj_cache, he); |
95 | |
96 | |
96 | // emopty and unreferened? nuke it |
97 | // emopty and unreferened? nuke it |
97 | if (SvREFCNT (sv) == 1 && !HvFILL ((HV *)sv)) |
98 | if (SvREFCNT (sv) == 1 && SvREFCNT (SvRV (sv)) == 1 && !HvFILL ((HV *)(SvRV (sv)))) |
98 | { |
99 | { |
99 | hv_delete (obj_cache, HeKEY (he), HeKLEN (he), G_DISCARD); |
100 | hv_delete (obj_cache, HeKEY (he), HeKLEN (he), G_DISCARD); |
100 | todo++; |
101 | todo++; |
101 | } |
102 | } |
102 | } |
103 | } |
… | |
… | |
1174 | int cf_object_get_flag (object *op, int flag) |
1175 | int cf_object_get_flag (object *op, int flag) |
1175 | ALIAS: flag = 0 |
1176 | ALIAS: flag = 0 |
1176 | |
1177 | |
1177 | void cf_object_set_flag (object *op, int flag, int value) |
1178 | void cf_object_set_flag (object *op, int flag, int value) |
1178 | |
1179 | |
1179 | void cf_object_move (object *op, object *originator, int dir) |
1180 | void cf_object_move (object *op, int dir, object *originator) |
1180 | |
1181 | |
1181 | void cf_object_apply (object *op, object *author, int flags = 0) |
1182 | void cf_object_apply (object *op, object *author, int flags = 0) |
1182 | |
1183 | |
1183 | void cf_object_apply_below (object *op) |
1184 | void cf_object_apply_below (object *op) |
1184 | |
1185 | |
… | |
… | |
1267 | void cf_fix_object (object *pl) |
1268 | void cf_fix_object (object *pl) |
1268 | ALIAS: fix = 0 |
1269 | ALIAS: fix = 0 |
1269 | |
1270 | |
1270 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1271 | object *cf_insert_ob_in_ob (object *ob, object *where) |
1271 | |
1272 | |
|
|
1273 | object *get_nearest_player (object *ob) |
|
|
1274 | ALIAS: nearest_player = 0 |
|
|
1275 | |
1272 | void rangevector (object *ob, object *other, int flags = 0) |
1276 | void rangevector (object *ob, object *other, int flags = 0) |
1273 | PROTOTYPE: $$;$ |
1277 | PROTOTYPE: $$;$ |
1274 | ALIAS: |
1278 | PPCODE: |
1275 | direction = 1 |
|
|
1276 | distance = 2 |
|
|
1277 | CODE: |
|
|
1278 | { |
1279 | { |
1279 | rv_vector rv; |
1280 | rv_vector rv; |
1280 | // get_rangevector uses these if the objects are not on the same map |
|
|
1281 | // which is not the same as "on_same_map". |
|
|
1282 | rv.distance_x = 32767; |
|
|
1283 | rv.distance_y = 32767; |
|
|
1284 | get_rangevector (ob, other, &rv, flags); |
1281 | get_rangevector (ob, other, &rv, flags); |
1285 | EXTEND (SP, 5); |
1282 | EXTEND (SP, 5); |
1286 | if (!ix || ix == 2) PUSHs (newSVuv (rv.distance)); |
1283 | PUSHs (newSVuv (rv.distance)); |
1287 | if (!ix) PUSHs (newSViv (rv.distance_x)); |
1284 | PUSHs (newSViv (rv.distance_x)); |
1288 | if (!ix) PUSHs (newSViv (rv.distance_y)); |
1285 | PUSHs (newSViv (rv.distance_y)); |
1289 | if (!ix || ix == 1) PUSHs (newSViv (rv.direction)); |
1286 | PUSHs (newSViv (rv.direction)); |
1290 | if (!ix) PUSHs (newSVcfapi (CFAPI_POBJECT, rv.part)); |
1287 | PUSHs (newSVcfapi (CFAPI_POBJECT, rv.part)); |
1291 | } |
1288 | } |
1292 | |
1289 | |
1293 | bool on_same_map_as (object *ob, object *other) |
1290 | bool on_same_map_as (object *ob, object *other) |
1294 | CODE: |
1291 | CODE: |
1295 | RETVAL = on_same_map (ob, other); |
1292 | RETVAL = on_same_map (ob, other); |