X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Flibplomrogue.c;h=c7fb5ce4fa67ddd757bc00a914a545fe6891a5af;hb=7363d6d3949f5d698223cf56170b9d2167377ed5;hp=9a4e69a7cdd2158374b16a77102a41b46b69798e;hpb=7e533c6869a8ce8263f1f6eb6808d323472bb4b4;p=plomrogue diff --git a/src/server/libplomrogue.c b/src/server/libplomrogue.c index 9a4e69a..c7fb5ce 100644 --- a/src/server/libplomrogue.c +++ b/src/server/libplomrogue.c @@ -357,7 +357,8 @@ static uint8_t eval_position(uint16_t dist, uint16_t hex_i, char * fov_map, uint16_t pos_in_map = test_pos->y * maplength + test_pos->x; uint8_t all_shaded = shade_hex(left_angle, right_angle_1st, middle_angle, shadows, pos_in_map, fov_map); - if (!all_shaded && 'X' == worldmap[pos_in_map]) + if (!all_shaded && ('X' == worldmap[pos_in_map] + || '|' == worldmap[pos_in_map])) // { if (set_shadow(left_angle, right_angle_1st, shadows)) { @@ -519,7 +520,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 +541,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 +584,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 +600,23 @@ 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++) + { + char c = mem_map[pos]; // + if ('.' == c || ':' == c || '_' == c) // + //if ('.' == mem_map[pos]) + { + score_map[pos] = 65534; + } + } + return 0; +}