fix some windows build issues

Fixes #169 by ignoring the activation key.
This commit is contained in:
learn_more 2014-03-09 14:32:45 +01:00
parent db7241d615
commit d1f4250b10
5 changed files with 29 additions and 5 deletions

View File

@ -259,7 +259,7 @@ namespace spades {
float y = firstY;
Vector4 shadowColor = {0, 0, 0, 0.8};
Vector4 shadowColor = {0, 0, 0, 0.8f};
for(it = entries.begin(); it != entries.end(); ++it){
ChatEntry& ent = *it;

View File

@ -956,7 +956,7 @@ namespace spades {
void Client::TextInputEvent(const std::string &ch){
SPADES_MARK_FUNCTION();
if(scriptedUI->NeedsInput()) {
if (scriptedUI->NeedsInput() && !scriptedUI->isIgnored(ch)) {
scriptedUI->TextInputEvent(ch);
return;
}
@ -968,7 +968,7 @@ namespace spades {
int start, int len) {
SPADES_MARK_FUNCTION();
if(scriptedUI->NeedsInput()) {
if (scriptedUI->NeedsInput() && !scriptedUI->isIgnored(ch)) {
scriptedUI->TextEditingEvent(ch, start, len);
return;
}
@ -1021,7 +1021,14 @@ namespace spades {
SPADES_MARK_FUNCTION();
if(scriptedUI->NeedsInput()) {
scriptedUI->KeyEvent(name, down);
if (!scriptedUI->isIgnored(name)) {
scriptedUI->KeyEvent(name, down);
}
else {
if (!down) {
scriptedUI->setIgnored("");
}
}
return;
}
@ -1195,12 +1202,15 @@ namespace spades {
}else if(CheckKey(cg_keyGlobalChat, name) && down){
// global chat
scriptedUI->EnterGlobalChatWindow();
scriptedUI->setIgnored(name);
}else if(CheckKey(cg_keyTeamChat, name) && down){
// team chat
scriptedUI->EnterTeamChatWindow();
scriptedUI->setIgnored(name);
}else if(name == "/" && down){
// command
scriptedUI->EnterCommandWindow();
scriptedUI->setIgnored(name);
}else if(CheckKey(cg_keyCaptureColor, name) && down){
CaptureColor();
}else if(CheckKey(cg_keyChangeMapScale, name) && down){

View File

@ -277,7 +277,15 @@ namespace spades {
c->SetObject(&*ui);
c.ExecuteChecked();
}
bool ClientUI::isIgnored(const std::string& key)
{
return !ignoreInput.empty() && ignoreInput == key;
}
void ClientUI::setIgnored(const std::string& key)
{
ignoreInput = key;
}
}
}

View File

@ -43,6 +43,7 @@ namespace spades {
// weak reference
Client *client;
std::string ignoreInput;
void SendChat(const std::string&, bool isGlobal);
@ -80,6 +81,10 @@ namespace spades {
void EnterTeamChatWindow();
void EnterCommandWindow();
void CloseUI();
//lm: so the chat does not have the initial chat key
bool isIgnored(const std::string& key);
void setIgnored(const std::string& key);
};;
}
}

View File

@ -30,6 +30,7 @@
#include "GameMap.h"
#include <Core/Strings.h>
#include <Core/FileManager.h>
#include <time.h> //windows needs this.
SPADES_SETTING(cg_smp, "");