void game_loop(bool &star_placed, bool &staircase_placed, int &c, bool &t_placed, int &r_placed, bool &p_placed, int rows, int cols, vector<vector<char>> &map)
{
    bool pause = false;
    bool invent = false;
    int newlvl = player_actions(star_placed, num_lvl, staircase_placed, t_placed, r_placed, p_placed, c, map);
    if (c == raisekey)
    {
        raise_bag(map);
    }
    if (c == attackkey)
    {
        attack(c, rows, map);
    }
    dungeon_gen(star_placed, staircase_placed, p_placed, t_placed, r_placed, rows, cols, map);
    dungeon_graw(num_lvl, p_placed, rows, cols, map);
    if (newlvl == 1)
    {
        clear();
        mvprintw((rows / 2) - 3, (cols / 2) - 3, "New Level %d", num_lvl);
        mvprintw((rows / 2) - 2, (cols / 2) - 1, "PRESS");
        refresh();
    }
    if (c == inventorykey)
    {
        clear();
        invent = true;
        do
        {
            invent = inventory(rows, cols);
        } while (!invent);
    }
    if (c == 27)
    {
        clear();
        pause = true;
        do
        {
            pause = menu_pause(rows, cols);
        } while (!pause);
        dungeon_graw(num_lvl, p_placed, rows, cols, map);
        refresh();
    }
    if (player_hp < 1)
    {
        int choice = 1;
        do
        {
            clear();
            mvprintw(1, 1, "Gold: %d", p_gold);
            mvprintw(2, 1, "Monster kill: %d", monster_kil);
            ;
            mvprintw(rows / 2, cols / 2 - 3, "RIP");
            mvprintw(rows / 2 + 1, cols / 2 - 3, "menu");
            mvprintw(rows / 2 + 2, cols / 2 - 3, "exit");
            mvprintw(rows / 2 + choice, cols / 2 - 5, ">>");
            refresh();
            int ripmenu_c = getch();
            switch (ripmenu_c)
            {
            case KEY_UP:
                choice = max(1, choice - 1);
                break;
            case KEY_DOWN:
                choice = min(2, choice + 1);
                break;
            case 10:
                switch (choice)
                {
                case 1:
                    clear();
                    // сброс игровых даных
                    t_placed = false;
                    p_placed = false;
                    staircase_placed = false;
                    r_placed = 0;
                    num_lvl = 1;
                    att = 1;
                    p_gold = 0;
                    player_hp = 10;
                    monster_kil = 0;
                    counter_star_player = 0;
                    menu(star_placed, staircase_placed, c, t_placed, r_placed, p_placed, rows, cols, map);
                    refresh();
                    break;
                case 2:
                    exit(0);
                }
                break;
            }
        } while (choice != 3);
    }
}bool is_line_of_sight_clear(const vector<vector<char>> &map, int x1, int y1, int x2, int y2)
{
    int dx = abs(x2 - x1);
    int dy = abs(y2 - y1);
    int sx = (x1 < x2) ? 1 : -1;
    int sy = (y1 < y2) ? 1 : -1;
    int err = dx - dy;
    while (true)
    {
        if (map[y1][x1] == '#')
        {
            // Найдено препятствие на линии видимости
            return false;
        }
        if (x1 == x2 && y1 == y2)
        {
            // Достигнута конечная точка
            break;
        }
        int e2 = 2 * err;
        if (e2 > -dy)
        {
            err -= dy;
            x1 += sx;
        }
        if (e2 < dx)
        {
            err += dx;
            y1 += sy;
        }
    }
    // Пройдена вся линия без препятствий
    return true;
}
void monster_move(vector<vector<char>> &map)
{
    srand(time(0));
    for (int m = 0; m < 10; m++)
    {
        if (monster[m].hp < 1)
            continue;
        int dist_y = abs(py - monster[m].y);
        int dist_x = abs(px - monster[m].x);
        int dir_y = monster[m].y;
        int dir_x = monster[m].x;
        if (dist_y >= 5 && dist_x >= 5)
        {
            // Если монстр от игрока далеко, добавляем случайные шаги для патрулирования
            int random_y_or_x = rand() % 2; 
            int y_changes, x_changes;
            switch (random_y_or_x)
            {
            case 0:
                y_changes = rand() % 2;
                switch (y_changes) // движения по y
                {
                case 0:
                    dir_y--;
                    break;
                case 1:
                    dir_y++;
                    break;
                }
            case 1: // движения по х
                x_changes = rand() % 2;
                switch (x_changes)
                {
                case 0:
                    dir_x--;
                    break;
                case 1:
                    dir_x++;
                    break;
                }
                break;
            }
            // Проверяем, чтобы новая позиция была в пределах карты и была свободной и не пересекала барьер
            if (dir_y >= 0 && dir_y < map.size() && dir_x >= 0 && dir_x < map[0].size() && map[dir_y][dir_x] == ' ')
            {
                map[monster[m].y][monster[m].x] = ' ';
                monster[m].y = dir_y;
                monster[m].x = dir_x;
                map[monster[m].y][monster[m].x] = 't';
            }
        }
        else if (dist_y < 5 || dist_x < 5)
        {
            // Если монстр близко к игроку, преследуем игрока
            if (is_line_of_sight_clear(map, monster[m].x, monster[m].y, px, py))
            {
                if (dist_y > dist_x)
                {
                    if (monster[m].y < py)
                        dir_y++;
                    else
                        dir_y--;
                }
                else
                {
                    if (monster[m].x < px)
                        dir_x++;
                    else
                        dir_x--;
                }
                if (dist_y < 2 && dist_x < 2)
                {
                    player_hp -= num_lvl / 2 + 1;
                }
                // Проверяем, чтобы новая позиция была в пределах карты и была свободной и не пересекала барьер
                if (dir_y >= 0 && dir_y < map.size() && dir_x >= 0 && dir_x < map[0].size() && map[dir_y][dir_x] == ' ')
                {
                    map[monster[m].y][monster[m].x] = ' ';
                    monster[m].y = dir_y;
                    monster[m].x = dir_x;
                    map[monster[m].y][monster[m].x] = 't';
                }
            }
        }
    }
}PS E:\Desktop\school\ctest\src> g++ -g -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -o main main.cpp -lncursesw -lsystre -ltre -lintl -liconv
main.cpp:4:10: fatal error: curses.h: No such file or directory
    4 | #include <curses.h>
      |          ^~~~~~~~~~
