mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
codereview
This commit is contained in:
parent
ca96749c45
commit
6f8b62d77d
@ -1690,7 +1690,7 @@ void CPlayerInterface::requestReturningToMainMenu(bool won)
|
|||||||
param.difficulty = cb->getStartInfo()->difficulty;
|
param.difficulty = cb->getStartInfo()->difficulty;
|
||||||
param.day = cb->getDate();
|
param.day = cb->getDate();
|
||||||
param.townAmount = cb->howManyTowns();
|
param.townAmount = cb->howManyTowns();
|
||||||
param.usedCheat = cb->getPlayerState(*cb->getPlayerID())->enteredWinningCheatCode;
|
param.usedCheat = cb->getPlayerState(*cb->getPlayerID())->cheated;
|
||||||
param.hasGrail = false;
|
param.hasGrail = false;
|
||||||
for(const CGHeroInstance * h : cb->getHeroesInfo())
|
for(const CGHeroInstance * h : cb->getHeroesInfo())
|
||||||
if(h->hasArt(ArtifactID::GRAIL))
|
if(h->hasArt(ArtifactID::GRAIL))
|
||||||
@ -1698,27 +1698,27 @@ void CPlayerInterface::requestReturningToMainMenu(bool won)
|
|||||||
param.allDefeated = true;
|
param.allDefeated = true;
|
||||||
for (PlayerColor player(0); player < PlayerColor::PLAYER_LIMIT; ++player)
|
for (PlayerColor player(0); player < PlayerColor::PLAYER_LIMIT; ++player)
|
||||||
{
|
{
|
||||||
auto ps = cb->getPlayerState(player);
|
auto ps = cb->getPlayerState(player, false);
|
||||||
if(ps && player != *cb->getPlayerID())
|
if(ps && player != *cb->getPlayerID())
|
||||||
if(!ps->checkVanquished())
|
if(!ps->checkVanquished())
|
||||||
param.allDefeated = false;
|
param.allDefeated = false;
|
||||||
}
|
}
|
||||||
param.land = cb->getMapHeader()->name;
|
param.land = cb->getMapHeader()->name;
|
||||||
HighScoreCalculation calc;
|
HighScoreCalculation highScoreCalc;
|
||||||
calc.parameters.push_back(param);
|
highScoreCalc.parameters.push_back(param);
|
||||||
calc.isCampaign = false;
|
highScoreCalc.isCampaign = false;
|
||||||
|
|
||||||
if(won && cb->getStartInfo()->campState)
|
if(won && cb->getStartInfo()->campState)
|
||||||
CSH->startCampaignScenario(param, cb->getStartInfo()->campState);
|
CSH->startCampaignScenario(param, cb->getStartInfo()->campState);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GH.dispatchMainThread(
|
GH.dispatchMainThread(
|
||||||
[won, calc]()
|
[won, highScoreCalc]()
|
||||||
{
|
{
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
GH.defActionsDef = 63;
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
GH.windows().createAndPushWindow<CHighScoreInputScreen>(won, calc);
|
GH.windows().createAndPushWindow<CHighScoreInputScreen>(won, highScoreCalc);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ void CServerHandler::startGameplay(VCMI_LIB_WRAP_NAMESPACE(CGameState) * gameSta
|
|||||||
CMM->disable();
|
CMM->disable();
|
||||||
client = new CClient();
|
client = new CClient();
|
||||||
|
|
||||||
calc = nullptr;
|
highScoreCalc = nullptr;
|
||||||
|
|
||||||
switch(si->mode)
|
switch(si->mode)
|
||||||
{
|
{
|
||||||
@ -678,14 +678,14 @@ void CServerHandler::startCampaignScenario(HighScoreParameter param, std::shared
|
|||||||
if (!cs)
|
if (!cs)
|
||||||
ourCampaign = si->campState;
|
ourCampaign = si->campState;
|
||||||
|
|
||||||
if(calc == nullptr)
|
if(highScoreCalc == nullptr)
|
||||||
{
|
{
|
||||||
calc = std::make_shared<HighScoreCalculation>();
|
highScoreCalc = std::make_shared<HighScoreCalculation>();
|
||||||
calc->isCampaign = true;
|
highScoreCalc->isCampaign = true;
|
||||||
calc->parameters.clear();
|
highScoreCalc->parameters.clear();
|
||||||
}
|
}
|
||||||
param.campaign = cs->getName();
|
param.campaign = cs->getName();
|
||||||
calc->parameters.push_back(param);
|
highScoreCalc->parameters.push_back(param);
|
||||||
|
|
||||||
GH.dispatchMainThread([ourCampaign, this]()
|
GH.dispatchMainThread([ourCampaign, this]()
|
||||||
{
|
{
|
||||||
@ -709,7 +709,7 @@ void CServerHandler::startCampaignScenario(HighScoreParameter param, std::shared
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMM->openCampaignScreen(ourCampaign->campaignSet);
|
CMM->openCampaignScreen(ourCampaign->campaignSet);
|
||||||
GH.windows().createAndPushWindow<CHighScoreInputScreen>(true, *calc);
|
GH.windows().createAndPushWindow<CHighScoreInputScreen>(true, *highScoreCalc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(epilogue.hasPrologEpilog)
|
if(epilogue.hasPrologEpilog)
|
||||||
|
@ -89,7 +89,7 @@ class CServerHandler : public IServerAPI, public LobbyInfo
|
|||||||
|
|
||||||
std::vector<std::string> myNames;
|
std::vector<std::string> myNames;
|
||||||
|
|
||||||
std::shared_ptr<HighScoreCalculation> calc;
|
std::shared_ptr<HighScoreCalculation> highScoreCalc;
|
||||||
|
|
||||||
void threadHandleConnection();
|
void threadHandleConnection();
|
||||||
void threadRunServer();
|
void threadRunServer();
|
||||||
|
@ -349,7 +349,7 @@ void CVideoPlayer::redraw( int x, int y, SDL_Surface *dst, bool update )
|
|||||||
show(x, y, dst, update);
|
show(x, y, dst, update);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, bool update, std::function<void()> restart)
|
void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, bool update, std::function<void()> onVideoRestart)
|
||||||
{
|
{
|
||||||
if (sws == nullptr)
|
if (sws == nullptr)
|
||||||
return;
|
return;
|
||||||
@ -368,8 +368,8 @@ void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, boo
|
|||||||
show(x,y,dst,update);
|
show(x,y,dst,update);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(restart)
|
if(onVideoRestart)
|
||||||
restart();
|
onVideoRestart();
|
||||||
VideoPath filenameToReopen = fname; // create copy to backup this->fname
|
VideoPath filenameToReopen = fname; // create copy to backup this->fname
|
||||||
open(filenameToReopen);
|
open(filenameToReopen);
|
||||||
nextFrame();
|
nextFrame();
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
void show(int x, int y, SDL_Surface *dst, bool update = true) override; //blit current frame
|
void show(int x, int y, SDL_Surface *dst, bool update = true) override; //blit current frame
|
||||||
void redraw(int x, int y, SDL_Surface *dst, bool update = true) override; //reblits buffer
|
void redraw(int x, int y, SDL_Surface *dst, bool update = true) override; //reblits buffer
|
||||||
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = 0) override; //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> onVideoRestart = nullptr) override; //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
||||||
|
|
||||||
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
||||||
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false) override;
|
bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false) override;
|
||||||
|
@ -122,8 +122,8 @@ void CHighScoreScreen::addButtons()
|
|||||||
|
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
|
|
||||||
buttons.push_back(std::make_shared<CButton>(Point(31, 113), AnimationPath::builtin("HISCCAM.DEF"), CButton::tooltip(), [&](){ buttonCampaginClick(); }));
|
buttons.push_back(std::make_shared<CButton>(Point(31, 113), AnimationPath::builtin("HISCCAM.DEF"), CButton::tooltip(), [&](){ buttonCampaignClick(); }));
|
||||||
buttons.push_back(std::make_shared<CButton>(Point(31, 345), AnimationPath::builtin("HISCSTA.DEF"), CButton::tooltip(), [&](){ buttonStandardClick(); }));
|
buttons.push_back(std::make_shared<CButton>(Point(31, 345), AnimationPath::builtin("HISCSTA.DEF"), CButton::tooltip(), [&](){ buttonScenarioClick(); }));
|
||||||
buttons.push_back(std::make_shared<CButton>(Point(726, 113), AnimationPath::builtin("HISCRES.DEF"), CButton::tooltip(), [&](){ buttonResetClick(); }));
|
buttons.push_back(std::make_shared<CButton>(Point(726, 113), AnimationPath::builtin("HISCRES.DEF"), CButton::tooltip(), [&](){ buttonResetClick(); }));
|
||||||
buttons.push_back(std::make_shared<CButton>(Point(726, 345), AnimationPath::builtin("HISCEXT.DEF"), CButton::tooltip(), [&](){ buttonExitClick(); }));
|
buttons.push_back(std::make_shared<CButton>(Point(726, 345), AnimationPath::builtin("HISCEXT.DEF"), CButton::tooltip(), [&](){ buttonExitClick(); }));
|
||||||
}
|
}
|
||||||
@ -138,19 +138,19 @@ void CHighScoreScreen::addHighScores()
|
|||||||
images.clear();
|
images.clear();
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
texts.push_back(std::make_shared<CLabel>(115, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.433")));
|
texts.push_back(std::make_shared<CLabel>(115, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.433"))); // rank
|
||||||
texts.push_back(std::make_shared<CLabel>(225, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.434")));
|
texts.push_back(std::make_shared<CLabel>(225, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.434"))); // player
|
||||||
|
|
||||||
if(highscorepage == HighScorePage::SCENARIO)
|
if(highscorepage == HighScorePage::SCENARIO)
|
||||||
{
|
{
|
||||||
texts.push_back(std::make_shared<CLabel>(405, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.435")));
|
texts.push_back(std::make_shared<CLabel>(405, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.435"))); // land
|
||||||
texts.push_back(std::make_shared<CLabel>(557, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.436")));
|
texts.push_back(std::make_shared<CLabel>(557, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.436"))); // days
|
||||||
texts.push_back(std::make_shared<CLabel>(627, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.75")));
|
texts.push_back(std::make_shared<CLabel>(627, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.75"))); // score
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texts.push_back(std::make_shared<CLabel>(405, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.672")));
|
texts.push_back(std::make_shared<CLabel>(405, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.672"))); // campaign
|
||||||
texts.push_back(std::make_shared<CLabel>(592, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.75")));
|
texts.push_back(std::make_shared<CLabel>(592, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.75"))); // score
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
@ -161,7 +161,7 @@ void CHighScoreScreen::addHighScores()
|
|||||||
auto & curData = data[std::to_string(i)];
|
auto & curData = data[std::to_string(i)];
|
||||||
ColorRGBA color = (i == highlighted) ? Colors::YELLOW : Colors::WHITE;
|
ColorRGBA color = (i == highlighted) ? Colors::YELLOW : Colors::WHITE;
|
||||||
|
|
||||||
texts.push_back(std::make_shared<CLabel>(115, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, std::to_string(i+1)));
|
texts.push_back(std::make_shared<CLabel>(115, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, std::to_string(i + 1)));
|
||||||
std::string tmp = curData["player"].String();
|
std::string tmp = curData["player"].String();
|
||||||
TextOperations::trimRightUnicode(tmp, std::max(0, (int)TextOperations::getUnicodeCharactersCount(tmp) - 13));
|
TextOperations::trimRightUnicode(tmp, std::max(0, (int)TextOperations::getUnicodeCharactersCount(tmp) - 13));
|
||||||
texts.push_back(std::make_shared<CLabel>(225, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, tmp));
|
texts.push_back(std::make_shared<CLabel>(225, y + i * 50, FONT_MEDIUM, ETextAlignment::CENTER, color, tmp));
|
||||||
@ -187,7 +187,7 @@ void CHighScoreScreen::addHighScores()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHighScoreScreen::buttonCampaginClick()
|
void CHighScoreScreen::buttonCampaignClick()
|
||||||
{
|
{
|
||||||
highscorepage = HighScorePage::CAMPAIGN;
|
highscorepage = HighScorePage::CAMPAIGN;
|
||||||
addHighScores();
|
addHighScores();
|
||||||
@ -195,7 +195,7 @@ void CHighScoreScreen::buttonCampaginClick()
|
|||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHighScoreScreen::buttonStandardClick()
|
void CHighScoreScreen::buttonScenarioClick()
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
highscorepage = HighScorePage::SCENARIO;
|
highscorepage = HighScorePage::SCENARIO;
|
||||||
@ -241,7 +241,7 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc
|
|||||||
{
|
{
|
||||||
int border = 100;
|
int border = 100;
|
||||||
int textareaW = ((pos.w - 2 * border) / 4);
|
int textareaW = ((pos.w - 2 * border) / 4);
|
||||||
std::vector<std::string> t = { "438", "439", "440", "441", "676" };
|
std::vector<std::string> t = { "438", "439", "440", "441", "676" }; // time, score, difficulty, final score, rank
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
texts.push_back(std::make_shared<CMultiLineLabel>(Rect(textareaW * i + border - (textareaW / 2), 450, textareaW, 100), FONT_HIGH_SCORE, ETextAlignment::TOPCENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt." + t[i])));
|
texts.push_back(std::make_shared<CMultiLineLabel>(Rect(textareaW * i + border - (textareaW / 2), 450, textareaW, 100), FONT_HIGH_SCORE, ETextAlignment::TOPCENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt." + t[i])));
|
||||||
|
|
||||||
@ -264,37 +264,27 @@ int CHighScoreInputScreen::addEntry(std::string text) {
|
|||||||
if(calc.calculate().cheater)
|
if(calc.calculate().cheater)
|
||||||
i = 10;
|
i = 10;
|
||||||
|
|
||||||
JsonNode node = persistentStorage["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)];
|
JsonNode baseNode = persistentStorage["highscore"][calc.isCampaign ? "campaign" : "scenario"];
|
||||||
|
|
||||||
if(node["points"].isNull() || node["points"].Integer() <= calc.calculate().total)
|
if(baseNode[std::to_string(i)]["points"].isNull() || baseNode[std::to_string(i)]["points"].Integer() <= calc.calculate().total)
|
||||||
{
|
{
|
||||||
// move following entries down
|
// move following entries down
|
||||||
for (int j = 10; j + 1 >= i; j--)
|
for (int j = 10; j + 1 >= i; j--)
|
||||||
{
|
{
|
||||||
JsonNode node = persistentStorage["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(j - 1)];
|
JsonNode node = baseNode[std::to_string(j - 1)];
|
||||||
Settings entry = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(j)];
|
Settings entry = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(j)];
|
||||||
entry->Struct() = node.Struct();
|
entry->Struct() = node.Struct();
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings entry = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)]["player"];
|
Settings currentEntry = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)];
|
||||||
entry->String() = text;
|
currentEntry["player"].String() = text;
|
||||||
if(calc.isCampaign)
|
if(calc.isCampaign)
|
||||||
{
|
currentEntry["campaign"].String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].campaign;
|
||||||
Settings entry2 = persistentStorage.write["highscore"]["campaign"][std::to_string(i)]["campaign"];
|
|
||||||
entry2->String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].campaign;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
currentEntry["land"].String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].land;
|
||||||
Settings entry3 = persistentStorage.write["highscore"]["scenario"][std::to_string(i)]["land"];
|
currentEntry["days"].Integer() = calc.calculate().sumDays;
|
||||||
entry3->String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].land;
|
currentEntry["points"].Integer() = calc.calculate().cheater ? 0 : calc.calculate().total;
|
||||||
}
|
currentEntry["datetime"].String() = vstd::getFormattedDateTime(std::time(0));
|
||||||
Settings entry4 = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)]["days"];
|
|
||||||
entry4->Integer() = calc.calculate().sumDays;
|
|
||||||
Settings entry5 = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)]["points"];
|
|
||||||
entry5->Integer() = calc.calculate().cheater ? 0 : calc.calculate().total;
|
|
||||||
|
|
||||||
Settings entry6 = persistentStorage.write["highscore"][calc.isCampaign ? "campaign" : "scenario"][std::to_string(i)]["datetime"];
|
|
||||||
entry6->String() = vstd::getFormattedDateTime(std::time(0));
|
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -373,14 +363,13 @@ void CHighScoreInputScreen::keyPressed(EShortcut key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHighScoreInput::CHighScoreInput(std::function<void(std::string text)> readyCB)
|
CHighScoreInput::CHighScoreInput(std::function<void(std::string text)> readyCB)
|
||||||
: CWindowObject(0), ready(readyCB)
|
: CWindowObject(0, ImagePath::builtin("HIGHNAME")), ready(readyCB)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
|
|
||||||
pos = center(Rect(0, 0, 232, 212));
|
pos = center(Rect(0, 0, 232, 212));
|
||||||
updateShadow();
|
updateShadow();
|
||||||
|
|
||||||
background = std::make_shared<CPicture>(ImagePath::builtin("HIGHNAME"));
|
|
||||||
text = std::make_shared<CMultiLineLabel>(Rect(15, 15, 202, 202), FONT_SMALL, ETextAlignment::TOPCENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.96"));
|
text = std::make_shared<CMultiLineLabel>(Rect(15, 15, 202, 202), FONT_SMALL, ETextAlignment::TOPCENTER, Colors::WHITE, CGI->generaltexth->translate("core.genrltxt.96"));
|
||||||
|
|
||||||
buttonOk = std::make_shared<CButton>(Point(26, 142), AnimationPath::builtin("MUBCHCK.DEF"), CGI->generaltexth->zelp[560], std::bind(&CHighScoreInput::okay, this), EShortcut::GLOBAL_ACCEPT);
|
buttonOk = std::make_shared<CButton>(Point(26, 142), AnimationPath::builtin("MUBCHCK.DEF"), CGI->generaltexth->zelp[560], std::bind(&CHighScoreInput::okay, this), EShortcut::GLOBAL_ACCEPT);
|
||||||
|
@ -50,8 +50,8 @@ private:
|
|||||||
void addButtons();
|
void addButtons();
|
||||||
void addHighScores();
|
void addHighScores();
|
||||||
|
|
||||||
void buttonCampaginClick();
|
void buttonCampaignClick();
|
||||||
void buttonStandardClick();
|
void buttonScenarioClick();
|
||||||
void buttonResetClick();
|
void buttonResetClick();
|
||||||
void buttonExitClick();
|
void buttonExitClick();
|
||||||
|
|
||||||
@ -71,7 +71,6 @@ public:
|
|||||||
|
|
||||||
class CHighScoreInput : public CWindowObject
|
class CHighScoreInput : public CWindowObject
|
||||||
{
|
{
|
||||||
std::shared_ptr<CPicture> background;
|
|
||||||
std::shared_ptr<CMultiLineLabel> text;
|
std::shared_ptr<CMultiLineLabel> text;
|
||||||
std::shared_ptr<CButton> buttonOk;
|
std::shared_ptr<CButton> buttonOk;
|
||||||
std::shared_ptr<CButton> buttonCancel;
|
std::shared_ptr<CButton> buttonCancel;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
PlayerState::PlayerState()
|
PlayerState::PlayerState()
|
||||||
: color(-1), human(false), enteredWinningCheatCode(false),
|
: color(-1), human(false), cheated(false), enteredWinningCheatCode(false),
|
||||||
enteredLosingCheatCode(false), status(EPlayerStatus::INGAME)
|
enteredLosingCheatCode(false), status(EPlayerStatus::INGAME)
|
||||||
{
|
{
|
||||||
setNodeType(PLAYER);
|
setNodeType(PLAYER);
|
||||||
@ -29,6 +29,7 @@ PlayerState::PlayerState(PlayerState && other) noexcept:
|
|||||||
human(other.human),
|
human(other.human),
|
||||||
team(other.team),
|
team(other.team),
|
||||||
resources(other.resources),
|
resources(other.resources),
|
||||||
|
cheated(other.cheated),
|
||||||
enteredWinningCheatCode(other.enteredWinningCheatCode),
|
enteredWinningCheatCode(other.enteredWinningCheatCode),
|
||||||
enteredLosingCheatCode(other.enteredLosingCheatCode),
|
enteredLosingCheatCode(other.enteredLosingCheatCode),
|
||||||
status(other.status),
|
status(other.status),
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
|
std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
|
||||||
std::vector<QuestInfo> quests; //store info about all received quests
|
std::vector<QuestInfo> quests; //store info about all received quests
|
||||||
|
|
||||||
|
bool cheated;
|
||||||
bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
|
bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
|
||||||
EPlayerStatus status;
|
EPlayerStatus status;
|
||||||
std::optional<ui8> daysWithoutCastle;
|
std::optional<ui8> daysWithoutCastle;
|
||||||
@ -82,6 +83,7 @@ public:
|
|||||||
h & visitedObjects;
|
h & visitedObjects;
|
||||||
h & status;
|
h & status;
|
||||||
h & daysWithoutCastle;
|
h & daysWithoutCastle;
|
||||||
|
h & cheated;
|
||||||
h & enteredLosingCheatCode;
|
h & enteredLosingCheatCode;
|
||||||
h & enteredWinningCheatCode;
|
h & enteredWinningCheatCode;
|
||||||
h & static_cast<CBonusSystemNode&>(*this);
|
h & static_cast<CBonusSystemNode&>(*this);
|
||||||
|
@ -2509,6 +2509,7 @@ void PlayerCheated::applyGs(CGameState * gs) const
|
|||||||
|
|
||||||
gs->getPlayerState(player)->enteredLosingCheatCode = losingCheatCode;
|
gs->getPlayerState(player)->enteredLosingCheatCode = losingCheatCode;
|
||||||
gs->getPlayerState(player)->enteredWinningCheatCode = winningCheatCode;
|
gs->getPlayerState(player)->enteredWinningCheatCode = winningCheatCode;
|
||||||
|
gs->getPlayerState(player)->cheated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerStartsTurn::applyGs(CGameState * gs) const
|
void PlayerStartsTurn::applyGs(CGameState * gs) const
|
||||||
|
Loading…
Reference in New Issue
Block a user