-/* Write into "neighbor_scores" scores for immediate neighbors to cell at
- * "pos_yx" (YX coordinates) and "pos_i" (arry_index) in "score_map". Directions
- * determining neighborhood are defined by the letters of "dir"; their order
- * also determines in what order scores are written into "neighbor_score".
- * "len_dirs" is to store the result of a previous strlen(dir) (so it does not
- * have to be called repeatedly and costly in dijkstra_map(); same reason for
- * "pos_i"'s redundancy.). "max_score" is written into "neighbor_scores" for
- * illegal directions (that from "pos_yx" would lead beyond the map's border).
+#define N_DIRS 8
+
+
+
+/* Write into "neighbors" scores of the eight immediate 2D neighbors of the
+ * "score_map" cell at "pos_i" (array index), as found in the directions north,
+ * north-east, east etc. (clockwise order). "max_score" is used for illegal
+ * neighborhoods (i.e. if the direction would lead beyond the map's border).
+ */
+static void get_neighbor_scores(uint32_t * score_map, uint16_t pos_i,
+ uint32_t max_score, uint32_t * neighbors);
+
+/* Iterate over scored cells in "score_map" of world.map's 2D geometry. Compare
+ * each cell's score against the score of its immediate neighbors in N_DIRS
+ * directions. If it's neighbors are low enough that the result would be lower
+ * than the current value, re-set it to world.map.dist_orthogonal points higher
+ * than its lowest-scored orthogonal neighbor or world.map.dist_diagonal points
+ * higher than its lowest-scored diagonal neighbor (whatever would result in a
+ * lower value). Repeat this whole process until all cells have settled on their
+ * final score. Ignore cells whose position in "score_map" fits cells of
+ * unreachable terrain in world.map.cells. Expect "max_score" to be the maximum
+ * score for cells, marking them as unreachable.