Michał W. Urbańczyk 16 年之前
父節點
當前提交
82faf7538e
共有 4 個文件被更改,包括 13 次插入9 次删除
  1. 2 2
      client/CPreGame.cpp
  2. 3 2
      client/GUIClasses.cpp
  3. 3 3
      hch/CObjectHandler.cpp
  4. 5 2
      lib/CGameState.cpp

+ 2 - 2
client/CPreGame.cpp

@@ -70,8 +70,8 @@ CMenuScreen::CMenuScreen( EState which )
 			buttons[1] = new AdventureMapButton("", CGI->generaltexth->zelp[4].second, bind(&CMenuScreen::moveTo, this, ref(CGP->scrs[loadGame])), 532, 132, "ZMENULG.DEF", SDLK_l);
 			buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[5].second, 0 /*cb*/, 524, 251, "ZMENUHS.DEF", SDLK_h);
 			buttons[3] = new AdventureMapButton("", CGI->generaltexth->zelp[6].second, 0 /*cb*/, 557, 359, "ZMENUCR.DEF", SDLK_c);
-			//boost::function<void()> confWindow = bind(CInfoWindow::showYesNoDialog, )
-			buttons[4] = new AdventureMapButton("", CGI->generaltexth->zelp[7].second, do_quit, 586, 468, "ZMENUQT.DEF", SDLK_ESCAPE);
+			boost::function<void()> confWindow = bind(CInfoWindow::showYesNoDialog, ref(CGI->generaltexth->allTexts[69]), (const std::vector<SComponent*>*)0, do_quit, 0, false, 1);
+			buttons[4] = new AdventureMapButton("", CGI->generaltexth->zelp[7].second, confWindow, 586, 468, "ZMENUQT.DEF", SDLK_ESCAPE);
 		}
 		break;
 	case newGame:

+ 3 - 2
client/GUIClasses.cpp

@@ -651,7 +651,8 @@ CInfoWindow::CInfoWindow()
 void CInfoWindow::close()
 {
 	GH.popIntTotally(this);
-	LOCPLINT->showingDialog->setn(false);
+	if(LOCPLINT)
+		LOCPLINT->showingDialog->setn(false);
 }
 void CInfoWindow::show(SDL_Surface * to)
 {
@@ -705,7 +706,7 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const std::vector<SC
 	std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
 	pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
 	pom.push_back(std::pair<std::string,CFunctionList<void()> >("ICANCEL.DEF",0));
-	CInfoWindow * temp = new CInfoWindow(text, player, 0, *components, pom, DelComps);
+	CInfoWindow * temp = new CInfoWindow(text, player, 0, components ? *components : std::vector<SComponent*>(), pom, DelComps);
 	temp->delComps = DelComps;
 	for(int i=0;i<onYes.funcs.size();i++)
 		temp->buttons[0]->callback += onYes.funcs[i];

+ 3 - 3
hch/CObjectHandler.cpp

@@ -3326,7 +3326,7 @@ const std::string & CGMagicWell::getHoverText() const
 
 void CGPandoraBox::initObj()
 {
-	blockVisit = true;
+	blockVisit = (ID==6); //block only if it's really pandora's box (events also derive from that class)
 }
 
 void CGPandoraBox::onHeroVisit(const CGHeroInstance * h) const
@@ -3501,8 +3501,8 @@ void CGPandoraBox::giveContents( const CGHeroInstance *h, bool afterBattle ) con
 		cb->showInfoDialog(&iw);
 	}
 
-	iw.components.clear();
-	getText(iw,afterBattle,183,h);
+ 	iw.components.clear();
+// 	getText(iw,afterBattle,183,h);
 	for(int i=0; i<artifacts.size(); i++)
 	{
 		iw.components.push_back(Component(Component::ARTIFACT,artifacts[i],0,0));

+ 5 - 2
lib/CGameState.cpp

@@ -2095,13 +2095,16 @@ void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int
 				{
 					for(size_t ii = 0; ii < tinfo->visitableObjects.size(); ii++)
 					{
-						if(tinfo->visitableObjects[ii]->blockVisit)
+						const CGObjectInstance * const obj = tinfo->visitableObjects[ii];
+						if(obj->blockVisit)
 						{
 							node.accessible = CGPathNode::BLOCKVIS;
 							break;
 						}
-						else
+						else if(obj->ID != 26) //pathfinder should ignore placed events
+						{
 							node.accessible = CGPathNode::VISITABLE;
+						}
 					}
 				}