compilation terminated.PS E:\Desktop\school\ctest\src> pkg-config --cflags --libs ncurses
Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing `ncurses.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ncurses' found
PS E:\Desktop\school\ctest\src> pkg-config --cflags --libs ncursesw
-DNCURSES_WIDECHAR -IC:/msys64/mingw64/include/ncursesw -LC:/msys64/mingw64/lib -lncursesw -lsystre -ltre -lintl -liconvls /mingw64/lib/libncurses*
/mingw64/lib/libncurses++w.a      /mingw64/lib/libncurses.a       /mingw64/lib/libncursesw_g.a
/mingw64/lib/libncurses++w.dll.a  /mingw64/lib/libncursesw.a
/mingw64/lib/libncurses++w_g.a    /mingw64/lib/libncursesw.dll.a[{
	"resource": "/E:/Desktop/school/ctest/src/main.cpp",
	"owner": "C/C++: IntelliSense",
	"code": "1696",
	"severity": 8,
	"message": "не удается открыть источник файл \"ncurses/curses.h\"",
	"source": "C/C++",
	"startLineNumber": 4,
	"startColumn": 1,
	"endLineNumber": 4,
	"endColumn": 28
}]Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing `ncurses.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ncurses' found
main.cpp:4:10: fatal error: curses.h: No such file or directory
    4 | #include <curses.h>
      |          ^~~~~~~~~~
