Explorar el Código

Fixed #522 (probably), #529, #540.
Version to be released as dev build 0.81b

Michał W. Urbańczyk hace 15 años
padre
commit
ff078dc440
Se han modificado 5 ficheros con 33 adiciones y 15 borrados
  1. 1 2
      client/CAdvmapInterface.cpp
  2. 4 0
      client/CMT.cpp
  3. 16 8
      client/CPlayerInterface.cpp
  4. 11 4
      client/GUIClasses.cpp
  5. 1 1
      client/GUIClasses.h

+ 1 - 2
client/CAdvmapInterface.cpp

@@ -1189,7 +1189,7 @@ heroList(ADVOPT.hlistSize),
 townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
 {
 	spellBeingCasted = NULL;
-	player = 0;
+	player = 1;
 	pos.x = pos.y = 0;
 	pos.w = screen->w;
 	pos.h = screen->h;
@@ -1733,7 +1733,6 @@ bool CAdvMapInt::isActive()
 
 void CAdvMapInt::startHotSeatWait(int Player)
 {
-	setPlayer(Player);
 	state = WAITING;
 }
 

+ 4 - 0
client/CMT.cpp

@@ -442,6 +442,10 @@ void processCommand(const std::string &message)
 			tlog0 << "\nBonuses from " << typeid(*parent).name() << std::endl << parent->bonuses << std::endl;
 		}
 	}
+	else if(cn == "not dialog")
+	{
+		LOCPLINT->showingDialog->setn(false);
+	}
 	else if(client && client->serv && client->serv->connected) //send to server
 	{
 		PlayerMessage pm(LOCPLINT->playerID,message);

+ 16 - 8
client/CPlayerInterface.cpp

@@ -183,6 +183,9 @@ void CPlayerInterface::yourTurn()
 			autosaveCount %= 5;
 		}
 
+		if(adventureInt->player != playerID)
+			adventureInt->setPlayer(playerID);
+
 		if(howManyPeople > 1) //hot seat message
 		{
 			adventureInt->startHotSeatWait(playerID);
@@ -944,9 +947,8 @@ void CPlayerInterface::heroArtifactSetChanged(const CGHeroInstance*hero)
 		adventureInt->heroWindow->deactivate();
 		adventureInt->heroWindow->setHero(hero);
 		adventureInt->heroWindow->activate();
-		return;
 	}
-	if(CExchangeWindow* cew = dynamic_cast<CExchangeWindow*>(GH.topInt())) //exchange window is open
+	else if(CExchangeWindow* cew = dynamic_cast<CExchangeWindow*>(GH.topInt())) //exchange window is open
 	{
 		cew->deactivate();
 		for(int g=0; g<ARRAY_COUNT(cew->heroInst); ++g)
@@ -970,6 +972,8 @@ void CPlayerInterface::heroArtifactSetChanged(const CGHeroInstance*hero)
 		caw->arts->updateState = false;
 		caw->activate();
 	}
+
+	updateInfo(hero);
 }
 
 void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
@@ -1296,7 +1300,7 @@ void CPlayerInterface::update()
 		return;
 	
 	//if there are any waiting dialogs, show them
-	if(dialogs.size() && !showingDialog->get())
+	if((howManyPeople <= 1 || makingTurn) && dialogs.size() && !showingDialog->get())
 	{
 		showingDialog->set(true);
 		GH.pushInt(dialogs.front());
@@ -1796,11 +1800,15 @@ void CPlayerInterface::gameOver(ui8 player, bool victory )
 		while(showingDialog->get() || dialogs.size()); //wait till all dialogs are displayed and closed
 		makingTurn = false;
 
- 		//return to main menu
- 		SDL_Event event;
- 		event.type = SDL_USEREVENT;
- 		event.user.code = 2;
- 		SDL_PushEvent(&event);
+		howManyPeople--;
+		if(!howManyPeople) //all human players eliminated
+		{
+ 			//return to main menu
+			SDL_Event event;
+			event.type = SDL_USEREVENT;
+			event.user.code = 2;
+			SDL_PushEvent(&event);
+		}
 	}
 	else
 	{

+ 11 - 4
client/GUIClasses.cpp

@@ -686,11 +686,11 @@ void CInfoWindow::showYesNoDialog(const std::string & text, const std::vector<SC
 	GH.pushInt(temp);
 }
 
-CInfoWindow * CInfoWindow::create(const std::string &text, int playerID /*= 1*/, const std::vector<SComponent*> *components /*= NULL*/)
+CInfoWindow * CInfoWindow::create(const std::string &text, int playerID /*= 1*/, const std::vector<SComponent*> *components /*= NULL*/, bool DelComps)
 {
 	std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
 	pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
-	CInfoWindow * ret = new CInfoWindow(text, playerID, 0, components ? *components : std::vector<SComponent*>(), pom, false);
+	CInfoWindow * ret = new CInfoWindow(text, playerID, 0, components ? *components : std::vector<SComponent*>(), pom, DelComps);
 	return ret;
 }
 
@@ -2366,6 +2366,7 @@ void CCreInfoWindow::init(const CCreature *cre, const CStackInstance *stack, int
 }
 
 CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount)
+	: type(Type), dismiss(0), upgrade(0), ok(0)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
 	const CCreature *cre = CGI->creh->creatures[Cid];
@@ -6387,8 +6388,14 @@ void MoraleLuckBox::set(const CBonusSystemNode *hero)
 
 	int mrlt = -9;
 	TModDescr mrl;
-	hero->getModifiersWDescr(mrl, bonusType[morale]);
-	bonusValue = (hero->*getValue[morale])();
+	if(hero)
+	{
+		hero->getModifiersWDescr(mrl, bonusType[morale]);
+		bonusValue = (hero->*getValue[morale])();
+	}
+	else
+		bonusValue = 0;
+
 	mrlt = (bonusValue>0)-(bonusValue<0); //signum: -1 - bad luck / morale, 0 - neutral, 1 - good
 	hoverText = CGI->generaltexth->heroscrn[hoverTextBase[morale] - mrlt];
 	baseType = componentType[morale];

+ 1 - 1
client/GUIClasses.h

@@ -92,7 +92,7 @@ public:
 	~CInfoWindow(); //d-tor
 
 	static void showYesNoDialog( const std::string & text, const std::vector<SComponent*> *components, const CFunctionList<void( ) > &onYes, const CFunctionList<void()> &onNo, bool DelComps = true, int player = 1); //use only before the game starts! (showYesNoDialog in LOCPLINT must be used then)
-	static CInfoWindow *create(const std::string &text, int playerID = 1, const std::vector<SComponent*> *components = NULL);
+	static CInfoWindow *create(const std::string &text, int playerID = 1, const std::vector<SComponent*> *components = NULL, bool DelComps = false);
 };
 class CSelWindow : public CInfoWindow //component selection window
 { //warning - this window deletes its components by closing!