[Freeciv-Dev] buglet in normalization in init_new_game() (PR#1063)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This causes the assertion in CHECK_MAP_POS to fail on many games.
civserver: maphand.c:742: show_area: Assertion
`is_normal_map_pos((x),(y))' failed.
The backtrace shows:
(gdb) bt
#0 0x400888d1 in __kill () from /lib/libc.so.6
#1 0x4008864d in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2 0x40089cb8 in abort () at ../sysdeps/generic/abort.c:88
#3 0x40081d71 in __assert_fail (assertion=0x80cbd93
"is_normal_map_pos((x),(y))", file=0x80cbd59 "maphand.c", line=742,
function=0x80cbf53 "show_area") at assert.c:74
#4 0x08072bd8 in show_area (pplayer=0x81313d0, x=-1, y=12, len=1) at
maphand.c:742
#5 0x080684ea in init_new_game () at gamehand.c:136
#6 0x0804f5f0 in srv_main () at srv_main.c:1964
#7 0x08049cdd in main (argc=1, argv=0xbffff954) at civserver.c:147
#8 0x40076306 in __libc_start_main (main=0x8049794 <main>, argc=1,
ubp_av=0xbffff954, init=0x804910c <_init>, fini=0x80b9e40 <_fini>,
rtld_fini=0x4000d2cc <_dl_fini>, stack_end=0xbffff94c) at
../sysdeps/generic/libc-start.c:129
(gdb) p game.randseed
$2 = 1005598569
(gdb) p map.seed
$3 = 157894863
This seems straightforward enough. Unfortunately, I'm not too familiar
with this part of the code, so I don't know how best to fix it. The
easiest way may be to just put a normalize_map_pos into the beginning of
show_area; however, this is wasteful because show_area is used in a lot
more places other than this problem area. It also may be possible for
the center of the square_iterate to be unreal, which would mean the
CHECK_MAP_POS check doesn't belong there at all. However, I can't think
of any reason why one would want this.
It's certainly not a dangerous bug, since square_iterate calls
normalize_map_pos itself so it'll always give only normal positions. To
avoid it, compile without debugging. There should be no side effects to
the code in init_new_game that produces the non-normal coordinates.
jason
- [Freeciv-Dev] buglet in normalization in init_new_game() (PR#1063),
jdorje <=
|
|