summaryrefslogtreecommitdiff
path: root/src/common.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-11-06 19:58:41 +0000
committerPaweł Redman <pawel.redman@gmail.com>2017-11-06 19:58:41 +0000
commitbdd1b10cb8d6c405de58031e1de57c7f2b24225f (patch)
tree93f08e73ca4b34b23e8bd1fbde422848eba9d7bb /src/common.hpp
parent6a82d04e2b5edffc32df44aa46d6cf60428c7b44 (diff)
Introduce cmodels and cflags.
Diffstat (limited to 'src/common.hpp')
-rw-r--r--src/common.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/common.hpp b/src/common.hpp
index fde9bc8..0785a79 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -77,6 +77,13 @@ namespace world {
tile_t tiles[SECTOR_SIZE * SECTOR_SIZE];
};
+ typedef int cflags_t;
+
+ typedef struct {
+ cflags_t cflags;
+ rectf_t bounds;
+ } cmodel_t;
+
class world_t {
procgen::prng_t prng;
procgen::perlin_noise_t perlin;
@@ -99,7 +106,7 @@ namespace world {
sector_t *get_sector(sector_index_t index, bool partial = false);
tile_t *get_tile(tile_index_t index, bool partial = false);
- bool find_path(v2f_t src, v2f_t dst, rectf_t size, entity_t *ignore, std::list<v2f_t> *path);
+ bool find_path(v2f_t src, v2f_t dst, cmodel_t *cmodel, entity_t *ignore, std::list<v2f_t> *path);
// FIXME: iterators instead of returning std::lists
std::list<sector_t*> get_sectors(rectf_t rect);
@@ -120,7 +127,8 @@ namespace world {
size_t cookie = 0;
public:
- rectf_t bounds, render_bounds;
+ cmodel_t cmodel;
+ rectf_t render_bounds;
void link(world_t *world);
void unlink();
@@ -136,6 +144,7 @@ namespace world {
class path_finder_t {
public:
v2f_t src, dst, tile_center;
+ cflags_t cflags;
path_node_t *nodes;
size_t width, height;
tile_index_t base;
@@ -144,8 +153,8 @@ namespace world {
std::deque<tile_index_t> path, shortest_path;
~path_finder_t();
- void setup_nodes(v2f_t src_, v2f_t dst_);
- void eliminate_nodes(rectf_t bounds);
+ void setup_nodes(v2f_t src_, v2f_t dst_, cflags_t cflags_);
+ void eliminate_nodes(cmodel_t cmodel);
void find_r(tile_index_t index, float dist, float limit);
bool find(void);
void export_path(std::list<v2f_t> *list);