I am currently working on a procedurally generated Tychoon-style terrain system. To that end (so far) I have two classes: “ATerrain” and “TerrainTile” – the former has a 2D array of the latter which handles tile-specific properties of the terrain (eg: vertex elevation and direct manipulation of a tile).
Within “TerrainTile” I am have two static arrays. The first is a TStaticArray4 of vertex elevation values. The second is a multidimensional TStaticArray4< TStaticArray2> of x and y coordinate values (relative to the tile’s origin). It’s worth noting that I have absolutely no need to see or manipulate these arrays in Blueprint.
's my definition in TerrainTile.h:
class MGTYCHOON_API TerrainTile
{
//...
private:
bool isRendered;
TStaticArray4<uint32> vertices;
TStaticArray4< TStaticArray2<uint32>> vertex_xy_coords;
//...
}
My problem is when I try to set default values in my class constructor. When I do that, I get the following errors:
error C2512: 'TStaticArray4<uint32>' : no appropriate default constructor available
error C2512: 'TStaticArray4<TStaticArray2<uint32>>' : no appropriate default constructor available
is my constructor in TerrainTile.cpp:
TerrainTile::TerrainTile(TStaticArray4<uint32> set_vertices = {0, 0, 0, 0})
{
isRendered = true;
vertices = set_vertices;
vertex_xy_coords = {
{ 0, 0 }, // v0
{ 1, 0 }, // v1
{ 1, 1 }, // v2
{ 0, 1 } // v3
};
}
Please forgive me if this is a stupid question or if it has been asked in another form. I have tried to Google/AnswerHub search for a solution for about two hours to no avail. I am very new to C++ and I have a hunch this is a really silly problem with a really simple solution. Obviously I’m failing to understand how to properly construct an Array.
How can I properly declare these arrays and define their default values in the constructor?
Thanks in advance!