… | |
… | |
255 | enter_map (); |
255 | enter_map (); |
256 | |
256 | |
257 | send_rules (ob); |
257 | send_rules (ob); |
258 | send_news (ob); |
258 | send_news (ob); |
259 | display_motd (ob); |
259 | display_motd (ob); |
|
|
260 | |
|
|
261 | INVOKE_PLAYER (CONNECT, this); |
260 | INVOKE_PLAYER (LOGIN, this); |
262 | INVOKE_PLAYER (LOGIN, this); |
261 | } |
263 | } |
262 | |
264 | |
263 | void |
265 | void |
264 | player::disconnect () |
266 | player::disconnect () |
… | |
… | |
268 | |
270 | |
269 | //TODO: don't be so harsh and destroy :) |
271 | //TODO: don't be so harsh and destroy :) |
270 | if (ns) |
272 | if (ns) |
271 | { |
273 | { |
272 | if (enable_save) |
274 | if (enable_save) |
|
|
275 | { |
273 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
276 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
|
|
277 | save (true); |
|
|
278 | } |
|
|
279 | |
|
|
280 | INVOKE_PLAYER (DISCONNECT, this); |
274 | |
281 | |
275 | client *ns = this->ns; |
282 | client *ns = this->ns; |
276 | ns->send_packet ("goodbye"); |
283 | ns->send_packet ("goodbye"); |
277 | ns->flush (); |
284 | ns->flush (); |
278 | ns->pl = 0; |
285 | ns->pl = 0; |
… | |
… | |
300 | ob->roll_stats (); |
307 | ob->roll_stats (); |
301 | } |
308 | } |
302 | |
309 | |
303 | player::player () |
310 | player::player () |
304 | { |
311 | { |
305 | /* There are some elements we want initialized to non zero value - |
312 | /* There are some elements we want initialised to non zero value - |
306 | * we deal with that below this point. |
313 | * we deal with that below this point. |
307 | */ |
314 | */ |
308 | outputs_sync = 16; /* Every 2 seconds */ |
315 | outputs_sync = 16; /* Every 2 seconds */ |
309 | outputs_count = 8; /* Keeps present behaviour */ |
316 | outputs_count = 8; /* Keeps present behaviour */ |
310 | unapply = unapply_nochoice; |
317 | unapply = unapply_nochoice; |
… | |
… | |
2345 | |
2352 | |
2346 | /* call this here - we also will call this in do_ericserver, but |
2353 | /* call this here - we also will call this in do_ericserver, but |
2347 | * the players time has been increased when doericserver has been |
2354 | * the players time has been increased when doericserver has been |
2348 | * called, so we recheck it here. |
2355 | * called, so we recheck it here. |
2349 | */ |
2356 | */ |
2350 | //TODO: better than handling 8 commands, use some more intelligent rate-limiting |
2357 | op->contr->ns->handle_command (); |
2351 | for (int rep = 8; --rep && op->contr->ns->handle_command (); ) |
|
|
2352 | ; |
|
|
2353 | |
2358 | |
2354 | if (op->speed_left < 0) |
2359 | if (op->speed_left < 0) |
2355 | return 0; |
2360 | return 0; |
2356 | |
2361 | |
2357 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2362 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
… | |
… | |
3464 | if (trlist == NULL || who->type != PLAYER) |
3469 | if (trlist == NULL || who->type != PLAYER) |
3465 | return; |
3470 | return; |
3466 | |
3471 | |
3467 | for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); |
3472 | for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); |
3468 | |
3473 | |
3469 | if (tr == NULL || tr->item == NULL) |
3474 | if (!tr || !tr->item) |
3470 | { |
3475 | { |
3471 | /* LOG(llevDebug, "-> no more treasure for %s\n", change_resist_msg[atnr]); */ |
3476 | /* LOG(llevDebug, "-> no more treasure for %s\n", change_resist_msg[atnr]); */ |
3472 | return; |
3477 | return; |
3473 | } |
3478 | } |
3474 | |
3479 | |