mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
parent
ab8e24c490
commit
9febb357ff
@ -86,6 +86,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen);
|
||||
void dispose();
|
||||
void playIntro();
|
||||
static void listenForEvents();
|
||||
void requestChangingResolution();
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef _GNU_SOURCE
|
||||
@ -531,6 +532,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
//TODO: centering game window on other platforms (or does the environment do their job correctly there?)
|
||||
|
||||
screenBuf = bufOnScreen ? screen : screen2;
|
||||
setResolution = true;
|
||||
}
|
||||
|
||||
static void listenForEvents()
|
||||
@ -572,8 +574,8 @@ static void listenForEvents()
|
||||
}
|
||||
else if(ev->type == SDL_USEREVENT && ev->user.code == 1)
|
||||
{
|
||||
tlog0 << "Changing resolution has been requested\n";
|
||||
setScreenRes(conf.cc.resx,conf.cc.resy,conf.cc.bpp,conf.cc.fullscreen);
|
||||
setResolution = true;
|
||||
delete ev;
|
||||
continue;
|
||||
}
|
||||
@ -611,15 +613,18 @@ void startGame(StartInfo * options)
|
||||
|
||||
if(screen->w != conf.cc.resx || screen->h != conf.cc.resy)
|
||||
{
|
||||
//push special event to order event reading thread to change resolution
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_USEREVENT;
|
||||
ev.user.code = 1;
|
||||
SDL_PushEvent(&ev);
|
||||
requestChangingResolution();
|
||||
|
||||
//allow event handling thread change resolution
|
||||
eventsM.unlock();
|
||||
while(!setResolution) boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||
eventsM.lock();
|
||||
}
|
||||
else
|
||||
setResolution = true;
|
||||
|
||||
|
||||
|
||||
client = new CClient;
|
||||
switch(options->mode) //new game
|
||||
{
|
||||
@ -635,11 +640,17 @@ void startGame(StartInfo * options)
|
||||
}
|
||||
|
||||
CGI->musich->stopMusic();
|
||||
|
||||
//allow event handling thread change resolution
|
||||
eventsM.unlock();
|
||||
while(!setResolution) boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||
eventsM.lock();
|
||||
|
||||
client->connectionHandler = new boost::thread(&CClient::run, client);
|
||||
}
|
||||
|
||||
void requestChangingResolution()
|
||||
{
|
||||
//mark that we are going to change resolution
|
||||
setResolution = false;
|
||||
|
||||
//push special event to order event reading thread to change resolution
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_USEREVENT;
|
||||
ev.user.code = 1;
|
||||
SDL_PushEvent(&ev);
|
||||
}
|
@ -6206,7 +6206,13 @@ void CGObelisk::setPropertyDer( ui8 what, ui32 val )
|
||||
case 20:
|
||||
assert(val < PLAYER_LIMIT);
|
||||
visited[val]++;
|
||||
assert(visited[val] <= obeliskCount);
|
||||
|
||||
if(visited[val] > obeliskCount)
|
||||
{
|
||||
tlog0 << "Error: Visited " << visited[val] << "\t\t" << obeliskCount << std::endl;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user