[colobot] 338/390: Fix two bugs uncovered by MSVC
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:22:02 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 4c8127c6ecbc0e5038a82dc9c270e166fd8017c4
Author: Piotr Dziwinski <piotrdz at gmail.com>
Date: Mon Apr 27 19:39:22 2015 +0200
Fix two bugs uncovered by MSVC
---
src/common/restext.cpp | 11 +++++++----
src/common/restext.h | 2 +-
src/ui/edit.cpp | 9 ++++++---
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 952076f..830b2ac 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -780,7 +780,10 @@ static void PutKeyName(std::string& dst, const char* src)
for(count = 0; src[s+5+count] != ';'; count++);
CInput* input = CInput::GetInstancePointer();
InputSlot key = input->SearchKeyById(std::string(&src[s+5], count));
- dst.append(input->GetKeysString(key));
+ if (key != INPUT_SLOT_MAX)
+ {
+ dst.append(input->GetKeysString(key));
+ }
s = s+5+count+1;
}
@@ -790,7 +793,7 @@ static void PutKeyName(std::string& dst, const char* src)
// Returns the translated text of a resource that needs key substitution
-static const char* GetResourceBase(ResType type, int num)
+static const char* GetResourceBase(ResType type, unsigned int num)
{
const char *str = NULL;
@@ -837,7 +840,7 @@ static const char* GetResourceBase(ResType type, int num)
// Returns the text of a resource.
-bool GetResource(ResType type, int num, std::string& text)
+bool GetResource(ResType type, unsigned int num, std::string& text)
{
if(type != RES_KEY)
{
@@ -854,7 +857,7 @@ bool GetResource(ResType type, int num, std::string& text)
}
else
{
- if (static_cast<unsigned int>(num) == KEY_INVALID)
+ if (num == KEY_INVALID)
text.clear();
else if (num == VIRTUAL_KMOD_CTRL)
text = "Ctrl";
diff --git a/src/common/restext.h b/src/common/restext.h
index 9b3641e..1f689ae 100644
--- a/src/common/restext.h
+++ b/src/common/restext.h
@@ -157,5 +157,5 @@ enum ResTextType
void InitializeRestext();
void SetGlobalGamerName(std::string name);
-bool GetResource(ResType type, int num, std::string& text);
+bool GetResource(ResType type, unsigned int num, std::string& text);
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 8c5853e..ba248ac 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -300,11 +300,14 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.type == EVENT_KEY_DOWN && m_bFocus )
+ if (event.type == EVENT_KEY_DOWN)
{
- bShift = ( (event.kmodState & KEY_MOD(SHIFT) ) != 0 );
- bControl = ( (event.kmodState & KEY_MOD(CTRL) ) != 0);
+ bShift = ((event.kmodState & KEY_MOD(SHIFT)) != 0);
+ bControl = ((event.kmodState & KEY_MOD(CTRL)) != 0);
+ }
+ if ( event.type == EVENT_KEY_DOWN && m_bFocus )
+ {
if ( (event.key.key == KEY(x) && !bShift && bControl) ||
(event.key.key == KEY(DELETE) && bShift && !bControl) )
{
--
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