Selaa lähdekoodia

* small bugfix in dismissing hero (still needs better actualization of advmap lists)
* most buttons in battleInterface

mateuszb 17 vuotta sitten
vanhempi
sitoutus
68d37e1507
3 muutettua tiedostoa jossa 35 lisäystä ja 7 poistoa
  1. 8 5
      AdventureMapButton.h
  2. 25 1
      CBattleInterface.cpp
  3. 2 1
      CHeroWindow.cpp

+ 8 - 5
AdventureMapButton.h

@@ -96,11 +96,14 @@ void AdventureMapButton<T>::clickRight (tribool down)
 template <typename T>
 void AdventureMapButton<T>::hover (bool on)
 {
-	Hoverable::hover(on);
-	if (on)
-		LOCPLINT->statusbar->print(name);
-	else if (LOCPLINT->statusbar->getCurrent()==name)
-		LOCPLINT->statusbar->clear();
+	if(name.size()) //if there is no name, there is nohing to display also
+	{
+		Hoverable::hover(on);
+		if (on)
+			LOCPLINT->statusbar->print(name);
+		else if (LOCPLINT->statusbar->getCurrent()==name)
+			LOCPLINT->statusbar->clear();
+	}
 }
 template <typename T>
 void AdventureMapButton<T>::activate()

+ 25 - 1
CBattleInterface.cpp

@@ -17,6 +17,12 @@ CBattleInterface::CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, i
 	CSDL_Ext::update();
 	
 	bOptions = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bOptionsf, 3, 561, "icm003.def", this, false, NULL, false);
+	bSurrender = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSurrenderf, 54, 561, "icm001.def", this, false, NULL, false);
+	bFlee = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bFleef, 105, 561, "icm002.def", this, false, NULL, false);
+	bAutofight  = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bAutofightf, 157, 561, "icm004.def", this, false, NULL, false);
+	bSpell = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bSpellf, 645, 561, "icm005.def", this, false, NULL, false);
+	bWait = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bWaitf, 696, 561, "icm006.def", this, false, NULL, false);
+	bDefence = new AdventureMapButton<CBattleInterface> (std::string(), std::string(), &CBattleInterface::bDefencef, 747, 561, "icm007.def", this, false, NULL, false);
 	//bOptions->activate();
 }
 
@@ -24,17 +30,35 @@ CBattleInterface::~CBattleInterface()
 {
 	SDL_FreeSurface(background);
 	SDL_FreeSurface(menu);
-	//delete 
+	delete bOptions;
+	delete bSurrender;
+	delete bFlee;
+	delete bAutofight;
+	delete bSpell;
+	delete bWait;
+	delete bDefence;
 }
 
 void CBattleInterface::activate()
 {
 	bOptions->activate();
+	bSurrender->activate();
+	bFlee->activate();
+	bAutofight->activate();
+	bSpell->activate();
+	bWait->activate();
+	bDefence->activate();
 }
 
 void CBattleInterface::deactivate()
 {
 	bOptions->deactivate();
+	bSurrender->deactivate();
+	bFlee->deactivate();
+	bAutofight->deactivate();
+	bSpell->deactivate();
+	bWait->deactivate();
+	bDefence->deactivate();
 }
 
 void CBattleInterface::show(SDL_Surface * to)

+ 2 - 1
CHeroWindow.cpp

@@ -639,8 +639,9 @@ void CHeroWindow::deactivate()
 
 void CHeroWindow::dismissCurrent()
 {
-	LOCPLINT->cb->dismissHero(curHero);
+	const CGHeroInstance * ch = curHero;
 	quit();
+	LOCPLINT->cb->dismissHero(ch);
 }
 
 void CHeroWindow::questlog()