mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Fix for #1624 :
- recreate adventure map interface on each scenario (to make sure that there is no garbage data from prev. game) - added check to avoid such situations in future
This commit is contained in:
@@ -403,6 +403,7 @@ infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) )
|
||||
pos.x = pos.y = 0;
|
||||
pos.w = screen->w;
|
||||
pos.h = screen->h;
|
||||
position = int3(0,0,0);
|
||||
selection = nullptr;
|
||||
townList.onSelect = boost::bind(&CAdvMapInt::selectionChanged,this);
|
||||
adventureInt=this;
|
||||
@@ -747,6 +748,13 @@ void CAdvMapInt::show(SDL_Surface * to)
|
||||
}
|
||||
if(updateScreen)
|
||||
{
|
||||
int3 betterPos = LOCPLINT->repairScreenPos(position);
|
||||
if (betterPos != position)
|
||||
{
|
||||
logGlobal->warnStream() << "Incorrect position for adventure map!";
|
||||
position = betterPos;
|
||||
}
|
||||
|
||||
terrain.show(to);
|
||||
for(int i=0;i<4;i++)
|
||||
blitAt(gems[i]->ourImages[LOCPLINT->playerID.getNum()].bitmap,ADVOPT.gemX[i],ADVOPT.gemY[i],to);
|
||||
|
@@ -2117,14 +2117,6 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
|
||||
|
||||
--howManyPeople;
|
||||
|
||||
if(cb->getStartInfo()->mode == StartInfo::CAMPAIGN)
|
||||
{
|
||||
// if you lose the campaign go back to the main menu
|
||||
// campaign wins are handled in proposeNextMission
|
||||
if(victoryLossCheckResult.loss()) requestReturningToMainMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(howManyPeople == 0) //all human players eliminated
|
||||
{
|
||||
if(adventureInt)
|
||||
@@ -2136,7 +2128,18 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
|
||||
delete adventureInt;
|
||||
adventureInt = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if(cb->getStartInfo()->mode == StartInfo::CAMPAIGN)
|
||||
{
|
||||
// if you lose the campaign go back to the main menu
|
||||
// campaign wins are handled in proposeNextMission
|
||||
if(victoryLossCheckResult.loss()) requestReturningToMainMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(howManyPeople == 0) //all human players eliminated
|
||||
{
|
||||
requestReturningToMainMenu();
|
||||
}
|
||||
else if(victoryLossCheckResult.victory() && LOCPLINT == this) // end game if current human player has won
|
||||
|
@@ -680,10 +680,12 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std::
|
||||
if (pos.x < 0 || pos.x >= sizes.x ||
|
||||
pos.y < 0 || pos.y >= sizes.y)
|
||||
{
|
||||
// outside of the map - print borders
|
||||
SDL_Rect temp_rect = genRect(sr.h, sr.w, 0, 0);
|
||||
SDL_Surface * src = ttiles[pos.x][pos.y][top_tile.z].terbitmap;
|
||||
assert(src);
|
||||
|
||||
CSDL_Ext::blitSurface(ttiles[pos.x][pos.y][top_tile.z].terbitmap,
|
||||
&temp_rect,extSurf,&sr);
|
||||
CSDL_Ext::blitSurface(src, &temp_rect,extSurf,&sr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user