ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/main.C
(Generate patch)

Comparing deliantra/server/server/main.C (file contents):
Revision 1.86 by root, Thu Jan 18 16:19:34 2007 UTC vs.
Revision 1.92 by root, Tue Mar 6 03:06:00 2007 UTC

250 pl->refcnt_chk (); 250 pl->refcnt_chk ();
251 251
252 if (!pl->ob || !pl->ns || !pl->ob->active) 252 if (!pl->ob || !pl->ns || !pl->ob->active)
253 continue; 253 continue;
254 254
255 if (pl->ob->speed_left > 0) 255 if (pl->ob->speed_left > 0 && pl->ns)
256 if (handle_newcs_player (pl->ob)) 256 if (handle_newcs_player (pl->ob))
257 flag = 1; 257 flag = 1;
258 258
259 /* If the player is not actively playing, don't make a 259 /* If the player is not actively playing, don't make a
260 * backup save - nothing to save anyway. Plus, the 260 * backup save - nothing to save anyway. Plus, the
370 /* Animate the object. Bug or feature that anim_speed 370 /* Animate the object. Bug or feature that anim_speed
371 * is based on ticks, and not the creatures speed? 371 * is based on ticks, and not the creatures speed?
372 */ 372 */
373 if (op->anim_speed && op->last_anim >= op->anim_speed) 373 if (op->anim_speed && op->last_anim >= op->anim_speed)
374 { 374 {
375 if ((op->type == PLAYER)) 375 animate_object (op, op->type == PLAYER ? op->facing : op->direction);
376 animate_object (op, op->facing);
377 else
378 animate_object (op, op->direction);
379 376
380 op->last_anim = 1; 377 op->last_anim = 1;
381 } 378 }
382 else 379 else
383 op->last_anim++; 380 op->last_anim++;
439 new_draw_info_format (flags, 0, 0, "Cause for this shutdown: %s\n", cause); 436 new_draw_info_format (flags, 0, 0, "Cause for this shutdown: %s\n", cause);
440 437
441 if (make_core) 438 if (make_core)
442 new_draw_info_format (flags, 0, 0, "This is considered a crash, but all maps and players have been saved.\n"); 439 new_draw_info_format (flags, 0, 0, "This is considered a crash, but all maps and players have been saved.\n");
443 else 440 else
444 new_draw_info_format (flags, 0, 0, "This is considered to be a clean shutdown, and all maps and players have been saved.\n"); 441 new_draw_info_format (flags, 0, 0, "This is considered to be a clean shutdown, and all maps and players will be saved now.\n");
445 442
446 new_draw_info_format (flags, 0, 0, "%s\n", CLEANUP_MESSAGE); 443 new_draw_info_format (flags, 0, 0, "%s\n", CLEANUP_MESSAGE);
447 444
448 flush_sockets (); 445 flush_sockets ();
449} 446}
476 LOG (llevDebug, "cleanup done.\n"); 473 LOG (llevDebug, "cleanup done.\n");
477 474
478 if (make_core) 475 if (make_core)
479 { 476 {
480 cleanup_inform (cause, make_core); 477 cleanup_inform (cause, make_core);
478 cfperl_cleanup (make_core);
481 _exit (1); 479 _exit (1);
482 } 480 }
483 else 481 else
482 {
483 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "Maps and players successfully saved, exiting.\n");
484 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "And again: " CLEANUP_MESSAGE "\n");
485 flush_sockets ();
486 cfperl_cleanup (make_core);
484 _exit (0); 487 _exit (0);
488 }
485} 489}
486 490
487int 491int
488forbid_play (void) 492forbid_play (void)
489{ 493{
589 attachable::check_mortals (); 593 attachable::check_mortals ();
590 594
591 ++pticks; 595 ++pticks;
592} 596}
593 597
598#if 0
599// used fro benchmarking (x86/amd64-specific)
600typedef unsigned long tval;
601typedef unsigned long long stamp64;
602
603extern inline tval
604stamp (void)
605{
606 tval tsc;
607 asm volatile ("rdtsc":"=a" (tsc)::"edx");
608
609 return tsc;
610}
611
612extern inline tval
613measure (tval t)
614{
615 tval tsc;
616 asm volatile ("rdtsc":"=a" (tsc)::"edx");
617
618 if (tsc > t)
619 return tsc - t;
620 else
621 return t - tsc;
622}
623
594int 624int
595main (int argc, char **argv) 625main (int argc, char **argv)
596{ 626{
627 rand_gen rg(0);
628 tval fastest = 0x7fffffff;
629 for (int loop = 10000; loop--; )
630 {
631 tval s = stamp ();
632 volatile int i = rg.get_int(25);
633 fastest = min (fastest, measure (s));
634 }
635
636 //printf ("fastest %d\n", fastest);
637 for (int i = 0; i < 1024*1024*3; ++i)
638 {
639 char c = rg.get_int (256);
640 write (2, &c, 1);
641 }
642}
643
644#else
645
646// normal main
647int
648main (int argc, char **argv)
649{
597 settings.argc = argc; 650 settings.argc = argc;
598 settings.argv = argv; 651 settings.argv = argv;
599 652
600 init (argc, argv); 653 init (argc, argv);
654 init_environ ();
601 655
602 initPlugins (); 656 initPlugins ();
603 657
604 for (;;) 658 for (;;)
605 cfperl_main (); 659 cfperl_main ();
606} 660}
661#endif
607 662

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines