1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- spellbook fix (#1110)

- possible fix for kingdom overview (#1109)
- tweaks for recruit window (part of #1113)
This commit is contained in:
Ivan Savenko 2012-09-30 10:35:17 +00:00
parent 7dc3e98c25
commit 07f9cb16c5
7 changed files with 30 additions and 12 deletions

View File

@ -83,12 +83,12 @@ void InfoBox::clickRight(tribool down, bool previousState)
{
if (down)
{
CComponent *comp;
CComponent *comp = nullptr;
std::string text;
data->prepareMessage(text, &comp);
if (comp)
CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp));
else
else if (!text.empty())
adventureInt->handleRightClick(text, down);
}
}
@ -97,14 +97,16 @@ void InfoBox::clickLeft(tribool down, bool previousState)
{
if((!down) && previousState)
{
CComponent *comp;
CComponent *comp = nullptr;
std::string text;
data->prepareMessage(text, &comp);
std::vector<CComponent*> compVector;
if (comp)
{
compVector.push_back(comp);
LOCPLINT->showInfoDialog(text, compVector);
LOCPLINT->showInfoDialog(text, compVector);
}
}
}

View File

@ -202,6 +202,10 @@ private:
int imageID;
ui32 count;
std::string hoverText;
OwnedObjectInfo():
imageID(0),
count(0)
{}
};
std::vector<OwnedObjectInfo> objects;

View File

@ -348,6 +348,11 @@ void CSpellWindow::showAll(SDL_Surface * to)
}
}
void CSpellWindow::show(SDL_Surface * to)
{
statusBar->show(to);
}
class SpellbookSpellSorter
{
public:

View File

@ -109,6 +109,7 @@ public:
void activate();
void deactivate();
void showAll(SDL_Surface * to);
void show(SDL_Surface * to);
void teleportTo(int town, const CGHeroInstance * hero);
};

View File

@ -1377,10 +1377,10 @@ void CRecruitmentWindow::select(CCreatureCard *card)
slider->setAmount(maxAmount);
if(slider->value)
slider->moveTo(0);
if(slider->value != maxAmount)
slider->moveTo(maxAmount);
else // if slider already at 0 - emulate call to sliderMoved()
sliderMoved(0);
sliderMoved(maxAmount);
costPerTroopValue->createItems(card->creature->cost);
totalCostValue->createItems(card->creature->cost);
@ -1533,10 +1533,10 @@ void CRecruitmentWindow::availableCreaturesChanged()
//restore selection
select(cards[selectedIndex]);
if(slider->value)
slider->moveTo(0);
if(slider->value == slider->amount)
slider->moveTo(slider->amount);
else // if slider already at 0 - emulate call to sliderMoved()
sliderMoved(0);
sliderMoved(slider->amount);
}
void CRecruitmentWindow::sliderMoved(int to)
@ -3295,7 +3295,8 @@ void CSystemOptionsWindow::setMapScrollingSpeed( int newSpeed )
}
CSystemOptionsWindow::CSystemOptionsWindow():
CWindowObject(PLAYER_COLORED, "SysOpBck")
CWindowObject(PLAYER_COLORED, "SysOpBck"),
onFullscreenChanged(settings.listen["video"]["fullscreen"])
{
//TODO: translation and\or config file
static const std::string fsLabel = "Fullscreen";
@ -3402,6 +3403,8 @@ CSystemOptionsWindow::CSystemOptionsWindow():
newCreatureWin->select(settings["general"]["classicCreatureWindow"].Bool());
fullscreen->select(settings["video"]["fullscreen"].Bool());
onFullscreenChanged([&](const JsonNode &newState){ fullscreen->select(newState.Bool());});
gameResButton = new CAdventureMapButton("", rsHelp, boost::bind(&CSystemOptionsWindow::selectGameRes, this), 28, 275,"SYSOB12", SDLK_g);
std::string resText;

View File

@ -3,6 +3,7 @@
#include "CAnimation.h"
#include "FunctionList.h"
#include "../lib/ResourceSet.h"
#include "../lib/CConfigHandler.h"
#include "../lib/GameConstants.h"
#include "UIFramework/CIntObject.h"
#include "UIFramework/CIntObjectClasses.h"
@ -731,6 +732,8 @@ private:
CAdventureMapButton *gameResButton;
CLabel *gameResLabel;
SettingsListener onFullscreenChanged;
void setMusicVolume( int newVolume );
void setSoundVolume( int newVolume );
void setHeroMoveSpeed( int newSpeed );

View File

@ -6643,7 +6643,7 @@ void CGShipyard::onHeroVisit( const CGHeroInstance * h ) const
cb->setOwner(id, h->tempOwner);
auto s = state();
if(s == IBoatGenerator::GOOD)
if(s != IBoatGenerator::GOOD)
{
InfoWindow iw;
iw.player = tempOwner;