mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fixed crash on opening thieves guild window when player has no heroes.
Fixed #384, #385, maybe #381
This commit is contained in:
		| @@ -169,6 +169,7 @@ void CPlayerInterface::yourTurn() | ||||
|  | ||||
| 		LOCPLINT = this; | ||||
| 		GH.curInt = this; | ||||
| 		adventureInt->selection = NULL; | ||||
|  | ||||
| 		if(firstCall) | ||||
| 		{ | ||||
| @@ -1060,8 +1061,11 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CGPath path ) | ||||
|  | ||||
| 		int3 endpos(path.nodes[i-1].coord.x, path.nodes[i-1].coord.y, h->pos.z); | ||||
| 		cb->moveHero(h,endpos); | ||||
|  | ||||
| 		eventsM.unlock(); | ||||
| 		while(stillMoveHero.data != STOP_MOVE  &&  stillMoveHero.data != CONTINUE_MOVE) | ||||
| 			stillMoveHero.cond.wait(un); | ||||
| 		eventsM.lock(); | ||||
| 	} | ||||
|  | ||||
| 	CGI->soundh->stopSound(sh); | ||||
|   | ||||
| @@ -123,17 +123,15 @@ void CGuiHandler::handleEvents() | ||||
| 	while(true) | ||||
| 	{ | ||||
| 		SDL_Event *ev = NULL; | ||||
| 		boost::unique_lock<boost::mutex> lock(eventsM); | ||||
| 		if(!events.size()) | ||||
| 		{ | ||||
| 			boost::unique_lock<boost::mutex> lock(eventsM); | ||||
| 			if(!events.size()) | ||||
| 			{ | ||||
| 				return; | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				ev = events.front(); | ||||
| 				events.pop(); | ||||
| 			} | ||||
| 			return; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			ev = events.front(); | ||||
| 			events.pop(); | ||||
| 		} | ||||
| 		handleEvent(ev); | ||||
| 		delete ev; | ||||
|   | ||||
| @@ -5010,7 +5010,8 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner) | ||||
| 	int counter = 0; | ||||
| 	for(std::map<ui8, InfoAboutHero>::const_iterator it = tgi.colorToBestHero.begin(); it !=  tgi.colorToBestHero.end(); ++it) | ||||
| 	{ | ||||
| 		blitAt(graphics->portraitSmall[it->second.portrait], 260 + 66 * counter, 360, background); | ||||
| 		if(it->second.portrait >= 0) | ||||
| 			blitAt(graphics->portraitSmall[it->second.portrait], 260 + 66 * counter, 360, background); | ||||
| 		counter++; | ||||
|  | ||||
| 		//printing stats | ||||
| @@ -5031,7 +5032,8 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner) | ||||
| 	counter = 0; | ||||
| 	for(std::map<ui8, si32>::const_iterator it = tgi.bestCreature.begin(); it !=  tgi.bestCreature.end(); ++it) | ||||
| 	{ | ||||
| 		blitAt(graphics->bigImgs[it->second], 255 + 66 * counter, 479, background); | ||||
| 		if(it->second >= 0) | ||||
| 			blitAt(graphics->bigImgs[it->second], 255 + 66 * counter, 479, background); | ||||
| 		counter++; | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user