Добавлены локации и перемещение по ним

This commit is contained in:
DeLiss
2026-06-11 11:37:19 +05:00
parent 1e7bac87d3
commit cba2274630
15 changed files with 506 additions and 57 deletions

61
include/location.h Normal file
View File

@@ -0,0 +1,61 @@
#pragma once
#include <string>
#include <vector>
struct Point {
int x = 0;
int y = 0;
};
struct Chest {
Point pos;
int gold = 0;
bool opened = false;
};
struct Enemy {
Point pos;
std::string type;
int hp = 50;
};
struct NPC {
Point pos;
std::string name;
};
struct Riddle {
int type = 0;
std::string text;
std::string answer;
bool isSolved = false;
};
class Location {
public:
int id = 0;
std::string title;
int width = 0;
int height = 0;
int north = 0;
int south = 0;
int west = 0;
int east = 0;
Point startPosition;
Riddle riddle;
std::vector<std::string> map;
std::vector<Chest> chests;
std::vector<Enemy> enemies;
std::vector<NPC> npcs;
bool loadFromFile(const std::string& path);
void draw(const Point& playerPosition) const;
bool isWalkable(int x, int y) const;
char getTile(int x, int y) const;
};