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.161 by root, Thu Apr 29 08:26:38 2010 UTC vs.
Revision 1.171 by root, Tue May 3 11:23:48 2011 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001-2003 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001-2003 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
29#include <sproto.h> 29#include <sproto.h>
30#include <time.h> 30#include <time.h>
31 31
32#include <glib.h> 32#include <glib.h>
33 33
34#include <../random_maps/random_map.h> 34#include <rmg.h>
35#include <../random_maps/rproto.h> 35#include <rproto.h>
36#include "path.h" 36#include "path.h"
37 37
38void 38void
39version (object *op) 39version (object *op)
40{ 40{
103 i = find_free_spot (this, newmap, x, y, 1, SIZEOFFREE); 103 i = find_free_spot (this, newmap, x, y, 1, SIZEOFFREE);
104 } 104 }
105 105
106 if (i >= 0) 106 if (i >= 0)
107 { 107 {
108 maptile *m = newmap;
108 x += freearr_x[i]; 109 sint16 nx = x + freearr_x[i];
109 y += freearr_y[i]; 110 sint16 ny = y + freearr_y[i];
111
112 if (xy_normalise (m, nx, ny))
113 {
114 newmap = m;
115 x = nx;
116 y = ny;
117 }
110 } 118 }
111 else 119 else
112 /* not much we can do in this case. */ 120 /* not much we can do in this case. */
113 LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", &newmap->path, x, y); 121 LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", &newmap->path, x, y);
114 } 122 }
124 132
125 enemy = 0; 133 enemy = 0;
126 134
127 //newmap->insert (this, x, y); 135 //newmap->insert (this, x, y);
128 newmap->insert (this, x, y, 0, INS_NO_AUTO_EXIT); 136 newmap->insert (this, x, y, 0, INS_NO_AUTO_EXIT);
137 prefetch_surrounding_maps ();
129 138
130 if (map == newmap) // see if we actually arrived there - insert might trigger a teleport 139 if (map == newmap) // see if we actually arrived there - insert might trigger a teleport
131 { 140 {
132 if (contr) 141 if (contr)
133 { 142 {
236 } 245 }
237 246
238 /* Now process op */ 247 /* Now process op */
239 if (expect_false (op->flag [FLAG_FREED])) 248 if (expect_false (op->flag [FLAG_FREED]))
240 { 249 {
241 LOG (llevError, "BUG: process_events(): Free object on list\n"); 250 LOG (llevError, "BUG: process_events(): Free object on list (%s)\n", op->debug_desc ());
242 op->set_speed (0); 251 op->set_speed (0);
243 continue; 252 continue;
244 } 253 }
245 254
246 if (expect_false (!op->has_active_speed ())) 255 if (expect_false (!op->has_active_speed ()))
420int 429int
421main (int argc, char **argv) 430main (int argc, char **argv)
422{ 431{
423 settings.argc = argc; 432 settings.argc = argc;
424 settings.argv = argv; 433 settings.argv = argv;
425 434
426 rndm.seed (time (0)); 435 rndm.seed (time (0));
427 g_thread_init (0); // for the slice allocator only 436 g_thread_init (0); // for the slice allocator only
428 437
438 // temporary(?) testing hack
439 if (argc >= 2 && !strcmp (argv [1], "--noise"))
440 {
441 void noise_test ();
442 noise_test ();
443 exit (0);
444 }
445
446#if 0
447 // code sometiems used for timing benchmarks
448 random_number_generator<freeciv_random_generator> rng;
449 rng.seed(0);
450 for (int i = 0; i < 10; ++i)
451 printf ("%08x\n", rng.get_u32());
452 for (int i = 0; i < 1000000; ++i)
453 volatile int r = rng.get_u32 ();
454 cstamp s = stamp ();
455 for (int i = 0; i < 1000000; ++i)
456 volatile int r = rng.next ();
457 printf ("c %d\n", (int)measure (s));
458 exit (0);
459#endif
460
429 init (argc, argv); 461 init (argc, argv);
430 462
431 for (;;) 463 for (;;)
432 cfperl_main (); 464 cfperl_main ();
433} 465}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines