… | |
… | |
1301 | * cleanup. We also leave that loop to actually handle the freeing |
1301 | * cleanup. We also leave that loop to actually handle the freeing |
1302 | * of the data. |
1302 | * of the data. |
1303 | */ |
1303 | */ |
1304 | if (pl->ob->type != DEAD_OBJECT) |
1304 | if (pl->ob->type != DEAD_OBJECT) |
1305 | { |
1305 | { |
1306 | pl->socket.status = Ns_Dead; |
1306 | pl->socket->status = Ns_Dead; |
1307 | |
1307 | |
1308 | /* If a hidden dm dropped connection do not create |
1308 | /* If a hidden dm dropped connection do not create |
1309 | * inconsistencies by showing that they have left the game |
1309 | * inconsistencies by showing that they have left the game |
1310 | */ |
1310 | */ |
1311 | if (!(QUERY_FLAG (pl->ob, FLAG_WIZ) && pl->ob->contr->hidden) |
1311 | if (!(QUERY_FLAG (pl->ob, FLAG_WIZ) && pl->ob->contr->hidden) |
1312 | && draw_exit && (pl->state != ST_GET_NAME && pl->state != ST_GET_PASSWORD && pl->state != ST_CONFIRM_PASSWORD)) |
1312 | && draw_exit && (pl->state != ST_GET_NAME && pl->state != ST_GET_PASSWORD && pl->state != ST_CONFIRM_PASSWORD)) |
1313 | { |
1313 | { |
1314 | if (pl->ob->map) |
1314 | if (pl->ob->map) |
1315 | { |
1315 | { |
1316 | INVOKE_PLAYER (LOGOUT, pl); |
1316 | INVOKE_PLAYER (LOGOUT, pl); |
1317 | LOG (llevInfo, "LOGOUT: Player named %s from ip %s\n", &pl->ob->name, pl->socket.host); |
1317 | LOG (llevInfo, "LOGOUT: Player named %s from ip %s\n", &pl->ob->name, pl->socket->host); |
1318 | } |
1318 | } |
1319 | |
1319 | |
1320 | char buf[MAX_BUF]; |
1320 | char buf[MAX_BUF]; |
1321 | |
1321 | |
1322 | sprintf (buf, "%s left the game.", &pl->ob->name); |
1322 | sprintf (buf, "%s left the game.", &pl->ob->name); |
… | |
… | |
1398 | extern unsigned long todtick; |
1398 | extern unsigned long todtick; |
1399 | |
1399 | |
1400 | void |
1400 | void |
1401 | do_specials (void) |
1401 | do_specials (void) |
1402 | { |
1402 | { |
1403 | |
|
|
1404 | #ifdef WATCHDOG |
|
|
1405 | if (!(pticks % 503)) |
|
|
1406 | watchdog (); |
|
|
1407 | #endif |
|
|
1408 | |
|
|
1409 | if (!(pticks % PTICKS_PER_CLOCK)) |
1403 | if (!(pticks % PTICKS_PER_CLOCK)) |
1410 | tick_the_clock (); |
1404 | tick_the_clock (); |
1411 | |
1405 | |
1412 | if (!(pticks % 7)) |
1406 | if (!(pticks % 7)) |
1413 | shstr::gc (); |
1407 | shstr::gc (); |
… | |
… | |
1434 | void |
1428 | void |
1435 | server_tick () |
1429 | server_tick () |
1436 | { |
1430 | { |
1437 | nroferrors = 0; |
1431 | nroferrors = 0; |
1438 | |
1432 | |
|
|
1433 | // first do the user visible stuff |
1439 | doeric_server (); |
1434 | doeric_server (); |
1440 | INVOKE_GLOBAL (CLOCK); |
1435 | INVOKE_GLOBAL (CLOCK); |
1441 | process_events (NULL); /* "do" something with objects with speed */ |
1436 | process_events (NULL); /* "do" something with objects with speed */ |
1442 | flush_sockets (); |
1437 | flush_sockets (); |
|
|
1438 | |
|
|
1439 | // then do some bookkeeping, should not really be here |
1443 | check_active_maps (); /* Removes unused maps after a certain timeout */ |
1440 | check_active_maps (); /* Removes unused maps after a certain timeout */ |
1444 | do_specials (); /* Routines called from time to time. */ |
1441 | do_specials (); /* Routines called from time to time. */ |
1445 | object::free_mortals (); |
1442 | object::free_mortals (); |
1446 | |
1443 | |
1447 | ++pticks; |
1444 | ++pticks; |