mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-11 11:31:52 +02:00
fix playername
This commit is contained in:
parent
02c82cb35b
commit
242e0ffa4a
@ -1707,6 +1707,7 @@ void CPlayerInterface::requestReturningToMainMenu(bool won)
|
||||
param.allDefeated = false;
|
||||
}
|
||||
param.scenarioName = cb->getMapHeader()->name;
|
||||
param.playerName = cb->getStartInfo()->playerInfos.find(*cb->getPlayerID())->second.name;
|
||||
HighScoreCalculation highScoreCalc;
|
||||
highScoreCalc.parameters.push_back(param);
|
||||
highScoreCalc.isCampaign = false;
|
||||
|
@ -335,7 +335,7 @@ void CHighScoreInputScreen::clickPressed(const Point & cursorPosition)
|
||||
|
||||
if(!input)
|
||||
{
|
||||
input = std::make_shared<CHighScoreInput>(
|
||||
input = std::make_shared<CHighScoreInput>(calc.parameters[0].playerName,
|
||||
[&] (std::string text)
|
||||
{
|
||||
if(!text.empty())
|
||||
@ -355,7 +355,7 @@ void CHighScoreInputScreen::keyPressed(EShortcut key)
|
||||
clickPressed(Point());
|
||||
}
|
||||
|
||||
CHighScoreInput::CHighScoreInput(std::function<void(std::string text)> readyCB)
|
||||
CHighScoreInput::CHighScoreInput(std::string playerName, std::function<void(std::string text)> readyCB)
|
||||
: CWindowObject(0, ImagePath::builtin("HIGHNAME")), ready(readyCB)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
@ -369,7 +369,7 @@ CHighScoreInput::CHighScoreInput(std::function<void(std::string text)> readyCB)
|
||||
buttonCancel = std::make_shared<CButton>(Point(142, 142), AnimationPath::builtin("MUBCANC.DEF"), CGI->generaltexth->zelp[561], std::bind(&CHighScoreInput::abort, this), EShortcut::GLOBAL_CANCEL);
|
||||
statusBar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(7, 186, 218, 18), 7, 186));
|
||||
textInput = std::make_shared<CTextInput>(Rect(18, 104, 200, 25), FONT_SMALL, 0);
|
||||
textInput->setText(settings["general"]["playerName"].String());
|
||||
textInput->setText(playerName);
|
||||
}
|
||||
|
||||
void CHighScoreInput::okay()
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
bool allDefeated;
|
||||
std::string campaignName;
|
||||
std::string scenarioName;
|
||||
std::string playerName;
|
||||
};
|
||||
|
||||
class HighScoreCalculation
|
||||
@ -84,7 +85,7 @@ class CHighScoreInput : public CWindowObject
|
||||
void okay();
|
||||
void abort();
|
||||
public:
|
||||
CHighScoreInput(std::function<void(std::string text)> readyCB);
|
||||
CHighScoreInput(std::string playerName, std::function<void(std::string text)> readyCB);
|
||||
};
|
||||
|
||||
class CHighScoreInputScreen : public CWindowObject
|
||||
|
Loading…
x
Reference in New Issue
Block a user