… | |
… | |
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; |
425 | |
433 | |
426 | rndm.seed (time (0)); |
434 | rndm.seed (time (0)); |
427 | g_thread_init (0); // for the slice allocator only |
435 | g_thread_init (0); // for the slice allocator only |
428 | |
436 | |
|
|
437 | #if 0 |
|
|
438 | extern void hack(); hack ();//D |
|
|
439 | #endif |
|
|
440 | |
|
|
441 | #if 0 |
|
|
442 | // code sometiems used for timing benchmarks |
|
|
443 | random_number_generator<freeciv_random_generator> rng; |
|
|
444 | rng.seed(0); |
|
|
445 | for (int i = 0; i < 10; ++i) |
|
|
446 | printf ("%08x\n", rng.get_u32()); |
|
|
447 | for (int i = 0; i < 1000000; ++i) |
|
|
448 | volatile int r = rng.get_u32 (); |
|
|
449 | cstamp s = stamp (); |
|
|
450 | for (int i = 0; i < 1000000; ++i) |
|
|
451 | volatile int r = rng.next (); |
|
|
452 | printf ("c %d\n", (int)measure (s)); |
|
|
453 | exit (0); |
|
|
454 | #endif |
|
|
455 | |
429 | init (argc, argv); |
456 | init (argc, argv); |
430 | |
457 | |
431 | for (;;) |
458 | for (;;) |
432 | cfperl_main (); |
459 | cfperl_main (); |
433 | } |
460 | } |