Tried to set the background color in the ftxui canvas and weirdly it started doing almost what I want with lighting, but I didn't write any code to do that. There's some bug in how I'm doing it that's causing it to set the colors...correctly. Must find out why.

This commit is contained in:
Zed A. Shaw 2024-11-23 23:11:20 -05:00
parent fb1fd9d8bc
commit 1bb04b4562
5 changed files with 55 additions and 13 deletions

View file

@ -178,10 +178,13 @@ bool Map::neighbors(Point &out, bool greater) {
int cur = $paths[out.y][out.x];
// BUG: sometimes cur is in a wall so finding neighbors fails
for(int i = 0; i < 4; ++i) {
for(size_t i = 0; i < dirs.size(); ++i) {
Point dir = dirs[i];
int diff = inmap(dir.x, dir.y) ? cur - $paths[dir.y][dir.x] : -1000;
int target = inmap(dir.x, dir.y) ? $paths[dir.y][dir.x] : 1000;
if(target == 1000) continue; // skip unpathable stuff
int diff = cur - target;
if(diff == 1) {
out = {.x=dir.x, .y=dir.y};