Quellcode durchsuchen

Merge pull request #245 from vmarkovtsev/develop

Add commander resurrection info window upon entering town
Vadim Markovtsev vor 9 Jahren
Ursprung
Commit
9651676452
1 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen
  1. 12 2
      lib/mapObjects/CGTownInstance.cpp

+ 12 - 2
lib/mapObjects/CGTownInstance.cpp

@@ -562,15 +562,25 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
 	}
 	else if(h->visitablePos() == visitablePos())
 	{
-		if (h->commander && !h->commander->alive) //rise commander. TODO: interactive script
+		bool commander_recover = h->commander && !h->commander->alive;
+		if (commander_recover) // rise commander from dead
 		{
 			SetCommanderProperty scp;
 			scp.heroid = h->id;
 			scp.which = SetCommanderProperty::ALIVE;
 			scp.amount = 1;
-			cb->sendAndApply (&scp);
+			cb->sendAndApply(&scp);
 		}
 		cb->heroVisitCastle(this, h);
+		// TODO(vmarkovtsev): implement payment for rising the commander
+		if (commander_recover) // info window about commander
+		{
+			InfoWindow iw;
+			iw.player = h->tempOwner;
+			iw.text << h->commander->getName();
+			iw.components.push_back(Component(*h->commander));
+			cb->showInfoDialog(&iw);
+		}
 	}
 	else
 	{