1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Fixed several spellbook glitches.

This commit is contained in:
Frank Zago
2009-06-20 02:14:25 +00:00
parent 2f39106ff8
commit c3139125b4

View File

@@ -322,19 +322,21 @@ void CSpellWindow::fexitb()
void CSpellWindow::fadvSpellsb() void CSpellWindow::fadvSpellsb()
{ {
if (battleSpellsOnly == true) if (battleSpellsOnly == true) {
turnPageRight(); turnPageRight();
battleSpellsOnly = false; battleSpellsOnly = false;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
void CSpellWindow::fbattleSpellsb() void CSpellWindow::fbattleSpellsb()
{ {
if (battleSpellsOnly == false) if (battleSpellsOnly == false) {
turnPageLeft(); turnPageLeft();
battleSpellsOnly = true; battleSpellsOnly = true;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
@@ -344,46 +346,51 @@ void CSpellWindow::fmanaPtsb()
void CSpellWindow::fspellsAb() void CSpellWindow::fspellsAb()
{ {
if (selectedTab != 0) if (selectedTab != 0) {
turnPageRight(); turnPageRight();
selectedTab = 0; selectedTab = 0;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
void CSpellWindow::fspellsEb() void CSpellWindow::fspellsEb()
{ {
if (selectedTab != 3) if (selectedTab != 3) {
turnPageRight(); turnPageRight();
selectedTab = 3; selectedTab = 3;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
void CSpellWindow::fspellsFb() void CSpellWindow::fspellsFb()
{ {
if (selectedTab != 1) if (selectedTab != 1) {
turnPageRight(); turnPageRight();
selectedTab = 1; selectedTab = 1;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
void CSpellWindow::fspellsWb() void CSpellWindow::fspellsWb()
{ {
if (selectedTab != 2) if (selectedTab != 2) {
turnPageRight(); turnPageRight();
selectedTab = 2; selectedTab = 2;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
void CSpellWindow::fspellsAllb() void CSpellWindow::fspellsAllb()
{ {
if (selectedTab != 4) if (selectedTab != 4) {
turnPageRight(); turnPageRight();
selectedTab = 4; selectedTab = 4;
spellSite = 0; spellSite = 0;
}
computeSpellsPerArea(); computeSpellsPerArea();
} }
@@ -408,7 +415,7 @@ void CSpellWindow::fRcornerb()
void CSpellWindow::show(SDL_Surface *to) void CSpellWindow::show(SDL_Surface *to)
{ {
SDL_BlitSurface(background, NULL, to, &pos); SDL_BlitSurface(background, NULL, to, &pos);
blitAt(spellTab->ourImages[selectedTab].bitmap, 524 + pos.x, 94 + pos.y, to); blitAt(spellTab->ourImages[selectedTab].bitmap, 524 + pos.x, 88 + pos.y, to);
statusBar->show(to); statusBar->show(to);
@@ -423,7 +430,7 @@ void CSpellWindow::show(SDL_Surface *to)
{ {
blitAt(leftCorner, lCorner->pos.x, lCorner->pos.y, to); blitAt(leftCorner, lCorner->pos.x, lCorner->pos.y, to);
} }
if((spellSite+1) != (battleSpellsOnly ? sitesPerTabBattle[selectedTab] : sitesPerTabAdv[selectedTab]) ) if((spellSite+1) < (battleSpellsOnly ? sitesPerTabBattle[selectedTab] : sitesPerTabAdv[selectedTab]) )
{ {
blitAt(rightCorner, rCorner->pos.x, rCorner->pos.y, to); blitAt(rightCorner, rCorner->pos.x, rCorner->pos.y, to);
} }