mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Few more freeze-related fixes.
This commit is contained in:
parent
d1807585ad
commit
c6c53a5b1e
@ -2634,6 +2634,7 @@ AIStatus::AIStatus()
|
|||||||
{
|
{
|
||||||
battle = NO_BATTLE;
|
battle = NO_BATTLE;
|
||||||
havingTurn = false;
|
havingTurn = false;
|
||||||
|
ongoingHeroMovement = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AIStatus::~AIStatus()
|
AIStatus::~AIStatus()
|
||||||
@ -2707,7 +2708,7 @@ void AIStatus::waitTillFree()
|
|||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> lock(mx);
|
boost::unique_lock<boost::mutex> lock(mx);
|
||||||
while(battle != NO_BATTLE || remainingQueries.size() || objectsBeingVisited.size() || ongoingHeroMovement)
|
while(battle != NO_BATTLE || remainingQueries.size() || objectsBeingVisited.size() || ongoingHeroMovement)
|
||||||
cv.wait(lock);
|
cv.timed_wait(lock, boost::posix_time::milliseconds(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AIStatus::haveTurn()
|
bool AIStatus::haveTurn()
|
||||||
|
@ -246,7 +246,7 @@ void DisassembledArtifact::applyCl( CClient *cl )
|
|||||||
void HeroVisit::applyCl( CClient *cl )
|
void HeroVisit::applyCl( CClient *cl )
|
||||||
{
|
{
|
||||||
assert(hero);
|
assert(hero);
|
||||||
INTERFACE_CALL_IF_PRESENT(hero->tempOwner, heroVisit, hero, obj, starting);
|
INTERFACE_CALL_IF_PRESENT(player, heroVisit, hero, obj, starting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewTurn::applyCl( CClient *cl )
|
void NewTurn::applyCl( CClient *cl )
|
||||||
|
@ -1092,6 +1092,7 @@ struct HeroVisit : CPackForClient //531
|
|||||||
{
|
{
|
||||||
const CGHeroInstance *hero;
|
const CGHeroInstance *hero;
|
||||||
const CGObjectInstance *obj;
|
const CGObjectInstance *obj;
|
||||||
|
PlayerColor player; //if hero was killed during the visit, its color is already reset
|
||||||
bool starting; //false -> ending
|
bool starting; //false -> ending
|
||||||
|
|
||||||
void applyCl(CClient *cl);
|
void applyCl(CClient *cl);
|
||||||
@ -1099,7 +1100,7 @@ struct HeroVisit : CPackForClient //531
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & hero & obj & starting;
|
h & hero & obj & player & starting;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4961,6 +4961,7 @@ void CGameHandler::objectVisited( const CGObjectInstance * obj, const CGHeroInst
|
|||||||
HeroVisit hv;
|
HeroVisit hv;
|
||||||
hv.obj = obj;
|
hv.obj = obj;
|
||||||
hv.hero = h;
|
hv.hero = h;
|
||||||
|
hv.player = h->tempOwner;
|
||||||
hv.starting = true;
|
hv.starting = true;
|
||||||
sendAndApply(&hv);
|
sendAndApply(&hv);
|
||||||
|
|
||||||
@ -4974,6 +4975,7 @@ void CGameHandler::objectVisitEnded(const CObjectVisitQuery &query)
|
|||||||
logGlobal->traceStream() << query.visitingHero->nodeName() << " visit ends.\n";
|
logGlobal->traceStream() << query.visitingHero->nodeName() << " visit ends.\n";
|
||||||
|
|
||||||
HeroVisit hv;
|
HeroVisit hv;
|
||||||
|
hv.player = query.players.front();
|
||||||
hv.obj = nullptr; //not necessary, moreover may have been deleted in the meantime
|
hv.obj = nullptr; //not necessary, moreover may have been deleted in the meantime
|
||||||
hv.hero = query.visitingHero;
|
hv.hero = query.visitingHero;
|
||||||
assert(hv.hero);
|
assert(hv.hero);
|
||||||
|
Loading…
Reference in New Issue
Block a user