1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

First version that compiles

This commit is contained in:
Tomasz Zieliński
2022-09-21 11:34:23 +02:00
parent b20f649521
commit 494b0f0226
93 changed files with 431 additions and 359 deletions

View File

@@ -1911,7 +1911,7 @@ void CGameHandler::newTurn()
hth.id = h->id;
auto ti = make_unique<TurnInfo>(h, 1);
// TODO: this code executed when bonuses of previous day not yet updated (this happen in NewTurn::applyGs). See issue 2356
hth.move = h->maxMovePointsCached(gs->map->getTile(h->getPosition(false)).terType.isLand(), ti.get());
hth.move = h->maxMovePointsCached(gs->map->getTile(h->getPosition(false)).terType->isLand(), ti.get());
hth.mana = h->getManaNewTurn();
n.heroes.insert(hth);
@@ -2217,9 +2217,9 @@ void CGameHandler::setupBattle(int3 tile, const CArmedInstance *armies[2], const
battleResult.set(nullptr);
const auto t = getTile(tile);
Terrain terrain = t->terType;
TTerrain terrain = t->terType->id;
if (gs->map->isCoastalTile(tile)) //coastal tile is always ground
terrain = Terrain("sand");
terrain = Terrain::SAND;
BattleField terType = gs->battleGetBattlefieldType(tile, getRandomGenerator());
if (heroes[0] && heroes[0]->boat && heroes[1] && heroes[1]->boat)
@@ -2316,7 +2316,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
const int3 guardPos = gs->guardingCreaturePosition(hmpos);
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::BOAT;
const bool disembarking = h->boat && t.terType.isLand() && !t.blocked;
const bool disembarking = h->boat && t.terType->isLand() && !t.blocked;
//result structure for start - movement failed, no move points used
TryMoveHero tmh;
@@ -2338,11 +2338,11 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
//it's a rock or blocked and not visitable tile
//OR hero is on land and dest is water and (there is not present only one object - boat)
if (((!t.terType.isPassable() || (t.blocked && !t.visitable && !canFly))
if (((!t.terType->isPassable() || (t.blocked && !t.visitable && !canFly))
&& complain("Cannot move hero, destination tile is blocked!"))
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType.isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::BOAT && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::BOAT && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
&& complain("Cannot move hero, destination tile is on water!"))
|| ((h->boat && t.terType.isLand() && t.blocked)
|| ((h->boat && t.terType->isLand() && t.blocked)
&& complain("Cannot disembark hero, tile is blocked!"))
|| ((distance(h->pos, dst) >= 1.5 && !teleporting)
&& complain("Tiles are not neighboring!"))