1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Merge remote-tracking branch 'vcmi/develop' into warnings_fix

This commit is contained in:
Ivan Savenko
2022-12-23 14:40:45 +02:00
188 changed files with 9050 additions and 6995 deletions

View File

@@ -31,8 +31,8 @@
#include "../windows/CAdvmapInterface.h"
#include "../windows/GUIClasses.h"
#include "../battle/CBattleInterfaceClasses.h"
#include "../battle/CBattleInterface.h"
#include "../battle/BattleInterfaceClasses.h"
#include "../battle/BattleInterface.h"
#include "../../CCallback.h"
#include "../../lib/StartInfo.h"
@@ -87,7 +87,7 @@ void CList::CListItem::clickLeft(tribool down, bool previousState)
void CList::CListItem::hover(bool on)
{
if (on)
GH.statusbar->setText(getHoverText());
GH.statusbar->write(getHoverText());
else
GH.statusbar->clear();
}
@@ -572,7 +572,7 @@ void CMinimap::clickRight(tribool down, bool previousState)
void CMinimap::hover(bool on)
{
if(on)
GH.statusbar->setText(CGI->generaltexth->zelp[291].first);
GH.statusbar->write(CGI->generaltexth->zelp[291].first);
else
GH.statusbar->clear();
}
@@ -705,7 +705,7 @@ CInfoBar::VisibleDateInfo::VisibleDateInfo()
else
labelText = CGI->generaltexth->allTexts[64] + " " + boost::lexical_cast<std::string>(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK));
label = std::make_shared<CLabel>(95, 31, FONT_MEDIUM, CENTER, Colors::WHITE, labelText);
label = std::make_shared<CLabel>(95, 31, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, labelText);
forceRefresh.push_back(label);
}
@@ -771,8 +771,8 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo()
//generate widgets
background = std::make_shared<CPicture>("ADSTATIN");
allyLabel = std::make_shared<CLabel>(10, 106, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":");
enemyLabel = std::make_shared<CLabel>(10, 136, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":");
allyLabel = std::make_shared<CLabel>(10, 106, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":");
enemyLabel = std::make_shared<CLabel>(10, 136, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":");
int posx = allyLabel->pos.w + allyLabel->pos.x - pos.x + 4;
for(PlayerColor & player : allies)
@@ -794,7 +794,7 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo()
{
hallIcons.push_back(std::make_shared<CAnimImage>("itmtl", i, 0, 6 + 42 * (int)i , 11));
if(halls[i])
hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i])));
hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i])));
}
}
@@ -807,7 +807,7 @@ CInfoBar::VisibleComponentInfo::VisibleComponentInfo(const Component & compToDis
comp = std::make_shared<CComponent>(compToDisplay);
comp->moveTo(Point(pos.x+47, pos.y+50));
text = std::make_shared<CTextBox>(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, CENTER, Colors::WHITE);
text = std::make_shared<CTextBox>(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
}
void CInfoBar::playNewDaySound()
@@ -876,7 +876,7 @@ void CInfoBar::clickRight(tribool down, bool previousState)
void CInfoBar::hover(bool on)
{
if(on)
GH.statusbar->setText(CGI->generaltexth->zelp[292].first);
GH.statusbar->write(CGI->generaltexth->zelp[292].first);
else
GH.statusbar->clear();
}
@@ -1126,65 +1126,52 @@ void CInGameConsole::textEdited(const SDL_TextEditingEvent & event)
void CInGameConsole::startEnteringText()
{
if (!active)
return;
if (captureAllKeys)
return;
assert(GH.statusbar);
assert(currentStatusBar.expired());//effectively, nullptr check
currentStatusBar = GH.statusbar;
captureAllKeys = true;
CSDL_Ext::startTextInput(&GH.statusbar->pos);
enteredText = "_";
if(GH.topInt() == adventureInt)
{
GH.statusbar->alignment = TOPLEFT;
GH.statusbar->setText(enteredText);
//Prevent changes to the text from mouse interaction with the adventure map
GH.statusbar->lock(true);
}
else if(LOCPLINT->battleInt)
{
LOCPLINT->battleInt->console->ingcAlter = enteredText;
}
GH.statusbar->setEnteringMode(true);
GH.statusbar->setEnteredText(enteredText);
}
void CInGameConsole::endEnteringText(bool printEnteredText)
{
captureAllKeys = false;
CSDL_Ext::stopTextInput();
prevEntDisp = -1;
if(printEnteredText)
{
std::string txt = enteredText.substr(0, enteredText.size()-1);
LOCPLINT->cb->sendMessage(txt, LOCPLINT->getSelection());
previouslyEntered.push_back(txt);
//print(txt);
}
enteredText.clear();
if(GH.topInt() == adventureInt)
{
GH.statusbar->alignment = CENTER;
GH.statusbar->lock(false);
GH.statusbar->clear();
}
else if(LOCPLINT->battleInt)
{
LOCPLINT->battleInt->console->ingcAlter = "";
}
auto statusbar = currentStatusBar.lock();
assert(statusbar);
if (statusbar)
statusbar->setEnteringMode(false);
currentStatusBar.reset();
}
void CInGameConsole::refreshEnteredText()
{
if(GH.topInt() == adventureInt)
{
GH.statusbar->lock(false);
GH.statusbar->clear();
GH.statusbar->setText(enteredText);
GH.statusbar->lock(true);
}
else if(LOCPLINT->battleInt)
{
LOCPLINT->battleInt->console->ingcAlter = enteredText;
}
auto statusbar = currentStatusBar.lock();
assert(statusbar);
if (statusbar)
statusbar->setEnteredText(enteredText);
}
CAdvMapPanel::CAdvMapPanel(SDL_Surface * bg, Point position)