1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

correct update

This commit is contained in:
Laserlicht
2025-10-05 03:18:47 +02:00
parent 120213509d
commit 3e2a526140
3 changed files with 17 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ public:
void visitSetAvailableArtifacts(SetAvailableArtifacts & pack) override;
void visitEntitiesChanged(EntitiesChanged & pack) override;
void visitPlayerCheated(PlayerCheated & pack) override;
void visitChangeTownName(ChangeTownName & pack) override;
};
class ApplyFirstClientNetPackVisitor : public VCMI_LIB_WRAP_NAMESPACE(ICPackVisitor)

View File

@@ -1071,3 +1071,16 @@ void ApplyClientNetPackVisitor::visitPlayerCheated(PlayerCheated & pack)
if(pack.colorScheme != ColorScheme::KEEP && vstd::contains(cl.playerint, pack.player))
cl.playerint[pack.player]->setColorScheme(pack.colorScheme);
}
void ApplyClientNetPackVisitor::visitChangeTownName(ChangeTownName & pack)
{
if(!adventureInt)
return;
const CGTownInstance *town = gs.getTown(pack.tid);
if(town)
{
adventureInt->onTownChanged(town);
ENGINE->windows().totalRedraw();
}
}

View File

@@ -1438,6 +1438,9 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
heroes = std::make_shared<HeroSlots>(town, Point(241, 387), Point(241, 483), garr, true);
title = std::make_shared<CTextInputWithConfirm>(Rect(83, 386, 140, 20), FONT_MEDIUM, ETextAlignment::TOPLEFT, town->getNameTranslated(), true, [this](){
std::string name = title->getText();
std::string originalName = LIBRARY->generaltexth->translate(town->getNameTextID());
if(name == originalName)
name = ""; // use textID again
GAME->interface()->cb->setTownName(town, name);
});
income = std::make_shared<CLabel>(195, 443, FONT_SMALL, ETextAlignment::CENTER);