This commit is contained in:
bart
2026-11-08 16:15:49 +01:00
parent 5af4581182
commit 1140dd562b
34 changed files with 940 additions and 44 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "city.h"
City::City(int cId, int pId, const QString &cName, int tx, int ty, const QVector3D &pos,
int initInhabitants, int initInhabitantsPerPop, int initRadius)
: id(cId), playerId(pId), name(cName), tileX(tx), tileY(ty), worldPos(pos),
inhabitants(initInhabitants), inhabitantsPerPop(initInhabitantsPerPop)
{
// Claim center tile
territory.emplace_back(tx, ty);
// Claim surrounding 6 tiles (radius 1)
if (initRadius >= 1) {
for (int e = 0; e < 6; ++e) {
int nx, ny;
getHexNeighbor(tx, ty, e, nx, ny);
if (nx >= 0 && nx < MAP_WIDTH && ny >= 0 && ny < MAP_HEIGHT) {
territory.emplace_back(nx, ny);
}
}
}
}