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

@ -1993,12 +1993,14 @@ void CGameHandler::newTurn()
fw.mode = 1;
fw.player = player;
// find all hidden tiles
const auto & fow = getPlayerTeam(player)->fogOfWarMap;
for (size_t i=0; i<fow.size(); i++)
for (size_t j=0; j<fow.at(i).size(); j++)
for (size_t k=0; k<fow.at(i).at(j).size(); k++)
if (!fow.at(i).at(j).at(k))
fw.tiles.insert(int3((si32)i,(si32)j,(si32)k));
const auto fow = getPlayerTeam(player)->fogOfWarMap;
auto shape = fow->shape();
for(size_t z = 0; z < shape[0]; z++)
for(size_t x = 0; x < shape[1]; x++)
for(size_t y = 0; y < shape[2]; y++)
if (!(*fow)[z][x][y])
fw.tiles.insert(int3(x, y, z));
sendAndApply (&fw);
}
@ -7012,13 +7014,15 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
fc.mode = (cheat == "vcmieagles" ? 1 : 0);
fc.player = player;
const auto & fowMap = gs->getPlayerTeam(player)->fogOfWarMap;
auto hlp_tab = new int3[gs->map->width * gs->map->height * (gs->map->twoLevel ? 2 : 1)];
auto hlp_tab = new int3[gs->map->width * gs->map->height * (gs->map->levels())];
int lastUnc = 0;
for (int i = 0; i < gs->map->width; i++)
for (int j = 0; j < gs->map->height; j++)
for (int k = 0; k < (gs->map->twoLevel ? 2 : 1); k++)
if (!fowMap.at(i).at(j).at(k) || !fc.mode)
hlp_tab[lastUnc++] = int3(i, j, k);
for(int z = 0; z < gs->map->levels(); z++)
for(int x = 0; x < gs->map->width; x++)
for(int y = 0; y < gs->map->height; y++)
if(!(*fowMap)[z][x][y] || !fc.mode)
hlp_tab[lastUnc++] = int3(x, y, z);
fc.tiles.insert(hlp_tab, hlp_tab + lastUnc);
delete [] hlp_tab;
sendAndApply(&fc);