Sfoglia il codice sorgente

Compile fixes for Visual.

DjWarmonger 11 anni fa
parent
commit
ec8476d43a

+ 1 - 1
client/CPlayerInterface.cpp

@@ -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();

+ 1 - 1
client/CPlayerInterface.h

@@ -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);

+ 5 - 1
client/VCMI_client.vcxproj

@@ -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" />

+ 2 - 0
client/VCMI_client.vcxproj.filters

@@ -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>

+ 6 - 1
client/windows/CHeroWindow.cpp

@@ -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);
 }
 

+ 13 - 8
client/windows/InfoWindows.cpp

@@ -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++)
 	{