mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Fixed major RMG bug.
This commit is contained in:
parent
e77f328844
commit
5cb6eaa252
@ -3281,6 +3281,7 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
|
||||
{
|
||||
assert(hero);
|
||||
assert(hero == getHero(hero->id));
|
||||
|
||||
if(src.x < 0)
|
||||
src = hero->getPosition(false);
|
||||
if(movement < 0)
|
||||
@ -3303,9 +3304,9 @@ void CPathfinder::calculatePaths(int3 src /*= int3(-1,-1,-1)*/, int movement /*=
|
||||
return;
|
||||
}
|
||||
|
||||
//logGlobal->infoStream() << boost::format("Calculating paths for hero %s (adress %d) of player %d") % hero->name % hero % hero->tempOwner;
|
||||
initializeGraph();
|
||||
|
||||
|
||||
//initial tile - set cost on 0 and add to the queue
|
||||
CGPathNode &initialNode = *getNode(src);
|
||||
initialNode.turns = 0;
|
||||
@ -3457,7 +3458,7 @@ CGPathNode::EAccessibility CPathfinder::evaluateAccessibility(const TerrainTile
|
||||
{
|
||||
for(const CGObjectInstance *obj : tinfo->visitableObjects)
|
||||
{
|
||||
if(obj->passableFor(hero->tempOwner)) //special object instance specific passableness flag - overwrites other accessibility flags
|
||||
if (obj->passableFor(hero->tempOwner))
|
||||
{
|
||||
ret = CGPathNode::ACCESSIBLE;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ void CGTownInstance::onHeroLeave(const CGHeroInstance * h) const
|
||||
if (visitingHero == h)
|
||||
{
|
||||
cb->stopHeroVisitCastle(this, h);
|
||||
logGlobal->warnStream() << h->name << " correctly left town " << name;
|
||||
//logGlobal->warnStream() << h->name << " correctly left town " << name;
|
||||
}
|
||||
else
|
||||
logGlobal->warnStream() << "Warning, " << h->name << " tries to leave the town " << name << " but hero is not inside.";
|
||||
@ -912,12 +912,13 @@ bool CGTownInstance::addBonusIfBuilt(BuildingID building, Bonus::BonusType type,
|
||||
|
||||
void CGTownInstance::setVisitingHero(CGHeroInstance *h)
|
||||
{
|
||||
if (!(!!visitingHero == !h))
|
||||
{
|
||||
logGlobal->warnStream() << boost::format("Hero visiting town %s is %s ") % name % (visitingHero.get() ? visitingHero->name : "NULL");
|
||||
logGlobal->warnStream() << boost::format("New hero will be %s ") % (h ? h->name : "NULL");
|
||||
assert(!!visitingHero == !h);
|
||||
}
|
||||
//if (!(!!visitingHero == !h))
|
||||
//{
|
||||
// logGlobal->warnStream() << boost::format("Hero visiting town %s is %s ") % name % (visitingHero.get() ? visitingHero->name : "NULL");
|
||||
// logGlobal->warnStream() << boost::format("New hero will be %s ") % (h ? h->name : "NULL");
|
||||
//
|
||||
//}
|
||||
assert(!!visitingHero == !h);
|
||||
|
||||
if(h)
|
||||
{
|
||||
|
@ -1393,7 +1393,6 @@ void CRmgTemplateZone::checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance*
|
||||
object->appearance = templates.front();
|
||||
}
|
||||
|
||||
gen->map->addBlockVisTiles(object);
|
||||
gen->editManager->insertObject(object, pos);
|
||||
//logGlobal->traceStream() << boost::format ("Successfully inserted object (%d,%d) at pos %s") %object->ID %object->subID %pos();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user