mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
Work on pathfinder: torn the code out from CGameState into a separate class. It can use Subterranean Gates and Boats. Removed code for handling Fly spell effect. It didn't work as supposed anyway.
This commit is contained in:
@ -1479,6 +1479,14 @@ CBonusSystemNode * CGHeroInstance::whereShouldBeAttached(CGameState *gs)
|
||||
return CArmedInstance::whereShouldBeAttached(gs);
|
||||
}
|
||||
|
||||
int CGHeroInstance::movementPointsAfterEmbark(int MPsBefore, int basicCost, bool disembark /*= false*/) const
|
||||
{
|
||||
if(hasBonusOfType(Bonus::FREE_SHIP_BOARDING))
|
||||
return (MPsBefore - basicCost) * ((float)(maxMovePoints(disembark)) / maxMovePoints(!disembark));
|
||||
|
||||
return 0; //take all MPs otherwise
|
||||
}
|
||||
|
||||
void CGDwelling::initObj()
|
||||
{
|
||||
switch(ID)
|
||||
@ -3573,22 +3581,8 @@ void CGTeleport::onHeroVisit( const CGHeroInstance * h ) const
|
||||
break;
|
||||
case 103: //find nearest subterranean gate on the other level
|
||||
{
|
||||
int i=0;
|
||||
for(; i < gates.size(); i++)
|
||||
{
|
||||
if(gates[i].first == id)
|
||||
{
|
||||
destinationid = gates[i].second;
|
||||
break;
|
||||
}
|
||||
else if(gates[i].second == id)
|
||||
{
|
||||
destinationid = gates[i].first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(destinationid < 0 || i == gates.size()) //no exit
|
||||
destinationid = getMatchingGate(id);
|
||||
if(destinationid < 0) //no exit
|
||||
{
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
@ -3676,6 +3670,19 @@ void CGTeleport::postInit() //matches subterranean gates into pairs
|
||||
objs.erase(103);
|
||||
}
|
||||
|
||||
int CGTeleport::getMatchingGate(int id)
|
||||
{
|
||||
for(int i=0; i < gates.size(); i++)
|
||||
{
|
||||
if(gates[i].first == id)
|
||||
return gates[i].second;
|
||||
if(gates[i].second == id)
|
||||
return gates[i].first;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CGArtifact::initObj()
|
||||
{
|
||||
blockVisit = true;
|
||||
|
Reference in New Issue
Block a user