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