… | |
… | |
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 | |
38 | void |
38 | void |
39 | version (object *op) |
39 | version (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 | } |
… | |
… | |
236 | } |
244 | } |
237 | |
245 | |
238 | /* Now process op */ |
246 | /* Now process op */ |
239 | if (expect_false (op->flag [FLAG_FREED])) |
247 | if (expect_false (op->flag [FLAG_FREED])) |
240 | { |
248 | { |
241 | LOG (llevError, "BUG: process_events(): Free object on list\n"); |
249 | LOG (llevError, "BUG: process_events(): Free object on list (%s)\n", op->debug_desc ()); |
242 | op->set_speed (0); |
250 | op->set_speed (0); |
243 | continue; |
251 | continue; |
244 | } |
252 | } |
245 | |
253 | |
246 | if (expect_false (!op->has_active_speed ())) |
254 | if (expect_false (!op->has_active_speed ())) |
… | |
… | |
420 | int |
428 | int |
421 | main (int argc, char **argv) |
429 | main (int argc, char **argv) |
422 | { |
430 | { |
423 | settings.argc = argc; |
431 | settings.argc = argc; |
424 | settings.argv = argv; |
432 | settings.argv = argv; |
|
|
433 | |
|
|
434 | #if 0 |
|
|
435 | // code sometiems used for timing benchmarks |
|
|
436 | random_number_generator<freeciv_random_generator> rng; |
|
|
437 | rng.seed(0); |
|
|
438 | for (int i = 0; i < 10; ++i) |
|
|
439 | printf ("%08x\n", rng.get_u32()); |
|
|
440 | for (int i = 0; i < 1000000; ++i) |
|
|
441 | volatile int r = rng.get_u32 (); |
|
|
442 | cstamp s = stamp (); |
|
|
443 | for (int i = 0; i < 1000000; ++i) |
|
|
444 | volatile int r = rng.next (); |
|
|
445 | printf ("c %d\n", (int)measure (s)); |
|
|
446 | exit (0); |
|
|
447 | #endif |
425 | |
448 | |
426 | rndm.seed (time (0)); |
449 | rndm.seed (time (0)); |
427 | g_thread_init (0); // for the slice allocator only |
450 | g_thread_init (0); // for the slice allocator only |
428 | |
451 | |
429 | init (argc, argv); |
452 | init (argc, argv); |