From: Christian Heller Date: Mon, 7 Jul 2014 12:32:36 +0000 (+0200) Subject: Server: Fix bugs in map and FOV generation on large maps. X-Git-Tag: tce~734 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/static/test.html?a=commitdiff_plain;h=82d6b1d84158748757619db03defd3aee4546636;p=plomrogue Server: Fix bugs in map and FOV generation on large maps. --- diff --git a/TODO b/TODO index c48735b..76c8a47 100644 --- a/TODO +++ b/TODO @@ -23,8 +23,6 @@ SERVER: - ensure atomic re-writing of savefile -- FOV algorithm is buggy in large maps - CLIENT: - enable toggling of window borders diff --git a/src/server/field_of_view.c b/src/server/field_of_view.c index 7436f05..e41d837 100644 --- a/src/server/field_of_view.c +++ b/src/server/field_of_view.c @@ -13,8 +13,11 @@ -/* Number of degrees a circle is divided into. */ -#define CIRCLE 36000000 +/* Number of degrees a circle is divided into. The greater it is, the greater + * the angle precision. But make it one whole zero larger and bizarre FOV bugs + * appear on large maps, probably due to value overflows. + */ +#define CIRCLE 3600000 diff --git a/src/server/io.c b/src/server/io.c index b2d8005..4d1b609 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -248,7 +248,7 @@ static char * build_visible_map(struct Thing * player) memset(visible_map, ' ', map_size); if (player->fov_map) /* May fail if player thing was created / positioned */ { /* by god command after turning off FOV building. */ - uint16_t pos_i; + uint32_t pos_i; for (pos_i = 0; pos_i < map_size; pos_i++) { if (player->fov_map[pos_i] & VISIBLE)