summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-14 21:52:48 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-14 21:52:48 +0300
commitb6f72a52c7a000f146c5aff3ab8318293cbb1c42 (patch)
treebf876ac815cc99fa9102cc2da965c98ca588e889
parent6db83b4ee1c20162a9dd31428cbc36ce7405352d (diff)
downloadplus-b6f72a52c7a000f146c5aff3ab8318293cbb1c42.tar.gz
plus-b6f72a52c7a000f146c5aff3ab8318293cbb1c42.tar.bz2
plus-b6f72a52c7a000f146c5aff3ab8318293cbb1c42.tar.xz
plus-b6f72a52c7a000f146c5aff3ab8318293cbb1c42.zip
Fix crash in setup input page with name gui.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/const/gui/pages.h30
-rw-r--r--src/gui/setupinputpages.cpp6
-rw-r--r--src/gui/widgets/tabs/setup_input.cpp10
5 files changed, 41 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 22d0cbdbc..2dbae4a0d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -939,6 +939,7 @@ SET(SRCS
const/spells.h
const/utils/timer.h
const/gui/chat.h
+ const/gui/pages.h
const/gui/theme.h
const/render/graphics.h
render/graphics.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index a3a47de58..6771e2782 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,6 +100,7 @@ SRC += events/actionevent.h \
gui/buttoninfo.h \
gui/buttontext.h \
const/gui/chat.h \
+ const/gui/pages.h \
gui/chatlog.h \
enums/gui/chatmsgtype.h \
gui/cliprect.h \
diff --git a/src/const/gui/pages.h b/src/const/gui/pages.h
new file mode 100644
index 000000000..bd2efd19c
--- /dev/null
+++ b/src/const/gui/pages.h
@@ -0,0 +1,30 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CONST_GUI_PAGES_H
+#define CONST_GUI_PAGES_H
+
+#include "localconsts.h"
+
+const int SETUP_PAGES = 10;
+
+#endif // CONST_GUI_PAGES_H
diff --git a/src/gui/setupinputpages.cpp b/src/gui/setupinputpages.cpp
index 32efcecdb..dbb05e4d5 100644
--- a/src/gui/setupinputpages.cpp
+++ b/src/gui/setupinputpages.cpp
@@ -21,6 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "const/gui/pages.h"
+
#include "gui/setupinputpages.h"
#include "utils/gettext.h"
@@ -38,7 +40,7 @@
#include "debug.h"
-const char *const pages[] =
+const char *const pages[SETUP_PAGES + 1] =
{
// TRANSLATORS: input tab sub tab name
N_("Basic"),
@@ -63,7 +65,7 @@ const char *const pages[] =
nullptr
};
-SetupActionData *const setupActionData[] =
+SetupActionData *const setupActionData[SETUP_PAGES] =
{
setupActionDataBasic,
setupActionDataMove,
diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp
index 50187cffd..545952e2d 100644
--- a/src/gui/widgets/tabs/setup_input.cpp
+++ b/src/gui/widgets/tabs/setup_input.cpp
@@ -25,6 +25,8 @@
#include "configuration.h"
+#include "const/gui/pages.h"
+
#include "input/inputactionoperators.h"
#include "input/inputmanager.h"
#include "input/keyboardconfig.h"
@@ -55,8 +57,6 @@
#include "debug.h"
-static const int setupGroups = 9;
-
Setup_Input::Setup_Input(const Widget2 *const widget) :
SetupTab(widget),
mKeyListModel(new KeyListModel),
@@ -73,7 +73,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mScrollArea(new ScrollArea(this, mKeyList,
true, "setup_input_background.xml")),
mKeySetting(false),
- mActionDataSize(new int [9])
+ mActionDataSize(new int [SETUP_PAGES])
{
inputManager.setSetupInput(this);
// TRANSLATORS: setting tab name
@@ -81,7 +81,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mKeyListModel->setSelectedData(0);
- for (int f = 0; f < setupGroups; f ++)
+ for (int f = 0; f < SETUP_PAGES; f ++)
{
int cnt = 0;
while (!setupActionData[f][cnt].name.empty())
@@ -320,7 +320,7 @@ int Setup_Input::keyToSetupData(const InputActionT index) const
std::string Setup_Input::keyToString(const InputActionT index) const
{
- for (int f = 0; f < setupGroups; f ++)
+ for (int f = 0; f < SETUP_PAGES; f ++)
{
for (int i = 0; i < mActionDataSize[f]; i++)
{