Merge branch 'master' of https://github.com/learn-more/openspades into learn-more-master

Conflicts:
	Sources/Client/Client.cpp
This commit is contained in:
yvt 2014-03-09 23:16:20 +09:00
commit a600236b76
6 changed files with 33 additions and 10 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

@ -278,6 +278,14 @@ namespace spades {
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

@ -205,7 +205,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;
}
@ -217,7 +217,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;
}
@ -270,7 +270,13 @@ namespace spades {
SPADES_MARK_FUNCTION();
if(scriptedUI->NeedsInput()) {
if(!scriptedUI->isIgnored(name)) {
scriptedUI->KeyEvent(name, down);
}else{
if(!down) {
scriptedUI->setIgnored("");
}
}
return;
}
@ -435,12 +441,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

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