diff --git a/mk/shared/glest.ini b/mk/shared/glest.ini index a81015201..eb2ee811e 100644 --- a/mk/shared/glest.ini +++ b/mk/shared/glest.ini @@ -23,6 +23,7 @@ DebugMode=false DebugPerformance=false DebugNetwork=false DebugWorldSynch=false +DefaultActionAttack=1 DepthBits=16 FactoryGraphics=OpenGL FactorySound=OpenAL @@ -75,9 +76,9 @@ ShadowTextureSize=512 Shadows=Projected SoundStaticBuffers=16 SoundStreamingBuffers=4 -SoundVolumeAmbient=80 -SoundVolumeFx=80 -SoundVolumeMusic=90 +SoundVolumeAmbient=70 +SoundVolumeFx=70 +SoundVolumeMusic=70 StencilBits=0 Textures3D=true UnitParticles=true diff --git a/mk/windows/glest.ini b/mk/windows/glest.ini index 5f195a37d..fc5f27471 100644 --- a/mk/windows/glest.ini +++ b/mk/windows/glest.ini @@ -23,6 +23,7 @@ DebugMode=false DebugPerformance=false DebugNetwork=false DebugWorldSynch=false +DefaultActionAttack=1 DepthBits=16 FactoryGraphics=OpenGL FactorySound=OpenAL @@ -74,9 +75,9 @@ ShadowTextureSize=512 Shadows=Projected SoundStaticBuffers=16 SoundStreamingBuffers=4 -SoundVolumeAmbient=80 -SoundVolumeFx=80 -SoundVolumeMusic=90 +SoundVolumeAmbient=70 +SoundVolumeFx=70 +SoundVolumeMusic=70 StencilBits=0 Textures3D=true UnitParticles=true diff --git a/mk/windows/glest_release.ini b/mk/windows/glest_release.ini index 549cc3fad..ea6944764 100644 --- a/mk/windows/glest_release.ini +++ b/mk/windows/glest_release.ini @@ -23,6 +23,7 @@ DebugMode=false DebugPerformance=false DebugNetwork=false DebugWorldSynch=false +DefaultActionAttack=1 DepthBits=16 FactoryGraphics=OpenGL FactorySound=OpenAL @@ -74,9 +75,9 @@ ShadowTextureSize=512 Shadows=Projected SoundStaticBuffers=16 SoundStreamingBuffers=4 -SoundVolumeAmbient=80 -SoundVolumeFx=80 -SoundVolumeMusic=90 +SoundVolumeAmbient=70 +SoundVolumeFx=70 +SoundVolumeMusic=70 StencilBits=0 Textures3D=true UnitParticles=true diff --git a/source/game/gui/gui.cpp b/source/game/gui/gui.cpp index fe8f3524a..b4d967951 100644 --- a/source/game/gui/gui.cpp +++ b/source/game/gui/gui.cpp @@ -291,7 +291,15 @@ namespace Game { } void Gui::mouseDownRightGraphics(int x, int y, bool prepared) { - if (selectingPos || selectingMeetingPoint) { + if (selectingPos) { + //give standard orders + Vec2i targetPos = game->getMouseCellPos(); + if (prepared || (game->isValidMouseCellPos() && + world->getMap()->isInsideSurface(world->getMap()->toSurfCoords(targetPos)) == true)) { + giveTwoClickOrders(x, y, prepared); + } + resetState(); + } else if (selectingMeetingPoint) { resetState(); } else if (selection.isCommandable()) { if (prepared) { diff --git a/source/game/menu/menu_state_options.cpp b/source/game/menu/menu_state_options.cpp index c721c9e31..e947fbbab 100644 --- a/source/game/menu/menu_state_options.cpp +++ b/source/game/menu/menu_state_options.cpp @@ -79,10 +79,10 @@ namespace Game { checkBoxTimeDisplay("Options", "checkBoxTimeDisplay"), labelChatStaysActive("Options", "labelChatStaysActive"), checkBoxChatStaysActive("Options", "checkBoxChatStaysActive"), - labelShowDeveloperConsoleOnWindows("Options", - "labelShowDeveloperConsoleOnWindows"), - checkBoxShowDeveloperConsoleOnWindows("Options", - "checkBoxShowDeveloperConsoleOnWindows"), + labelShowDeveloperConsoleOnWindows("Options", "labelShowDeveloperConsoleOnWindows"), + checkBoxShowDeveloperConsoleOnWindows("Options", "checkBoxShowDeveloperConsoleOnWindows"), + labelDefaultActionOnRightClick("Options", "labelDefaultActionOnRightClick"), + checkBoxDefaultActionOnRightClick("Options", "checkBoxDefaultActionOnRightClick"), labelCustomTranslation("Options", "labelCustomTranslation"), checkBoxCustomTranslation("Options", "checkBoxCustomTranslation"), buttonGetNewLanguageFiles("Options", "buttonGetNewLanguageFiles"), @@ -381,15 +381,17 @@ namespace Game { labelShowDeveloperConsoleOnWindows.init(currentLabelStart, currentLine); labelShowDeveloperConsoleOnWindows.setText(lang.getString("ShowDevConsoleWin")); - checkBoxShowDeveloperConsoleOnWindows.init(currentColumnStart, - currentLine); - checkBoxShowDeveloperConsoleOnWindows.setValue(config. - getBool - ("ShowConsoleWindows", - "false")); + checkBoxShowDeveloperConsoleOnWindows.init(currentColumnStart, currentLine); + checkBoxShowDeveloperConsoleOnWindows.setValue(config.getBool("ShowConsoleWindows", "false")); currentLine -= lineOffset; + labelDefaultActionOnRightClick.init(currentLabelStart, currentLine); + labelDefaultActionOnRightClick.setText(lang.getString("DefaultActionOnRightClick")); + + checkBoxDefaultActionOnRightClick.init(currentColumnStart, currentLine); + checkBoxDefaultActionOnRightClick.setValue(config.getBool("DefaultActionAttack", "true")); + currentLine -= lineOffset / 2; // buttons @@ -1082,6 +1084,7 @@ namespace Game { listBoxHealthBars.mouseClick(x, y); checkBoxChatStaysActive.mouseClick(x, y); checkBoxTimeDisplay.mouseClick(x, y); + checkBoxDefaultActionOnRightClick.mouseClick(x, y); checkBoxShowDeveloperConsoleOnWindows.mouseClick(x, y); } } @@ -1112,6 +1115,7 @@ namespace Game { checkBoxVisibleHud.mouseMove(x, y); checkBoxChatStaysActive.mouseMove(x, y); checkBoxTimeDisplay.mouseMove(x, y); + checkBoxDefaultActionOnRightClick.mouseMove(x, y); checkBoxShowDeveloperConsoleOnWindows.mouseMove(x, y); checkBoxCustomTranslation.mouseMove(x, y); } @@ -1220,6 +1224,9 @@ namespace Game { renderer.renderLabel(&labelChatStaysActive); renderer.renderLabel(&labelTimeDisplay); + renderer.renderLabel(&labelDefaultActionOnRightClick); + renderer.renderCheckBox(&checkBoxDefaultActionOnRightClick); + renderer.renderLabel(&labelShowDeveloperConsoleOnWindows); renderer.renderCheckBox(&checkBoxShowDeveloperConsoleOnWindows); @@ -1294,9 +1301,8 @@ namespace Game { config.setBool("VisibleHud", checkBoxVisibleHud.getValue()); config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue()); config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue()); - - config.setBool("ShowConsoleWindows", - checkBoxShowDeveloperConsoleOnWindows.getValue()); + config.setBool("DefaultActionAttack", checkBoxDefaultActionOnRightClick.getValue()); + config.setBool("ShowConsoleWindows", checkBoxShowDeveloperConsoleOnWindows.getValue()); config.save(); #ifdef _WIN32 diff --git a/source/game/menu/menu_state_options.h b/source/game/menu/menu_state_options.h index 25f4eae50..3e9b8242b 100644 --- a/source/game/menu/menu_state_options.h +++ b/source/game/menu/menu_state_options.h @@ -76,6 +76,9 @@ namespace Game { GraphicLabel labelShowDeveloperConsoleOnWindows; GraphicCheckBox checkBoxShowDeveloperConsoleOnWindows; + GraphicLabel labelDefaultActionOnRightClick; + GraphicCheckBox checkBoxDefaultActionOnRightClick; + map < string, string > languageList; GraphicLabel labelCustomTranslation; diff --git a/source/game/type_instances/unit.cpp b/source/game/type_instances/unit.cpp index fb9d90171..dcf890015 100644 --- a/source/game/type_instances/unit.cpp +++ b/source/game/type_instances/unit.cpp @@ -637,6 +637,7 @@ namespace Game { const int Unit::speedDivider = 100; const int Unit::maxDeadCount = 800; //time in until the corpse disapears - should be about 40 seconds const int Unit::invalidId = -1; + bool Unit::defaultActionAttack = true; //set Unit::livingUnits; //set Unit::livingUnitsp; @@ -648,6 +649,7 @@ namespace Game { Unit::Unit(int id, UnitPathInterface * unitpath, const Vec2i & position, const UnitType * type, Faction * faction, Map * map, CardinalDir placeFacing) :BaseColorPickEntity(), id(id) { + defaultActionAttack = Config::getInstance().getBool("DefaultActionAttack", "true"); #ifdef LEAK_CHECK_UNITS Unit::mapMemoryList[this] = true; #endif @@ -2746,7 +2748,7 @@ namespace Game { // or when the unit is selected and right clicked to a position. if (commandType == NULL) { CommandClass command = ccMove; //default command - if (this->getType()->hasSkillClass(scAttack) && (targetUnit == NULL || this->getTeam() != targetUnit->getTeam())) + if (defaultActionAttack && this->getType()->hasSkillClass(scAttack) && (targetUnit == NULL || this->getTeam() != targetUnit->getTeam())) command = ccAttack; commandType = type->getFirstCtOfClass(command); } diff --git a/source/game/type_instances/unit.h b/source/game/type_instances/unit.h index 3a651e85a..3f5842727 100644 --- a/source/game/type_instances/unit.h +++ b/source/game/type_instances/unit.h @@ -432,6 +432,7 @@ namespace Game { static const int speedDivider; static const int maxDeadCount; static const int invalidId; + static bool defaultActionAttack; # ifdef LEAK_CHECK_UNITS static std::map < UnitPathInterface *, int >mapMemoryList2; diff --git a/source/shared_lib/sources/util/conversion.cpp b/source/shared_lib/sources/util/conversion.cpp index 8537deeca..62f138a05 100644 --- a/source/shared_lib/sources/util/conversion.cpp +++ b/source/shared_lib/sources/util/conversion.cpp @@ -34,14 +34,23 @@ using namespace std; namespace Shared { namespace Util { - const int strSize = 256; + bool iequals(const string& a, const string& b) { + size_t sz = a.size(); + if (b.size() != sz) + return false; + for (size_t i = 0; i < sz; ++i) + if (tolower(a[i]) != tolower(b[i])) + return false; + return true; + } + bool strToBool(const string &s) { - if (s == "0" || s == "false") { + if (s == "0" || iequals(s, "false")) { return false; } - if (s == "1" || s == "true") { + if (s == "1" || iequals(s, "true")) { return true; } throw game_runtime_error("Error converting string to bool, expected 0 or 1, found: [" + s + "]"); @@ -86,11 +95,11 @@ namespace Shared { } bool strToBool(const string &s, bool *b) { - if (s == "0" || s == "false") { + if (s == "0" || iequals(s, "false")) { *b = false; return true; } - if (s == "1" || s == "true") { + if (s == "1" || iequals(s, "true")) { *b = true; return true; }