1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
* fixed advancing between misisons in campaigns
This commit is contained in:
Michał W. Urbańczyk 2013-02-05 20:06:13 +00:00
parent 8ffd482324
commit 17755caa10
6 changed files with 15 additions and 11 deletions

View File

@ -828,8 +828,7 @@ static void listenForEvents()
// else
{
endGame();
CGPreGame::create();
GH.curInt = CGP;
GH.curInt = CGPreGame::create();;
GH.defActionsDef = 63;
}
}

View File

@ -74,6 +74,7 @@ void processCommand(const std::string &message, CClient *&client);
extern std::queue<SDL_Event> events;
extern boost::mutex eventsM;
boost::recursive_mutex * CPlayerInterface::pim = new boost::recursive_mutex;
CondSh<bool> CPlayerInterface::terminate_cond;
CPlayerInterface * LOCPLINT;
@ -1539,10 +1540,10 @@ void CPlayerInterface::update()
while(!terminate_cond.get() && !pim->try_lock()) //try acquiring long until it succeeds or we are told to terminate
boost::this_thread::sleep(boost::posix_time::milliseconds(15));
boost::unique_lock<boost::recursive_mutex> un(*pim, boost::adopt_lock); //create lock from already owned mutex
if(terminate_cond.get())
return;
boost::unique_lock<boost::recursive_mutex> un(*pim, boost::adopt_lock); //create lock from already owned mutex
//make sure that gamestate won't change when GUI objects may obtain its parts on event processing or drawing request
boost::shared_lock<boost::shared_mutex> gsLock(cb->getGsMutex());

View File

@ -245,7 +245,7 @@ public:
CPlayerInterface(int Player);//c-tor
~CPlayerInterface();//d-tor
CondSh<bool> terminate_cond; // confirm termination
static CondSh<bool> terminate_cond; // confirm termination
//////////////////////////////////////////////////////////////////////////

View File

@ -472,6 +472,8 @@ CGPreGame::CGPreGame():
CGPreGame::~CGPreGame()
{
disposeGraphics();
if(CGP == this)
CGP = nullptr;
}
void CGPreGame::openSel(CMenuScreen::EState screenType, CMenuScreen::EMultiMode multi /*= CMenuScreen::SINGLE_PLAYER*/)

View File

@ -406,11 +406,6 @@ CVideoPlayer::~CVideoPlayer()
bool CVideoPlayer::open(std::string name)
{
if(boost::algorithm::ends_with(name, ".BIK"))
current = &bikPlayer;
else
current = &smkPlayer;
fname = name;
first = true;
@ -419,8 +414,15 @@ bool CVideoPlayer::open(std::string name)
// Extract video from video.vid so we can play it.
// We can handle only videos in form of single file, no archive support yet.
{
auto myVideo = CResourceHandler::get()->load(ResourceID("VIDEO/" + name, EResType::VIDEO));
ResourceID videoID = ResourceID("VIDEO/" + name, EResType::VIDEO);
std::string realVideoFilename = CResourceHandler::get()->getResourceName(videoID);
if(boost::algorithm::iends_with(realVideoFilename, ".BIK"))
current = &bikPlayer;
else
current = &smkPlayer;
auto myVideo = CResourceHandler::get()->load(videoID);
unique_ptr<char[]> data = unique_ptr<char[]>(new char[myVideo->getSize()]);
myVideo->read((ui8*)data.get(), myVideo->getSize());

View File

@ -531,7 +531,7 @@ void CClient::proposeNextMission(shared_ptr<CCampaignState> camp)
endGame(false);
LOCPLINT = nullptr; //TODO free res
GH.pushInt(new CBonusSelection(camp));
GH.curInt = CGP;
GH.curInt = CGPreGame::create();
}
void CClient::stopConnection()