|
|
@@ -444,21 +444,38 @@ void CGHeroInstance::onHeroVisit(const CGHeroInstance * h) const
|
|
|
//update hero parameters
|
|
|
SetMovePoints smp;
|
|
|
smp.hid = id;
|
|
|
- smp.val = maxMovePoints (true); //TODO: hota prison on water?
|
|
|
+
|
|
|
+ cb->setManaPoints (id, manaLimit());
|
|
|
+
|
|
|
+ ObjectInstanceID boatId;
|
|
|
+ if (cb->gameState()->map->getTile(pos).isWater())
|
|
|
+ {
|
|
|
+ smp.val = maxMovePoints(false);
|
|
|
+ //Create a new boat for hero
|
|
|
+ NewObject no;
|
|
|
+ no.ID = Obj::BOAT;
|
|
|
+ no.subID = getBoatType().getNum();
|
|
|
+ no.pos = pos + int3(1,0,0); //FIXME: handle this magic offset somehow
|
|
|
+
|
|
|
+ cb->sendAndApply(&no);
|
|
|
+
|
|
|
+ cb->getVisitableObjs(pos);
|
|
|
+ boatId = cb->getTopObj(pos)->id;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ smp.val = maxMovePoints(true);
|
|
|
+ }
|
|
|
+ cb->giveHero(id, h->tempOwner, boatId); //recreates def and adds hero to player
|
|
|
+ cb->setObjProperty(id, ObjProperty::ID, Obj::HERO); //set ID to 34 AFTER hero gets correct flag color
|
|
|
cb->setMovePoints (&smp);
|
|
|
- cb->setManaPoints (id, manaLimit());
|
|
|
|
|
|
- cb->setObjProperty(id, ObjProperty::ID, Obj::HERO); //set ID to 34
|
|
|
- cb->giveHero(id,h->tempOwner); //recreates def and adds hero to player
|
|
|
-
|
|
|
- txt_id = 102;
|
|
|
+ h->showInfoDialog(102);
|
|
|
}
|
|
|
else //already 8 wandering heroes
|
|
|
{
|
|
|
- txt_id = 103;
|
|
|
+ h->showInfoDialog(103);
|
|
|
}
|
|
|
-
|
|
|
- h->showInfoDialog(txt_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -939,13 +956,7 @@ si32 CGHeroInstance::getManaNewTurn() const
|
|
|
|
|
|
BoatId CGHeroInstance::getBoatType() const
|
|
|
{
|
|
|
- switch(type->heroClass->getAlignment())
|
|
|
- {
|
|
|
- case EAlignment::EVIL : return EBoatId::BOAT_EVIL;
|
|
|
- case EAlignment::GOOD : return EBoatId::BOAT_GOOD;
|
|
|
- case EAlignment::NEUTRAL : return EBoatId::BOAT_NEUTRAL;
|
|
|
- default: return EBoatId::NONE;
|
|
|
- }
|
|
|
+ return type->getBoatType();
|
|
|
}
|
|
|
|
|
|
void CGHeroInstance::getOutOffsets(std::vector<int3> &offsets) const
|