X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=libplomrogue.c;h=d0b15a10bc5d260f4fcf1fc75af6551863e01157;hb=08f8592f1a1e5d340b6c2372551f0a3da28a07d8;hp=9a4e69a7cdd2158374b16a77102a41b46b69798e;hpb=455db0213bfd97aff1a6309c9c53f6701c3fce84;p=plomrogue
diff --git a/libplomrogue.c b/libplomrogue.c
index 9a4e69a..d0b15a1 100644
--- a/libplomrogue.c
+++ b/libplomrogue.c
@@ -519,7 +519,8 @@ extern uint16_t get_neighbor_score(uint8_t i)
* neighbor's score is at least two points lower than the current cell's score,
* re-set it to 1 point higher than its lowest-scored neighbor. Repeat this
* whole process until all cells have settled on their final score. Ignore cells
- * whose score is greater than UINT16_MAX - 1 (treat those as unreachable).
+ * whose score is greater than UINT16_MAX - 1 (treat those as unreachable). Also
+ * ignore cells whose score is smaller or equal the number of past iterations.
* Return 1 on error, else 0.
*/
extern uint8_t dijkstra_map()
@@ -539,7 +540,8 @@ extern uint8_t dijkstra_map()
scores_still_changing = 0;
for (pos = 0; pos < map_size; pos++)
{
- if (score_map[pos] <= max_score)
+ uint16_t score = score_map[pos];
+ if (score <= max_score && score > i_scans)
{
get_neighbor_scores(pos, max_score, neighbors);
min_neighbor = max_score;
@@ -581,7 +583,7 @@ extern uint8_t zero_score_map_where_char_on_memdepthmap(char c,
}
extern void age_some_memdepthmap_on_nonfov_cells(char * memdepthmap,
- char * fovmap)
+ char * fovmap)
{
uint32_t map_size = maplength * maplength;
uint16_t pos;
@@ -597,3 +599,21 @@ extern void age_some_memdepthmap_on_nonfov_cells(char * memdepthmap,
}
}
}
+
+extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map)
+{
+ if (!score_map)
+ {
+ return 1;
+ }
+ uint32_t map_size = maplength * maplength;
+ uint16_t pos;
+ for (pos = 0; pos < map_size; pos++)
+ {
+ if ('.' == mem_map[pos])
+ {
+ score_map[pos] = 65534;
+ }
+ }
+ return 0;
+}