1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Rotation rebase2 (#912)

* Instead of [x][y][z] coordinates, map will be stored as [z][x][y].
* Nullkiller AI can get it too.
* Use boost::multi_array instead of nested vectors
* In MapHandler too
* Rotate foreach algorithms, too
* VCAI gets rotated, too
This commit is contained in:
DjWarmonger
2022-09-18 16:39:10 +02:00
committed by GitHub
parent e85f8a56bb
commit 7ba271edf1
44 changed files with 502 additions and 1015 deletions

View File

@ -923,18 +923,20 @@ void CMapLoaderH3M::readTerrain()
map->initTerrain();
// Read terrain
for(int a = 0; a < 2; ++a)
int3 pos;
for(pos.z = 0; pos.z < 2; ++pos.z)
{
if(a == 1 && !map->twoLevel)
if(pos.z == 1 && !map->twoLevel)
{
break;
}
for(int c = 0; c < map->width; c++)
//OH3 format is [z][y][x]
for(pos.y = 0; pos.y < map->height; pos.y++)
{
for(int z = 0; z < map->height; z++)
for(pos.x = 0; pos.x < map->width; pos.x++)
{
auto & tile = map->getTile(int3(z, c, a));
auto & tile = map->getTile(pos);
tile.terType = Terrain::createTerrainTypeH3M(reader.readUInt8());
tile.terView = reader.readUInt8();
tile.riverType = RIVER_NAMES[reader.readUInt8()];