Pārlūkot izejas kodu

Prevent flipping empty spellbook

When hero has no travel spells he can no longer flip spell book opened from right panel button
Piotr Wójcik 9 gadi atpakaļ
vecāks
revīzija
ea6545b1d3
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      client/windows/CSpellWindow.cpp

+ 1 - 1
client/windows/CSpellWindow.cpp

@@ -224,7 +224,7 @@ CSpellWindow::CSpellWindow(const SDL_Rect &, const CGHeroInstance * _myHero, CPl
 	currentPage = battleSpellsOnly ? myInt->spellbookSettings.spellbookLastPageBattle : myInt->spellbookSettings.spellbokLastPageAdvmap;
 	currentPage = battleSpellsOnly ? myInt->spellbookSettings.spellbookLastPageBattle : myInt->spellbookSettings.spellbokLastPageAdvmap;
 
 
 	// spellbook last page battle index is not reset after battle, so this needs to stay here
 	// spellbook last page battle index is not reset after battle, so this needs to stay here
-	vstd::abetween(currentPage, 0, pagesWithinCurrentTab() - 1);
+	vstd::abetween(currentPage, 0, std::max(0, pagesWithinCurrentTab() - 1));
 
 
 	computeSpellsPerArea();
 	computeSpellsPerArea();
 	addUsedEvents(KEYBOARD);
 	addUsedEvents(KEYBOARD);