compilation terminated.loop4
loop5
loop4
loop5
loop5
loop5
loop8
loop5
loop8
loop8
loop8
loop8
loop8
loop8
loop8
loop8
loop3
loop4
loop5
exit1
exit2
loop4
loop5while (r_placed < room_num)
        {
            std::cout << "loop3" << std::endl;
            int try_counter = 0; //  изменяряет попытки генерации комнат
            do
            {
                std::cout << "loop4" << std::endl;
                collision = false;
                // делаем кординаты комнате
                ry = rand() % (rows - 4) + 1;
                rx = rand() % (cols - 4) + 1;
                r_size_y = rand() % 5 + 4;
                r_size_x = rand() % 10 + 8;
                for (int y = ry; y < ry + r_size_y; y++)
                {
                    std::cout << "loop5" << std::endl;
                    for (int x = rx; x < rx + r_size_x; x++)
                    {
                        if (map[y][x] == '%' || map[y][x] == ' ' || map[y + 2][x] == ' ' || map[y - 2][x] == ' ' || map[y][x + 2] == ' ' || map[y][x - 2] == ' ')
                        {
                            collision = true;
                            break;
                        }
                    }
                    std::cout << "exit1" << std::endl;
                    if (collision)
                    {
                        break;
                    }
                }
                std::cout << "exit2" << std::endl;
                try_counter++;
                if (try_counter > 100)
                {
                    rx = ry = 3;
                    r_size_y = r_size_x = 3;
                    break;
                }
            } while (collision && try_counter <= 100);
            std::cout << "exit3" << std::endl;
            if (try_counter > 100)
                break;
            // записывыем в базу комнаты
            for (int y = ry; y < ry + r_size_y; y++)
            {
                std::cout << "loop6" << std::endl;
                for (int x = rx; x < rx + r_size_x; x++)
                {
                    if (map[y][x] == '%')
                    {
                        y = ry + r_size_y;
                        break;
                    }
                    else
                    {
                        map[y][x] = ' ';
                    }
                }
            }
            r_placed++;
            if (r_placed > 1)
            {
                r_old_center_y = r_center_y;
                r_old_center_x = r_center_x;
            }
            r_center_y = ry + (r_size_y / 2);
            r_center_x = rx + (r_size_x / 2);
            if (r_placed > 1)
            {
                int path_y;
                for (path_y = r_old_center_y; path_y != r_center_y;)
                {
                    std::cout << "loop7" << std::endl;
                    map[path_y][r_old_center_x] = ' ';
                    if (r_old_center_y < r_center_y)
                    {
                        path_y++;
                    }
                    else if (r_old_center_y > r_center_y)
                    {
                        path_y--;
                    }
                }
                for (int x = r_old_center_x; x != r_center_x;)
                {
                    std::cout << "loop8" << std::endl;
                    map[path_y][x] = ' ';
                    if (r_old_center_x < r_center_x)
                    {
                        x++;
                    }
                    else if (r_old_center_x > r_center_x)
                    {
                        x--;
                    }
                }
            }
        }
    }
    std::cout << "exit4 " << std::endl;do
            {
                std::cout << "loop4" << std::endl;
                collision = false;
                // делаем кординаты комнате
                ry = rand() % (rows - 4) + 1;
                rx = rand() % (cols - 4) + 1;
                r_size_y = rand() % 5 + 4;
                r_size_x = rand() % 10 + 8;
                for (int y = ry; y < ry + r_size_y; y++)
                {
                    std::cout << "loop5" << std::endl;
                    for (int x = rx; x < rx + r_size_x; x++)
                    {
                        if (map[y][x] == '%' || map[y][x] == ' ' || map[y + 2][x] == ' ' || map[y - 2][x] == ' ' || map[y][x + 2] == ' ' || map[y][x - 2] == ' ')
                        {
                            collision = true;
                            break;
                        }
                    }
                    if (collision)
                    {
                        break;
                    }
                }
                try_counter++;
                if (try_counter > 100)
                {
                    rx = ry = 3;
                    r_size_y = r_size_x = 3;
                    break;
                }
            } while (collision && try_counter <= 100);loop5
loop5
loop4
loop5
loop4
loop5
loop5
loop5
loop5
loop5
loop5
loop5
loop4
loop5for (int y = 0; y < rows; y++)
        {
            printf("loop1\n");
            for (int x = 0; x < cols; x++)
            {
                printf("loop2\n");
                if (y == 0 || y == rows - 2 || x == 0 || x == cols - 1)
                {
                    map[y][x] = '%'; // записываем  барьер в базу
                }
                else
                {
                    map[y][x] = '#'; // записываем  стену в базу
                }
            }
        }do
        {
            center_y = ry + (r_size_y / 2);
            center_x = rx + (r_size_x / 2);
        } while (map[center_y][center_x] != ' ');while (collision && try_counter <= 100); 
