1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix bug of object duplicating

See the reporting https://youtu.be/MyWZj20-Iok?t=5m13s
This commit is contained in:
Mathieu Schroeter 2017-08-09 23:28:12 +02:00
parent 7aed50040e
commit 3ed5c118b8

View File

@ -2430,6 +2430,32 @@ bool CDecor::BlupiNextAction (Sint32 rank)
if (!m_blupi[rank].bExist)
return false;
/* Check if a Blupi is already doing a conflicting action at the same place.
* It happens for example when a blupi wants to carry an object from a
* direction and a second from the other direction. Without this check, the
* object is duplicated.
*/
for (int i = 0; i < MAXBLUPI; ++i)
{
if (rank == i || !m_blupi[i].bExist)
continue;
if (
(m_blupi[rank].goalAction == EV_ACTION_CARRY ||
m_blupi[rank].goalAction == EV_ACTION_EAT ||
m_blupi[rank].goalAction == EV_ACTION_DRINK) &&
(m_blupi[i].goalAction == EV_ACTION_CARRY2 ||
m_blupi[i].goalAction == EV_ACTION_EAT2 ||
m_blupi[i].goalAction == EV_ACTION_DRINK2) &&
m_blupi[rank].goalHili.x == m_blupi[i].goalHili.x &&
m_blupi[rank].goalHili.y == m_blupi[i].goalHili.y)
{
BlupiInitAction (i, ACTION_STOP);
GoalStop (i, true);
return false;
}
}
if (m_blupi[rank].clicDelay > 0)
m_blupi[rank].clicDelay--;
if (m_blupi[rank].clicDelay == 0)