… | |
… | |
194 | return; |
194 | return; |
195 | |
195 | |
196 | terminate_all_pets (ob); |
196 | terminate_all_pets (ob); |
197 | remove_friendly_object (ob); |
197 | remove_friendly_object (ob); |
198 | ob->deactivate_recursive (); |
198 | ob->deactivate_recursive (); |
|
|
199 | maplevel = ob->map->path; |
199 | ob->remove (); |
200 | ob->remove (); |
200 | ob->map = 0; |
201 | ob->map = 0; |
201 | |
202 | |
202 | // for weird reasons, this is often "ob", keeping a circular reference |
203 | // for weird reasons, this is often "ob", keeping a circular reference |
203 | ranges [range_skill] = 0; |
204 | ranges [range_skill] = 0; |
… | |
… | |
213 | this->ns = ns; |
214 | this->ns = ns; |
214 | ns->pl = this; |
215 | ns->pl = this; |
215 | |
216 | |
216 | run_on = 0; |
217 | run_on = 0; |
217 | fire_on = 0; |
218 | fire_on = 0; |
|
|
219 | ob->container = 0; //TODO: client-specific |
218 | |
220 | |
219 | ns->update_look = 0; |
221 | ns->update_look = 0; |
220 | ns->look_position = 0; |
222 | ns->look_position = 0; |
221 | |
223 | |
222 | clear_los (ob); |
224 | clear_los (ob); |
… | |
… | |
293 | if (active) |
295 | if (active) |
294 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
296 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
295 | |
297 | |
296 | INVOKE_PLAYER (DISCONNECT, this); |
298 | INVOKE_PLAYER (DISCONNECT, this); |
297 | |
299 | |
|
|
300 | ns->reset_stats (); |
298 | ns->pl = 0; |
301 | ns->pl = 0; |
299 | this->ns = 0; |
302 | this->ns = 0; |
300 | } |
303 | } |
301 | |
304 | |
|
|
305 | ob->container = 0; //TODO: client-specific |
302 | deactivate (); |
306 | deactivate (); |
303 | } |
307 | } |
304 | |
308 | |
305 | // the need for this function can be explained |
309 | // the need for this function can be explained |
306 | // by load_object not returning the object |
310 | // by load_object not returning the object |
… | |
… | |
752 | roll_stat (void) |
756 | roll_stat (void) |
753 | { |
757 | { |
754 | int a[4], i, j, k; |
758 | int a[4], i, j, k; |
755 | |
759 | |
756 | for (i = 0; i < 4; i++) |
760 | for (i = 0; i < 4; i++) |
757 | a[i] = (int) RANDOM () % 6 + 1; |
761 | a[i] = (int) rndm (6) + 1; |
758 | |
762 | |
759 | for (i = 0, j = 0, k = 7; i < 4; i++) |
763 | for (i = 0, j = 0, k = 7; i < 4; i++) |
760 | if (a[i] < k) |
764 | if (a[i] < k) |
761 | k = a[i], j = i; |
765 | k = a[i], j = i; |
762 | |
766 | |
… | |
… | |
2207 | return 0; |
2211 | return 0; |
2208 | } |
2212 | } |
2209 | |
2213 | |
2210 | /* peterm: added following line */ |
2214 | /* peterm: added following line */ |
2211 | if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) |
2215 | if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) |
2212 | dir = absdir (dir + RANDOM () % 3 + RANDOM () % 3 - 2); |
2216 | dir = absdir (dir + rndm (3) + rndm (3) - 2); |
2213 | |
2217 | |
2214 | op->facing = dir; |
2218 | op->facing = dir; |
2215 | |
2219 | |
2216 | if (op->hide) |
2220 | if (op->hide) |
2217 | do_hidden_move (op); |
2221 | do_hidden_move (op); |
… | |
… | |
2978 | tmp->x = op->x, tmp->y = op->y; |
2982 | tmp->x = op->x, tmp->y = op->y; |
2979 | if (tmp->type == CONTAINER) |
2983 | if (tmp->type == CONTAINER) |
2980 | { /* empty container to ground */ |
2984 | { /* empty container to ground */ |
2981 | loot_object (tmp); |
2985 | loot_object (tmp); |
2982 | } |
2986 | } |
2983 | if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(RANDOM () % 3))) |
2987 | if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(rndm (3)))) |
2984 | { |
2988 | { |
2985 | if (tmp->nrof > 1) |
2989 | if (tmp->nrof > 1) |
2986 | { |
2990 | { |
2987 | tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); |
2991 | tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); |
2988 | tmp2->destroy (); |
2992 | tmp2->destroy (); |