From 124d732171fdc15af6da266d5e88537fd34237d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Thu, 7 Feb 2013 15:27:22 +0000 Subject: [PATCH] * fixed race condition crash * no crash when there is no creature in dwelling (that should not happen at all... but) * removed paths from vcxproj, use property sheets --- client/CCastleInterface.cpp | 13 +++++++++++-- client/CPreGame.cpp | 4 ++++ client/VCMI_client.vcxproj | 13 ------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/CCastleInterface.cpp b/client/CCastleInterface.cpp index 3ce62fe8f..85e5a1539 100644 --- a/client/CCastleInterface.cpp +++ b/client/CCastleInterface.cpp @@ -205,8 +205,17 @@ std::string getBuildingSubtitle(const CStructure * structure)//hover text for bu return t->town->buildings[structure->building->bid]->Name(); else//dwellings - recruit %creature% { - int creaID = t->creatures[(bid-30)%GameConstants::CREATURES_PER_TOWN].second.back();//taking last of available creatures - return CGI->generaltexth->allTexts[16] + " " + CGI->creh->creatures[creaID]->namePl; + auto & availableCreatures = t->creatures[(bid-30)%GameConstants::CREATURES_PER_TOWN].second; + if(availableCreatures.size()) + { + int creaID = availableCreatures.back();//taking last of available creatures + return CGI->generaltexth->allTexts[16] + " " + CGI->creh->creatures[creaID]->namePl; + } + else + { + tlog2 << "Problem: dwelling with id " << bid << " offers no creatures!\n"; + return "#ERROR#"; + } } } diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 884934f4c..5cb3350bc 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -471,9 +471,13 @@ CGPreGame::CGPreGame(): CGPreGame::~CGPreGame() { + boost::unique_lock lock(*CPlayerInterface::pim); disposeGraphics(); if(CGP == this) CGP = nullptr; + + if(GH.curInt == this) + GH.curInt = nullptr; } void CGPreGame::openSel(CMenuScreen::EState screenType, CMenuScreen::EMultiMode multi /*= CMenuScreen::SINGLE_PLAYER*/) diff --git a/client/VCMI_client.vcxproj b/client/VCMI_client.vcxproj index 40eec740b..71ec7df31 100644 --- a/client/VCMI_client.vcxproj +++ b/client/VCMI_client.vcxproj @@ -92,19 +92,6 @@ - - C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;$(SolutionDir)..\include;$(IncludePath) - C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Lib;$(SolutionDir)..\libs\$(PlatformShortName);$(VCMI_Out);$(LibraryPath) - - - C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;$(SolutionDir)..\include;$(IncludePath) - - - C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;$(SolutionDir)..\include;$(IncludePath) - - - C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files %28x86%29\Microsoft SDKs\Windows\v7.0A\Include;$(SolutionDir)..\include;$(IncludePath) - /MP4 %(AdditionalOptions)