Cleanup; prepared for buildings

This commit is contained in:
Segey Lapin
2021-10-16 03:08:07 +03:00
parent f4c39becea
commit 45a67ac8bd
5 changed files with 87 additions and 11 deletions

View File

@@ -80,6 +80,9 @@ protected:
int site_type;
int cluster;
Vector<struct half_edge> hedges;
Vector2 building_positions;
Rect2i rect;
float avg_height;
};
void index_site(struct map_site *site);
Vector<Vector2> diagram_vertices;
@@ -107,8 +110,10 @@ protected:
break;
}
}
/* for now the starting town is at 0 */
printf("area: %d class: %d\n", cl_area, map_sites[j].site_type);
}
map_sites.write[0].site_type = SITE_TOWN;
}
void process_diagram(const Dictionary &diagram);
bool segment_intersects_rect(const Vector2 &a, const Vector2 &b, const Rect2 &rect);
@@ -247,6 +252,25 @@ public:
{
return map_hedges.size();
}
void build_building_positions();
void generate_3d_vertices();
void generate_building_positions();
void generate_site_building_positions(const struct map_site *site);
int get_site_from_point(int x, int z);
inline bool site_is_town(int site)
{
return map_sites[site].site_type == SITE_TOWN;
}
inline bool site_is_farm(int site)
{
return map_sites[site].site_type == SITE_FARM;
}
inline float get_site_avg_height(int site)
{
return map_sites[site].avg_height;
}
inline Vector2 get_site_pos(int site)
{
return map_sites[site].pos;
}
};
#endif