1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

Compile fixes for Visual.

This commit is contained in:
DjWarmonger 2014-09-05 20:13:58 +02:00
parent a89512111c
commit ec8476d43a
6 changed files with 28 additions and 12 deletions

View File

@ -1349,7 +1349,7 @@ void CPlayerInterface::showGarrisonDialog( const CArmedInstance *up, const CGHer
* is false.
* @param assemble True if the artifact is to be assembled, false if it is to be disassembled.
*/
void CPlayerInterface::showArtifactAssemblyDialog (ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList<void()> onYes, CFunctionList<void()> onNo)
void CPlayerInterface::showArtifactAssemblyDialog (ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList<bool()> onYes, CFunctionList<bool()> onNo)
{
const CArtifact &artifact = *CGI->arth->artifacts[artifactID];
std::string text = artifact.Description();

View File

@ -217,7 +217,7 @@ public:
void yourTacticPhase(int distance) override;
//-------------//
void showArtifactAssemblyDialog(ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList<void()> onYes, CFunctionList<void()> onNo);
void showArtifactAssemblyDialog(ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList<bool()> onYes, CFunctionList<bool()> onNo);
void garrisonsChanged(std::vector<const CGObjectInstance *> objs);
void garrisonChanged(const CGObjectInstance * obj);
void heroKilled(const CGHeroInstance* hero);

View File

@ -174,6 +174,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\CCallback.cpp" />
<ClCompile Include="battle\CBattleAnimations.cpp" />
<ClCompile Include="battle\CBattleInterface.cpp" />
<ClCompile Include="battle\CBattleInterfaceClasses.cpp" />
@ -198,7 +199,9 @@
<ClCompile Include="gui\SDL_Extensions.cpp" />
<ClCompile Include="mapHandler.cpp" />
<ClCompile Include="NetPacksClient.cpp" />
<ClCompile Include="StdInc.cpp" />
<ClCompile Include="StdInc.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='RD|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="widgets\AdventureMapClasses.cpp" />
<ClCompile Include="widgets\Buttons.cpp" />
<ClCompile Include="widgets\CArtifactHolder.cpp" />
@ -221,6 +224,7 @@
<ClCompile Include="windows\InfoWindows.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CCallback.h" />
<ClInclude Include="battle\CBattleAnimations.h" />
<ClInclude Include="battle\CBattleInterface.h" />
<ClInclude Include="battle\CBattleInterfaceClasses.h" />

View File

@ -108,6 +108,7 @@
<ClCompile Include="gui\SDL_Extensions.cpp">
<Filter>gui</Filter>
</ClCompile>
<ClCompile Include="..\CCallback.cpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CQuestLog.cpp">
@ -252,5 +253,6 @@
<ClInclude Include="gui\SDL_Pixels.h">
<Filter>gui</Filter>
</ClInclude>
<ClInclude Include="..\CCallback.h" />
</ItemGroup>
</Project>

View File

@ -297,7 +297,12 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals
void CHeroWindow::dismissCurrent()
{
CFunctionList<void()> ony = std::bind(&CHeroWindow::close,this);
ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero);
//ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero); //can't assign bool function to void function list :(
auto dismiss = [=]() -> void
{
LOCPLINT->cb.get()->dismissHero(curHero);
};
ony += dismiss;
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[22], ony, 0, false);
}

View File

@ -66,16 +66,16 @@ void CSelWindow::selectionChange(unsigned to)
redraw();
}
CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperline, const std::vector<CSelectableComponent*> &comps, const std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons, QueryID askID)
CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperline, const std::vector<CSelectableComponent*> &comps, const std::vector<std::pair<std::string, CFunctionList<void()> > > &Buttons, QueryID askID)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
ID = askID;
for(int i=0;i<Buttons.size();i++)
for (int i = 0; i < Buttons.size(); i++)
{
buttons.push_back(new CButton(Point(0,0), Buttons[i].first, CButton::tooltip(), Buttons[i].second));
if(!i && askID.getNum() >= 0)
buttons.back()->addCallback(std::bind(&CSelWindow::madeChoice,this));
buttons[i]->addCallback(std::bind(&CInfoWindow::close,this)); //each button will close the window apart from call-defined actions
buttons.push_back(new CButton(Point(0, 0), Buttons[i].first, CButton::tooltip(), Buttons[i].second));
if (!i && askID.getNum() >= 0)
buttons.back()->addCallback(std::bind(&CSelWindow::madeChoice, this));
buttons[i]->addCallback(std::bind(&CInfoWindow::close, this)); //each button will close the window apart from call-defined actions
}
text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE);
@ -83,8 +83,13 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl
buttons.front()->assignedKeys.insert(SDLK_RETURN); //first button - reacts on enter
buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape
if(buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality
buttons.back()->addCallback(std::bind(&CCallback::selectionMade,LOCPLINT->cb.get(),0,askID));
if (buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality
{
buttons.back()->addCallback([askID]() {
LOCPLINT->cb.get()->selectionMade(0, askID);
});
//buttons.back()->addCallback(std::bind(&CCallback::selectionMade, LOCPLINT->cb.get(), 0, askID));
}
for(int i=0;i<comps.size();i++)
{