1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +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) if (down)
{ {
CComponent *comp; CComponent *comp = nullptr;
std::string text; std::string text;
data->prepareMessage(text, &comp); data->prepareMessage(text, &comp);
if (comp) if (comp)
CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp)); CRClickPopup::createAndPush(text, CInfoWindow::TCompsInfo(1, comp));
else else if (!text.empty())
adventureInt->handleRightClick(text, down); adventureInt->handleRightClick(text, down);
} }
} }
@ -97,16 +97,18 @@ void InfoBox::clickLeft(tribool down, bool previousState)
{ {
if((!down) && previousState) if((!down) && previousState)
{ {
CComponent *comp; CComponent *comp = nullptr;
std::string text; std::string text;
data->prepareMessage(text, &comp); data->prepareMessage(text, &comp);
std::vector<CComponent*> compVector; std::vector<CComponent*> compVector;
if (comp) if (comp)
{
compVector.push_back(comp); compVector.push_back(comp);
LOCPLINT->showInfoDialog(text, compVector); LOCPLINT->showInfoDialog(text, compVector);
} }
} }
}
//TODO? //TODO?
/* /*

View File

@ -202,6 +202,10 @@ private:
int imageID; int imageID;
ui32 count; ui32 count;
std::string hoverText; std::string hoverText;
OwnedObjectInfo():
imageID(0),
count(0)
{}
}; };
std::vector<OwnedObjectInfo> objects; 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 class SpellbookSpellSorter
{ {
public: public:

View File

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

View File

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

View File

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

View File

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