Fix two bugs uncovered by MSVC

master
Piotr Dziwinski 2015-04-27 19:39:22 +02:00
parent 69fe212b0f
commit 4c8127c6ec
3 changed files with 14 additions and 8 deletions

View File

@ -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";

View File

@ -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);

View File

@ -300,11 +300,14 @@ bool CEdit::EventProcess(const Event &event)
}
}
if (event.type == EVENT_KEY_DOWN)
{
bShift = ((event.kmodState & KEY_MOD(SHIFT)) != 0);
bControl = ((event.kmodState & KEY_MOD(CTRL)) != 0);
}
if ( event.type == EVENT_KEY_DOWN && m_bFocus )
{
bShift = ( (event.kmodState & KEY_MOD(SHIFT) ) != 0 );
bControl = ( (event.kmodState & KEY_MOD(CTRL) ) != 0);
if ( (event.key.key == KEY(x) && !bShift && bControl) ||
(event.key.key == KEY(DELETE) && bShift && !bControl) )
{