mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
parent
c7772aa5a4
commit
4e4ba6654c
@ -101,7 +101,6 @@ struct OCM_HLP_CGIN
|
||||
} ocmptwo_cgin ;
|
||||
|
||||
|
||||
|
||||
CPlayerInterface::CPlayerInterface(PlayerColor Player)
|
||||
{
|
||||
logGlobal->traceStream() << "\tHuman player interface for player " << Player << " being constructed";
|
||||
@ -1503,8 +1502,16 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
|
||||
if(focusTime)
|
||||
{
|
||||
GH.totalRedraw();
|
||||
#ifdef VCMI_SDL1
|
||||
CSDL_Ext::update(screen);
|
||||
SDL_Delay(focusTime);
|
||||
#else
|
||||
{
|
||||
auto unlockPim = vstd::makeUnlockGuard(*pim);
|
||||
IgnoreEvents ignore(*this);
|
||||
SDL_Delay(focusTime);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -2553,6 +2560,16 @@ bool CPlayerInterface::capturedAllEvents()
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ignoreEvents)
|
||||
{
|
||||
boost::unique_lock<boost::mutex> un(eventsM);
|
||||
while(!events.empty())
|
||||
{
|
||||
events.pop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -268,8 +268,26 @@ private:
|
||||
|
||||
template <typename Handler> void serializeTempl(Handler &h, const int version);
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
struct IgnoreEvents
|
||||
{
|
||||
CPlayerInterface & owner;
|
||||
IgnoreEvents(CPlayerInterface & Owner):owner(Owner)
|
||||
{
|
||||
owner.ignoreEvents = true;
|
||||
};
|
||||
~IgnoreEvents()
|
||||
{
|
||||
owner.ignoreEvents = false;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool duringMovement;
|
||||
bool ignoreEvents;
|
||||
|
||||
void doMoveHero(const CGHeroInstance *h, CGPath path);
|
||||
};
|
||||
|
@ -164,6 +164,11 @@ void SetMovePoints::applyCl( CClient *cl )
|
||||
void FoWChange::applyCl( CClient *cl )
|
||||
{
|
||||
for(auto &i : cl->playerint)
|
||||
{
|
||||
if(cl->getPlayerRelations(i.first, player) == PlayerRelations::SAME_PLAYER && waitForDialogs && LOCPLINT == i.second.get())
|
||||
{
|
||||
LOCPLINT->waitWhileDialog();
|
||||
}
|
||||
if(cl->getPlayerRelations(i.first, player) != PlayerRelations::ENEMIES)
|
||||
{
|
||||
if(mode)
|
||||
@ -171,7 +176,7 @@ void FoWChange::applyCl( CClient *cl )
|
||||
else
|
||||
i.second->tileHidden(tiles);
|
||||
}
|
||||
|
||||
}
|
||||
cl->invalidatePaths();
|
||||
}
|
||||
|
||||
|
@ -302,16 +302,17 @@ struct SetMovePoints : public CPackForClient //111
|
||||
|
||||
struct FoWChange : public CPackForClient //112
|
||||
{
|
||||
FoWChange(){type = 112;};
|
||||
FoWChange(){type = 112;waitForDialogs = false;};
|
||||
void applyCl(CClient *cl);
|
||||
DLL_LINKAGE void applyGs(CGameState *gs);
|
||||
|
||||
std::unordered_set<int3, struct ShashInt3 > tiles;
|
||||
PlayerColor player;
|
||||
ui8 mode; //mode==0 - hide, mode==1 - reveal
|
||||
bool waitForDialogs;
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & tiles & player & mode;
|
||||
h & tiles & player & mode & waitForDialogs;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1294,6 +1294,7 @@ void CGMagi::onHeroVisit(const CGHeroInstance * h) const
|
||||
FoWChange fw;
|
||||
fw.player = h->tempOwner;
|
||||
fw.mode = 1;
|
||||
fw.waitForDialogs = true;
|
||||
|
||||
for(auto it : eyelist[subID])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user