if (try_counter > 100) break#include <iostream>
#include <vector>
#include <time.h>
#include <E:\Desktop\school\ctest\lib\PDCurses-3.9\curses.h>
using namespace std;
void game_loop(bool &staircase_placed, int &c, bool &t_placed, int &r_placed, bool &p_placed, int rows, int cols, vector<vector<char>> &map);
void dungeon_graw(bool &p_placed, int rows, int cols, vector<vector<char>> &map);
void dungeon_gen(bool &staircase_placed, bool &p_placed, bool &t_placed, int &r_placed, int rows, int cols, vector<vector<char>> &map);
void movement(bool &staircase_placed, bool &t_placed, int &r_placed, bool &p_placed, int &c, vector<vector<char>> &map);
void attack(int rows, int &c, int dir_y, int dir_x, vector<vector<char>> &map);
int px, py; // координата игрока
int p_gold = 0;
class monsters
{
public:
    int y;
    int x;
    int hp;
};
class monsters monster[10];
int main()
{
    int c = 0;
    int cols, rows;
    bool t_placed = false;
    bool p_placed = false;
    int r_placed = 0;
    bool staircase_placed = false;
    initscr();
    keypad(stdscr, 1);
    noecho();
    curs_set(0);
    getmaxyx(stdscr, rows, cols);
    vector<vector<char>> map(rows, vector<char>(cols));
    do
    {
        //  erase(); // очистка екрана
        game_loop(staircase_placed, c, t_placed, r_placed, p_placed, rows, cols, map);
        refresh();                 // Обновление экрана
    } while ((c = getch()) != 27); // 27 - ESC
    getch();
    endwin();
    return 0;
}
/////////////////////
void game_loop(bool &staircase_placed, int &c, bool &t_placed, int &r_placed, bool &p_placed, int rows, int cols, vector<vector<char>> &map)
{
    movement(staircase_placed, t_placed, r_placed, p_placed, c, map);
    dungeon_gen(staircase_placed, p_placed, t_placed, r_placed, rows, cols, map);
    dungeon_graw(p_placed, rows, cols, map);
    if (c == 'a')
    {
        attack(c, py, px, rows, map);
    }
}
void dungeon_gen(bool &staircase_placed, bool &p_placed, bool &t_placed, int &r_placed, int rows, int cols, vector<vector<char>> &map)
{
    srand(time(0));
    int rx = 0, ry = 0;     // кордината комнаты
    int r_size_x, r_size_y; // размер комнаты
    bool collision = false;
    if (!r_placed)
    {
        int room_num = rand() % 2 + 3; // число комнат
        // коридоры
        int r_old_center_y, r_old_center_x, r_center_y, r_center_x;
        /// база даных
        for (int y = 0; y < rows; y++)
        {
            for (int x = 0; x < cols; x++)
            {
                if (y == 0 || y == rows - 2 || x == 0 || x == cols - 1)
                {
                    map[y][x] = '%'; // записываем  барьер в базу
                }
                else
                {
                    map[y][x] = '#'; // записываем  стену в базу
                }
            }
        }
        int try_counter = 0; //  изменяряет попытки генерации комнат
        while (r_placed < room_num)
        {
            do
            {
                collision = false;
                // делаем кординаты комнате
                ry = rand() % (rows - 4) + 1;
                rx = rand() % (cols - 4) + 1;
                r_size_y = rand() % 5 + 4;
                r_size_x = rand() % 10 + 8;
                for (int y = ry; y < ry + r_size_y; y++)
                {
                    for (int x = rx; x < rx + r_size_x; x++)
                    {
                        if (map[y][x] == '%' || map[y][x] == ' ' || map[y + 2][x] == ' ' || map[y - 2][x] == ' ' || map[y][x + 2] == ' ' || map[y][x - 2] == ' ')
                        {
                            y = ry + r_size_y;
                            collision = true;
                            break;
                        }
                    }
                }
                try_counter++;
                if (try_counter > 100)
                {
                    r_placed = room_num;
                }
            } while (collision == true);
            // записывыем в базу комнаты
            for (int y = ry; y < ry + r_size_y; y++)
            {
                for (int x = rx; x < rx + r_size_x; x++)
                {
                    if (map[y][x] == '%')
                    {
                        y = ry + r_size_y;
                        break;
                    }
                    else
                    {
                        map[y][x] = ' ';
                    }
                }
            }
            r_placed++;
            if (r_placed > 1)
            {
                r_old_center_y = r_center_y;
                r_old_center_x = r_center_x;
            }
            r_center_y = ry + (r_size_y / 2);
            r_center_x = rx + (r_size_x / 2);
            if (r_placed > 1)
            {
                int path_y;
                for (path_y = r_old_center_y; path_y != r_center_y;)
                {
                    map[path_y][r_old_center_x] = ' ';
                    if (r_old_center_y < r_center_y)
                    {
                        path_y++;
                    }
                    else if (r_old_center_y > r_center_y)
                    {
                        path_y--;
                    }
                }
                for (int x = r_old_center_x; x != r_center_x;)
                {
                    map[path_y][x] = ' ';
                    if (r_old_center_x < r_center_x)
                    {
                        x++;
                    }
                    else if (r_old_center_x > r_center_x)
                    {
                        x--;
                    }
                }
            }
        }
    }
    if (!t_placed)
    {
        int monster_y, monster_x;
        for (int m = 0; m < 10; m++)
        {
            do
            {
                monster_x = rand() % cols;
                monster_y = rand() % rows;
            } while (map[monster_y][monster_x] != ' ');
            monster[m].y = monster_y;
            monster[m].x = monster_x;
            monster[m].hp = 2; // хп монстров
            map[monster[m].y][monster[m].x] = 't';
        }
        t_placed = true;
    }
    if (!p_placed)
    {
        do
        {
            px = rand() % cols;
            py = rand() % rows;
        } while (map[py][px] != ' ');
        map[py][px] = '@';
        p_placed = true;
    }
    if (!staircase_placed)
    {
        int center_y, center_x;
        do
        {
            center_y = ry + (r_size_y / 2);
            center_x = rx + (r_size_x / 2);
        } while (map[center_y][center_x] != ' ');
        map[center_y][center_x] = '>';
        staircase_placed = true;
    }
}
void dungeon_graw(bool &p_placed, int rows, int cols, vector<vector<char>> &map)
{
    srand(time(0));
    ///// рисования данжа
    for (int y = 0; y < rows; y++)
    {
        for (int x = 0; x < cols; x++)
        {
            if (map[y][x] == '%')
            {
                mvaddch(y, x, '%'); // рисуем  барьер
            }
            else if (map[y][x] == '@')
            {
                mvaddch(y, x, '@');
            }
            else if (map[y][x] == 't')
            {
                mvaddch(y, x, 't');
            }
            else if (map[y][x] == ' ') // рисуем комнату
            {
                mvaddch(y, x, ' ');
            }
            else if (map[y][x] == '>')
            {
                mvaddch(y, x, '>');
            }
            else
            {
                mvaddch(y, x, '#'); // рисуем  стену
            }
        }
    }
    //////////////////////////////////////////////////////////
    // чистим последню строку для информации
    for (int x = 0; x < cols; x++)
    {
        mvaddch(rows - 1, x, ' ');
    }
    mvprintw(rows - 1, 0, "Gold %d", p_gold); // вывод золота
}
void movement(bool &staircase_placed, bool &t_placed, int &r_placed, bool &p_placed, int &c, vector<vector<char>> &map)
{
    int old_player_x = px, old_player_y = py;
    int dir_y = py, dir_x = px;
    if (c == KEY_UP)
        dir_y--;
    else if (c == KEY_DOWN)
        dir_y++;
    else if (c == KEY_LEFT)
        dir_x--;
    else if (c == KEY_RIGHT)
        dir_x++;
    if (map[dir_y][dir_x] == ' ')
    {
        map[old_player_y][old_player_x] = ' ';
        py = dir_y;
        px = dir_x;
        map[py][px] = '@';
    }
    else if (map[dir_y][dir_x] == '>')
    {
        t_placed = false;
        p_placed = false;
        staircase_placed = false;
        r_placed = 0;
    }
}
void attack(int rows, int &c, int dir_y, int dir_x, vector<vector<char>> &map)
{
    int attack_y = py, attack_x = px;
    for (int m = 0; m < 10; m++)
    {
        int dist_y = abs(attack_y - monster[m].y);
        int dist_x = abs(attack_x - monster[m].x);
        if (dist_y <= 1 && dist_x <= 1 && map[monster[m].y][monster[m].x] == 't')
        {
            if (monster[m].hp > 0)
            {
                monster[m].hp -= 1;
            }
            if (monster[m].hp <= 0)
            {
                map[monster[m].y][monster[m].x] = ' ';
                monster[m].y = -1; // Помечаем, что гоблин мертв
                monster[m].x = -1;
                p_gold += rand() % 9 + 1; // получения золота
            }
        }
    }
}cmake_minimum_required(VERSION 3.28)  # Минимальная версия CMake
project(ctest)  # Название вашего проекта
# Указание исходных файлов
set(SOURCES
    src/main.cpp
    
)
find_package(Curses REQUIRED)
# Если библиотека Curses найдена, добавляем ее включение и линковку
if(CURSES_FOUND)
    include_directories(${CURSES_INCLUDE_DIR})
    add_executable(${PROJECT_NAME} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
endif()main.cpp:2:20: fatal error: curses.h: No such file or directory
 #include <curses.h>
                    ^
compilation terminated.
Xtile =50 и так же для y,а мне нужно,узнать какое айди на тайла на кординтах xtile =50 ytile=50
Чтоб например сделать так что б игрок мог ходить только по тайлам с айди 1 а по тайлам с id 3 не мог ходить,в таким духе,ну может есть какойто проще вариант.Через объекты мне не подходит