From 920e716048f3cdd8e1135a0b0ac064d5f02d9542 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Thu, 18 May 2017 14:39:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DInitStringEngine()=E4=B8=AD?= =?UTF-8?q?=E7=9A=84Bug=EF=BC=8C=E5=8E=BB=E9=99=A4=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BattleGame/Game.cpp | 10 ++-------- BattleGame/MapEditor.cpp | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/BattleGame/Game.cpp b/BattleGame/Game.cpp index 0c4dc7e..e3e0c98 100644 --- a/BattleGame/Game.cpp +++ b/BattleGame/Game.cpp @@ -24,6 +24,8 @@ void InitStringEngine() while (fscanf(fp, "%s%*c", tagbuff) == 1) { fgets(content, 1024, fp); + int sz = strlen(content); + if (content[sz - 1] == '\n') content[sz - 1] = 0; strvec.push_back(make_pair(tagbuff, content)); } fclose(fp); @@ -60,14 +62,6 @@ void GameMain() InitUnitData(); global.frame->run(new MapEditorScene); - - xml_document<> doc; - xml_node<>* rootnode = doc.allocate_node(node_type::node_element, "en_US"); - doc.append_node(rootnode); - rootnode->append_node(doc.allocate_node(node_type::node_element, "Fuck", "Fuck XML")); - std::string s; - print(std::back_inserter(s), doc); - printf("%s\n", s.c_str()); } diff --git a/BattleGame/MapEditor.cpp b/BattleGame/MapEditor.cpp index c3980de..71aa933 100644 --- a/BattleGame/MapEditor.cpp +++ b/BattleGame/MapEditor.cpp @@ -58,7 +58,7 @@ void MapEditorMapSizeConfigureScene::start(void* ptr) shared_ptr pReturnButton(new MapEditorMapSizeConfigureSceneReturnButton); pReturnButton->text = text_a2; - pReturnButton->pos = Rect(winSize.w / 2 - text_a1.getw()/2, winSize.h / 2 + 20, text_a1.getw(), 20); + pReturnButton->pos = Rect(winSize.w / 2 - text_a2.getw()/2, winSize.h / 2 + 20, text_a2.getw(), 20); btna.addButton(pReturnButton.get()); lp.run();