1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

- fixed deadlock on visiting such objects like artifacts

- typos in vcmibuilder script
This commit is contained in:
Ivan Savenko 2012-12-05 10:46:53 +00:00
parent 85a23e298c
commit cfaa9fd00a
2 changed files with 14 additions and 11 deletions

View File

@ -1698,6 +1698,13 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
getTilesInRange(tmh.fowRevealed, h->getSightCenter()+(tmh.end-tmh.start), h->getSightRadious(), h->tempOwner, 1);
};
auto applyWithResult = [&](TryMoveHero::EResult result) -> bool
{
tmh.result = result;
sendAndApply(&tmh);
return result != TryMoveHero::FAILED;
};
//interaction with blocking object (like resources)
auto blockingVisit = [&]() -> bool
{
@ -1705,6 +1712,9 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
{
if(obj != h && obj->blockVisit && !(obj->getPassableness() & 1<<h->tempOwner))
{
applyWithResult(TryMoveHero::BLOCKING_VISIT);
//can't move to that tile but we visit object
objectVisited(t.visitableObjects.back(), h);
@ -1715,13 +1725,6 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
return false;
};
auto applyWithResult = [&](TryMoveHero::EResult result) -> bool
{
tmh.result = result;
sendAndApply(&tmh);
return result != TryMoveHero::FAILED;
};
//hero enters the boat
if(!h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::BOAT)
{
@ -1752,7 +1755,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
tmh.movePoints = std::max(ui32(0), h->movement - cost);
if(blockingVisit())
return applyWithResult(TryMoveHero::BLOCKING_VISIT);
return true;
leaveTile();
@ -1770,7 +1773,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
else //instant move - teleportation
{
if(blockingVisit()) // e.g. hero on the other side of teleporter
return applyWithResult(TryMoveHero::BLOCKING_VISIT);
return true;
leaveTile();
applyWithResult(TryMoveHero::TELEPORTATION);

View File

@ -221,7 +221,7 @@ then
if [[ -z "$vcmi_archive" ]]
then
wget "http://download.vcmi.eu/core.zip" -O core.zip || fail "Error: failed to download WoG archive!" "rm -f core.zip"
wget "http://download.vcmi.eu/core.zip" -O core.zip || fail "Error: failed to download VCMI archive!" "rm -f core.zip"
vcmi_archive="./core.zip"
fi
fi
@ -235,7 +235,7 @@ fi
if [[ -n "$vcmi_archive" ]]
then
echo "decompressing $vcmi_archive"
unzip -qo $vcmi_archive -d $dest_dir || fail "Error: failed to extract WoG archive!"
unzip -qo $vcmi_archive -d $dest_dir || fail "Error: failed to extract VCMI archive!"
fi
if [[ -n "$validate" ]]