mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-11 11:31:52 +02:00
Remove unused code
This commit is contained in:
parent
dfe8ca3d61
commit
0613756abc
@ -136,7 +136,6 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
|
||||
makingTurn = false;
|
||||
showingDialog = new CondSh<bool>(false);
|
||||
cingconsole = new CInGameConsole();
|
||||
GH.terminate_cond->set(false);
|
||||
firstCall = 1; //if loading will be overwritten in serialize
|
||||
autosaveCount = 0;
|
||||
isAutoFightOn = false;
|
||||
@ -1592,7 +1591,6 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
|
||||
{
|
||||
if(adventureInt)
|
||||
{
|
||||
GH.terminate_cond->setn(true);
|
||||
GH.windows().popWindows(GH.windows().count());
|
||||
adventureInt.reset();
|
||||
}
|
||||
|
@ -630,7 +630,6 @@ void CServerHandler::endGameplay(bool closeConnection, bool restart)
|
||||
{
|
||||
if(CMM)
|
||||
{
|
||||
GH.terminate_cond->setn(false);
|
||||
GH.curInt = CMM.get();
|
||||
CMM->enable();
|
||||
}
|
||||
|
@ -59,14 +59,6 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
|
||||
Settings s = settings.write["session"];
|
||||
switch(key.keysym.sym)
|
||||
{
|
||||
case SDLK_F5:
|
||||
if(settings["session"]["spectate-locked-pim"].Bool())
|
||||
CPlayerInterface::pim->unlock();
|
||||
else
|
||||
CPlayerInterface::pim->lock();
|
||||
s["spectate-locked-pim"].Bool() = !settings["session"]["spectate-locked-pim"].Bool();
|
||||
break;
|
||||
|
||||
case SDLK_F6:
|
||||
s["spectate-ignore-hero"].Bool() = !settings["session"]["spectate-ignore-hero"].Bool();
|
||||
break;
|
||||
|
@ -111,20 +111,8 @@ void CGuiHandler::stopTextInput()
|
||||
|
||||
void CGuiHandler::renderFrame()
|
||||
{
|
||||
// Updating GUI requires locking pim mutex (that protects screen and GUI state).
|
||||
// During game:
|
||||
// When ending the game, the pim mutex might be hold by other thread,
|
||||
// that will notify us about the ending game by setting terminate_cond flag.
|
||||
//in PreGame terminate_cond stay false
|
||||
|
||||
bool acquiredTheLockOnPim = false; //for tracking whether pim mutex locking succeeded
|
||||
while(!terminate_cond->get() && !(acquiredTheLockOnPim = CPlayerInterface::pim->try_lock())) //try acquiring long until it succeeds or we are told to terminate
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
|
||||
|
||||
if(acquiredTheLockOnPim)
|
||||
{
|
||||
// If we are here, pim mutex has been successfully locked - let's store it in a safe RAII lock.
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim, boost::adopt_lock);
|
||||
boost::recursive_mutex::scoped_lock un(*CPlayerInterface::pim);
|
||||
|
||||
if(nullptr != curInt)
|
||||
curInt->update();
|
||||
@ -152,14 +140,10 @@ CGuiHandler::CGuiHandler()
|
||||
, captureChildren(false)
|
||||
, curInt(nullptr)
|
||||
, fakeStatusBar(std::make_shared<EmptyStatusBar>())
|
||||
, terminate_cond (new CondSh<bool>(false))
|
||||
{
|
||||
}
|
||||
|
||||
CGuiHandler::~CGuiHandler()
|
||||
{
|
||||
delete terminate_cond;
|
||||
}
|
||||
CGuiHandler::~CGuiHandler() = default;
|
||||
|
||||
ShortcutHandler & CGuiHandler::shortcuts()
|
||||
{
|
||||
|
@ -99,8 +99,6 @@ public:
|
||||
|
||||
/// Calls provided functor in main thread on next execution frame
|
||||
void dispatchMainThread(const std::function<void()> & functor);
|
||||
|
||||
CondSh<bool> * terminate_cond; // confirm termination
|
||||
};
|
||||
|
||||
extern CGuiHandler GH; //global gui handler
|
||||
|
@ -392,7 +392,6 @@ std::shared_ptr<CMainMenu> CMainMenu::create()
|
||||
if(!CMM)
|
||||
CMM = std::shared_ptr<CMainMenu>(new CMainMenu());
|
||||
|
||||
GH.terminate_cond->setn(false);
|
||||
return CMM;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user