diff --git a/source/glest_game/game/chat_manager.cpp b/source/glest_game/game/chat_manager.cpp index d3cc63781..3c57fa154 100644 --- a/source/glest_game/game/chat_manager.cpp +++ b/source/glest_game/game/chat_manager.cpp @@ -19,6 +19,7 @@ #include "core_data.h" #include "util.h" #include +#include "string_utils.h" #include "leak_dumper.h" using namespace std; @@ -183,8 +184,13 @@ void ChatManager::keyPress(SDL_KeyboardEvent c) { if(editEnabled && text.size() < maxTextLenght) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c.keysym.sym,c.keysym.sym); //space is the first meaningful code - if(extractKeyPressed(c) >= SDLK_SPACE) { - text += extractKeyPressed(c); + SDLKey key = extractKeyPressed(c); + if(key >= SDLK_SPACE) { + char szCharText[20]=""; + sprintf(szCharText,"%c",key); + char *utfStr = String::ConvertToUTF8(&szCharText[0]); + text += utfStr; + delete [] utfStr; } } } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 8eb90bd51..89afce82e 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -28,9 +28,10 @@ #include #include #include "cache_manager.h" -#include "leak_dumper.h" +#include "string_utils.h" #include "map_preview.h" +#include "leak_dumper.h" namespace Glest{ namespace Game{ @@ -2142,7 +2143,13 @@ void MenuStateConnectedGame::keyPress(SDL_KeyboardEvent c) { // (c=='-') || (c=='(') || (c==')')) { if(activeInputLabel->getText().size() < maxTextSize) { string text= activeInputLabel->getText(); - text.insert(text.end() -1, key); + + char szCharText[20]=""; + sprintf(szCharText,"%c",key); + char *utfStr = String::ConvertToUTF8(&szCharText[0]); + text.insert(text.end() -1, utfStr[0]); + delete [] utfStr; + activeInputLabel->setText(text); switchSetupRequestFlagType |= ssrft_NetworkPlayerName; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index cfe1aed5d..2e585e264 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -30,6 +30,7 @@ #include "cache_manager.h" #include #include "map_preview.h" +#include "string_utils.h" #include "leak_dumper.h" namespace Glest{ namespace Game{ @@ -2953,7 +2954,13 @@ void MenuStateCustomGame::keyPress(SDL_KeyboardEvent c) { // (c=='-') || (c=='(') || (c==')')) { if(activeInputLabel->getText().size() < maxTextSize) { string text= activeInputLabel->getText(); - text.insert(text.end()-1, key); + //text.insert(text.end()-1, key); + char szCharText[20]=""; + sprintf(szCharText,"%c",key); + char *utfStr = String::ConvertToUTF8(&szCharText[0]); + text.insert(text.end() -1, utfStr[0]); + delete [] utfStr; + activeInputLabel->setText(text); MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); diff --git a/source/glest_game/menu/menu_state_join_game.cpp b/source/glest_game/menu/menu_state_join_game.cpp index 03c895d84..7bfb4951b 100644 --- a/source/glest_game/menu/menu_state_join_game.cpp +++ b/source/glest_game/menu/menu_state_join_game.cpp @@ -23,6 +23,7 @@ #include "client_interface.h" #include "conversion.h" #include "game.h" +#include "string_utils.h" #include "socket.h" #include "leak_dumper.h" @@ -520,7 +521,13 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) { if(key >= SDLK_0 && key <= SDLK_9) { if(labelServerIp.getText().size() < maxTextSize) { string text= labelServerIp.getText(); - text.insert(text.end()-1, key); + //text.insert(text.end()-1, key); + char szCharText[20]=""; + sprintf(szCharText,"%c",key); + char *utfStr = String::ConvertToUTF8(&szCharText[0]); + text.insert(text.end() -1, utfStr[0]); + delete [] utfStr; + labelServerIp.setText(text); } } diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index 8660ed586..dceeeed07 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -19,7 +19,7 @@ #include "util.h" #include "menu_state_graphic_info.h" #include "menu_state_keysetup.h" - +#include "string_utils.h" #include "leak_dumper.h" using namespace Shared::Util; @@ -708,7 +708,13 @@ void MenuStateOptions::keyPress(SDL_KeyboardEvent c) { //(c=='-')||(c=='(')||(c==')')){ if(activeInputLabel->getText().size()getText(); - text.insert(text.end()-1, key); + //text.insert(text.end()-1, key); + char szCharText[20]=""; + sprintf(szCharText,"%c",key); + char *utfStr = String::ConvertToUTF8(&szCharText[0]); + text.insert(text.end() -1, utfStr[0]); + delete [] utfStr; + activeInputLabel->setText(text); } //} diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index b2ab4c784..4a4493472 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -249,21 +249,21 @@ void TotalUpgrade::reset() { void TotalUpgrade::sum(const UpgradeTypeBase *ut) { maxHp+= ut->getMaxHp(); - maxHp = max(0,maxHp); + //maxHp = max(0,maxHp); maxEp+= ut->getMaxEp(); - maxEp = max(0,maxEp); + //maxEp = max(0,maxEp); sight+= ut->getSight(); - sight = max(0,sight); + //sight = max(0,sight); armor+= ut->getArmor(); - armor = max(0,armor); + //armor = max(0,armor); attackStrength+= ut->getAttackStrength(); - attackStrength = max(0,attackStrength); + //attackStrength = max(0,attackStrength); attackRange+= ut->getAttackRange(); - attackRange = max(0,attackRange); + //attackRange = max(0,attackRange); moveSpeed+= ut->getMoveSpeed(); - moveSpeed = max(0,moveSpeed); + //moveSpeed = max(0,moveSpeed); prodSpeed+= ut->getProdSpeed(); - prodSpeed = max(0,prodSpeed); + //prodSpeed = max(0,prodSpeed); } void TotalUpgrade::incLevel(const UnitType *ut) { diff --git a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp index 128544140..cd5325480 100644 --- a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp @@ -67,9 +67,9 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere Vec2f rasterPos; if(font->getTextHandler() != NULL) { - char *utfStr = String::ConvertToUTF8(renderText.c_str()); - renderText = utfStr; - delete [] utfStr; + //char *utfStr = String::ConvertToUTF8(renderText.c_str()); + //renderText = utfStr; + //delete [] utfStr; if(centered) { rasterPos.x= x - font->getTextHandler()->Advance(renderText.c_str()) / 2.f; @@ -455,9 +455,9 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo FontMetrics *metrics= font->getMetrics(); if(font->getTextHandler() != NULL) { - char *utfStr = String::ConvertToUTF8(renderText.c_str()); - renderText = utfStr; - delete [] utfStr; + //char *utfStr = String::ConvertToUTF8(renderText.c_str()); + //renderText = utfStr; + //delete [] utfStr; //centered = false; if(centered) { diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index f40c858ce..a7e080f15 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -990,7 +990,8 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input) { SDLKey extractKeyPressed(SDL_KeyboardEvent input) { SDLKey c = SDLK_UNKNOWN; - if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { + //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { + if(input.keysym.unicode > 0) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); c = (SDLKey)input.keysym.unicode; //c = toupper(c);