[colobot] 114/390: Change userlevels button text via text file

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 78d7cc9eefaa5e9e5071094c5a04aaa197aeabda
Author: krzys-h <krzys_h at interia.pl>
Date:   Sat Oct 25 12:21:13 2014 +0200

    Change userlevels button text via text file
---
 src/ui/maindialog.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list