From 78d7cc9eefaa5e9e5071094c5a04aaa197aeabda Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sat, 25 Oct 2014 12:21:13 +0200 Subject: Change userlevels button text via text file --- src/ui/maindialog.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f2fc60e..e46d613 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -322,6 +322,21 @@ void CMainDialog::ChangePhase(Phase phase) ddim.x = 0.09f; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER); pb->SetState(STATE_SHADOW); + + try { + CLevelParser* level = new CLevelParser("levels/custom/config.txt"); + if(level->Exists()) { + level->Load(); + CLevelParserLine* line = level->Get("Button"); + if(line->GetParam("name")->IsDefined()) + pb->SetName(line->GetParam("name")->AsString()); + if(line->GetParam("tooltip")->IsDefined()) + pb->SetTooltip(line->GetParam("tooltip")->AsString()); + } + } + catch(CLevelParserException& e) { + CLogger::GetInstancePointer()->Error("Failed loading userlevel button name: %s\n", e.what()); + } } /*pos.x = 139.0f/640.0f; -- cgit v1.2.3-1-g7c22