mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
- fixed deadlock on visiting such objects like artifacts
- typos in vcmibuilder script
This commit is contained in:
@ -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);
|
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)
|
//interaction with blocking object (like resources)
|
||||||
auto blockingVisit = [&]() -> bool
|
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))
|
if(obj != h && obj->blockVisit && !(obj->getPassableness() & 1<<h->tempOwner))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
applyWithResult(TryMoveHero::BLOCKING_VISIT);
|
||||||
|
|
||||||
//can't move to that tile but we visit object
|
//can't move to that tile but we visit object
|
||||||
objectVisited(t.visitableObjects.back(), h);
|
objectVisited(t.visitableObjects.back(), h);
|
||||||
|
|
||||||
@ -1715,13 +1725,6 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto applyWithResult = [&](TryMoveHero::EResult result) -> bool
|
|
||||||
{
|
|
||||||
tmh.result = result;
|
|
||||||
sendAndApply(&tmh);
|
|
||||||
return result != TryMoveHero::FAILED;
|
|
||||||
};
|
|
||||||
|
|
||||||
//hero enters the boat
|
//hero enters the boat
|
||||||
if(!h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::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);
|
tmh.movePoints = std::max(ui32(0), h->movement - cost);
|
||||||
|
|
||||||
if(blockingVisit())
|
if(blockingVisit())
|
||||||
return applyWithResult(TryMoveHero::BLOCKING_VISIT);
|
return true;
|
||||||
|
|
||||||
leaveTile();
|
leaveTile();
|
||||||
|
|
||||||
@ -1770,7 +1773,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
|||||||
else //instant move - teleportation
|
else //instant move - teleportation
|
||||||
{
|
{
|
||||||
if(blockingVisit()) // e.g. hero on the other side of teleporter
|
if(blockingVisit()) // e.g. hero on the other side of teleporter
|
||||||
return applyWithResult(TryMoveHero::BLOCKING_VISIT);
|
return true;
|
||||||
|
|
||||||
leaveTile();
|
leaveTile();
|
||||||
applyWithResult(TryMoveHero::TELEPORTATION);
|
applyWithResult(TryMoveHero::TELEPORTATION);
|
||||||
|
@ -221,7 +221,7 @@ then
|
|||||||
|
|
||||||
if [[ -z "$vcmi_archive" ]]
|
if [[ -z "$vcmi_archive" ]]
|
||||||
then
|
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"
|
vcmi_archive="./core.zip"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -235,7 +235,7 @@ fi
|
|||||||
if [[ -n "$vcmi_archive" ]]
|
if [[ -n "$vcmi_archive" ]]
|
||||||
then
|
then
|
||||||
echo "decompressing $vcmi_archive"
|
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
|
fi
|
||||||
|
|
||||||
if [[ -n "$validate" ]]
|
if [[ -n "$validate" ]]
|
||||||
|
Reference in New Issue
Block a user