mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 21:33:59 +02:00
Default command on right-click is now configurable
This commit is contained in:
@@ -23,6 +23,7 @@ DebugMode=false
|
|||||||
DebugPerformance=false
|
DebugPerformance=false
|
||||||
DebugNetwork=false
|
DebugNetwork=false
|
||||||
DebugWorldSynch=false
|
DebugWorldSynch=false
|
||||||
|
DefaultActionAttack=1
|
||||||
DepthBits=16
|
DepthBits=16
|
||||||
FactoryGraphics=OpenGL
|
FactoryGraphics=OpenGL
|
||||||
FactorySound=OpenAL
|
FactorySound=OpenAL
|
||||||
@@ -75,9 +76,9 @@ ShadowTextureSize=512
|
|||||||
Shadows=Projected
|
Shadows=Projected
|
||||||
SoundStaticBuffers=16
|
SoundStaticBuffers=16
|
||||||
SoundStreamingBuffers=4
|
SoundStreamingBuffers=4
|
||||||
SoundVolumeAmbient=80
|
SoundVolumeAmbient=70
|
||||||
SoundVolumeFx=80
|
SoundVolumeFx=70
|
||||||
SoundVolumeMusic=90
|
SoundVolumeMusic=70
|
||||||
StencilBits=0
|
StencilBits=0
|
||||||
Textures3D=true
|
Textures3D=true
|
||||||
UnitParticles=true
|
UnitParticles=true
|
||||||
|
@@ -23,6 +23,7 @@ DebugMode=false
|
|||||||
DebugPerformance=false
|
DebugPerformance=false
|
||||||
DebugNetwork=false
|
DebugNetwork=false
|
||||||
DebugWorldSynch=false
|
DebugWorldSynch=false
|
||||||
|
DefaultActionAttack=1
|
||||||
DepthBits=16
|
DepthBits=16
|
||||||
FactoryGraphics=OpenGL
|
FactoryGraphics=OpenGL
|
||||||
FactorySound=OpenAL
|
FactorySound=OpenAL
|
||||||
@@ -74,9 +75,9 @@ ShadowTextureSize=512
|
|||||||
Shadows=Projected
|
Shadows=Projected
|
||||||
SoundStaticBuffers=16
|
SoundStaticBuffers=16
|
||||||
SoundStreamingBuffers=4
|
SoundStreamingBuffers=4
|
||||||
SoundVolumeAmbient=80
|
SoundVolumeAmbient=70
|
||||||
SoundVolumeFx=80
|
SoundVolumeFx=70
|
||||||
SoundVolumeMusic=90
|
SoundVolumeMusic=70
|
||||||
StencilBits=0
|
StencilBits=0
|
||||||
Textures3D=true
|
Textures3D=true
|
||||||
UnitParticles=true
|
UnitParticles=true
|
||||||
|
@@ -23,6 +23,7 @@ DebugMode=false
|
|||||||
DebugPerformance=false
|
DebugPerformance=false
|
||||||
DebugNetwork=false
|
DebugNetwork=false
|
||||||
DebugWorldSynch=false
|
DebugWorldSynch=false
|
||||||
|
DefaultActionAttack=1
|
||||||
DepthBits=16
|
DepthBits=16
|
||||||
FactoryGraphics=OpenGL
|
FactoryGraphics=OpenGL
|
||||||
FactorySound=OpenAL
|
FactorySound=OpenAL
|
||||||
@@ -74,9 +75,9 @@ ShadowTextureSize=512
|
|||||||
Shadows=Projected
|
Shadows=Projected
|
||||||
SoundStaticBuffers=16
|
SoundStaticBuffers=16
|
||||||
SoundStreamingBuffers=4
|
SoundStreamingBuffers=4
|
||||||
SoundVolumeAmbient=80
|
SoundVolumeAmbient=70
|
||||||
SoundVolumeFx=80
|
SoundVolumeFx=70
|
||||||
SoundVolumeMusic=90
|
SoundVolumeMusic=70
|
||||||
StencilBits=0
|
StencilBits=0
|
||||||
Textures3D=true
|
Textures3D=true
|
||||||
UnitParticles=true
|
UnitParticles=true
|
||||||
|
@@ -291,7 +291,15 @@ namespace Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gui::mouseDownRightGraphics(int x, int y, bool prepared) {
|
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();
|
resetState();
|
||||||
} else if (selection.isCommandable()) {
|
} else if (selection.isCommandable()) {
|
||||||
if (prepared) {
|
if (prepared) {
|
||||||
|
@@ -79,10 +79,10 @@ namespace Game {
|
|||||||
checkBoxTimeDisplay("Options", "checkBoxTimeDisplay"),
|
checkBoxTimeDisplay("Options", "checkBoxTimeDisplay"),
|
||||||
labelChatStaysActive("Options", "labelChatStaysActive"),
|
labelChatStaysActive("Options", "labelChatStaysActive"),
|
||||||
checkBoxChatStaysActive("Options", "checkBoxChatStaysActive"),
|
checkBoxChatStaysActive("Options", "checkBoxChatStaysActive"),
|
||||||
labelShowDeveloperConsoleOnWindows("Options",
|
labelShowDeveloperConsoleOnWindows("Options", "labelShowDeveloperConsoleOnWindows"),
|
||||||
"labelShowDeveloperConsoleOnWindows"),
|
checkBoxShowDeveloperConsoleOnWindows("Options", "checkBoxShowDeveloperConsoleOnWindows"),
|
||||||
checkBoxShowDeveloperConsoleOnWindows("Options",
|
labelDefaultActionOnRightClick("Options", "labelDefaultActionOnRightClick"),
|
||||||
"checkBoxShowDeveloperConsoleOnWindows"),
|
checkBoxDefaultActionOnRightClick("Options", "checkBoxDefaultActionOnRightClick"),
|
||||||
labelCustomTranslation("Options", "labelCustomTranslation"),
|
labelCustomTranslation("Options", "labelCustomTranslation"),
|
||||||
checkBoxCustomTranslation("Options", "checkBoxCustomTranslation"),
|
checkBoxCustomTranslation("Options", "checkBoxCustomTranslation"),
|
||||||
buttonGetNewLanguageFiles("Options", "buttonGetNewLanguageFiles"),
|
buttonGetNewLanguageFiles("Options", "buttonGetNewLanguageFiles"),
|
||||||
@@ -381,15 +381,17 @@ namespace Game {
|
|||||||
labelShowDeveloperConsoleOnWindows.init(currentLabelStart, currentLine);
|
labelShowDeveloperConsoleOnWindows.init(currentLabelStart, currentLine);
|
||||||
labelShowDeveloperConsoleOnWindows.setText(lang.getString("ShowDevConsoleWin"));
|
labelShowDeveloperConsoleOnWindows.setText(lang.getString("ShowDevConsoleWin"));
|
||||||
|
|
||||||
checkBoxShowDeveloperConsoleOnWindows.init(currentColumnStart,
|
checkBoxShowDeveloperConsoleOnWindows.init(currentColumnStart, currentLine);
|
||||||
currentLine);
|
checkBoxShowDeveloperConsoleOnWindows.setValue(config.getBool("ShowConsoleWindows", "false"));
|
||||||
checkBoxShowDeveloperConsoleOnWindows.setValue(config.
|
|
||||||
getBool
|
|
||||||
("ShowConsoleWindows",
|
|
||||||
"false"));
|
|
||||||
|
|
||||||
currentLine -= lineOffset;
|
currentLine -= lineOffset;
|
||||||
|
|
||||||
|
labelDefaultActionOnRightClick.init(currentLabelStart, currentLine);
|
||||||
|
labelDefaultActionOnRightClick.setText(lang.getString("DefaultActionOnRightClick"));
|
||||||
|
|
||||||
|
checkBoxDefaultActionOnRightClick.init(currentColumnStart, currentLine);
|
||||||
|
checkBoxDefaultActionOnRightClick.setValue(config.getBool("DefaultActionAttack", "true"));
|
||||||
|
|
||||||
currentLine -= lineOffset / 2;
|
currentLine -= lineOffset / 2;
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
@@ -1082,6 +1084,7 @@ namespace Game {
|
|||||||
listBoxHealthBars.mouseClick(x, y);
|
listBoxHealthBars.mouseClick(x, y);
|
||||||
checkBoxChatStaysActive.mouseClick(x, y);
|
checkBoxChatStaysActive.mouseClick(x, y);
|
||||||
checkBoxTimeDisplay.mouseClick(x, y);
|
checkBoxTimeDisplay.mouseClick(x, y);
|
||||||
|
checkBoxDefaultActionOnRightClick.mouseClick(x, y);
|
||||||
checkBoxShowDeveloperConsoleOnWindows.mouseClick(x, y);
|
checkBoxShowDeveloperConsoleOnWindows.mouseClick(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1112,6 +1115,7 @@ namespace Game {
|
|||||||
checkBoxVisibleHud.mouseMove(x, y);
|
checkBoxVisibleHud.mouseMove(x, y);
|
||||||
checkBoxChatStaysActive.mouseMove(x, y);
|
checkBoxChatStaysActive.mouseMove(x, y);
|
||||||
checkBoxTimeDisplay.mouseMove(x, y);
|
checkBoxTimeDisplay.mouseMove(x, y);
|
||||||
|
checkBoxDefaultActionOnRightClick.mouseMove(x, y);
|
||||||
checkBoxShowDeveloperConsoleOnWindows.mouseMove(x, y);
|
checkBoxShowDeveloperConsoleOnWindows.mouseMove(x, y);
|
||||||
checkBoxCustomTranslation.mouseMove(x, y);
|
checkBoxCustomTranslation.mouseMove(x, y);
|
||||||
}
|
}
|
||||||
@@ -1220,6 +1224,9 @@ namespace Game {
|
|||||||
renderer.renderLabel(&labelChatStaysActive);
|
renderer.renderLabel(&labelChatStaysActive);
|
||||||
renderer.renderLabel(&labelTimeDisplay);
|
renderer.renderLabel(&labelTimeDisplay);
|
||||||
|
|
||||||
|
renderer.renderLabel(&labelDefaultActionOnRightClick);
|
||||||
|
renderer.renderCheckBox(&checkBoxDefaultActionOnRightClick);
|
||||||
|
|
||||||
renderer.renderLabel(&labelShowDeveloperConsoleOnWindows);
|
renderer.renderLabel(&labelShowDeveloperConsoleOnWindows);
|
||||||
renderer.renderCheckBox(&checkBoxShowDeveloperConsoleOnWindows);
|
renderer.renderCheckBox(&checkBoxShowDeveloperConsoleOnWindows);
|
||||||
|
|
||||||
@@ -1294,9 +1301,8 @@ namespace Game {
|
|||||||
config.setBool("VisibleHud", checkBoxVisibleHud.getValue());
|
config.setBool("VisibleHud", checkBoxVisibleHud.getValue());
|
||||||
config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue());
|
config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue());
|
||||||
config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue());
|
config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue());
|
||||||
|
config.setBool("DefaultActionAttack", checkBoxDefaultActionOnRightClick.getValue());
|
||||||
config.setBool("ShowConsoleWindows",
|
config.setBool("ShowConsoleWindows", checkBoxShowDeveloperConsoleOnWindows.getValue());
|
||||||
checkBoxShowDeveloperConsoleOnWindows.getValue());
|
|
||||||
config.save();
|
config.save();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@@ -76,6 +76,9 @@ namespace Game {
|
|||||||
GraphicLabel labelShowDeveloperConsoleOnWindows;
|
GraphicLabel labelShowDeveloperConsoleOnWindows;
|
||||||
GraphicCheckBox checkBoxShowDeveloperConsoleOnWindows;
|
GraphicCheckBox checkBoxShowDeveloperConsoleOnWindows;
|
||||||
|
|
||||||
|
GraphicLabel labelDefaultActionOnRightClick;
|
||||||
|
GraphicCheckBox checkBoxDefaultActionOnRightClick;
|
||||||
|
|
||||||
map < string, string > languageList;
|
map < string, string > languageList;
|
||||||
|
|
||||||
GraphicLabel labelCustomTranslation;
|
GraphicLabel labelCustomTranslation;
|
||||||
|
@@ -637,6 +637,7 @@ namespace Game {
|
|||||||
const int Unit::speedDivider = 100;
|
const int Unit::speedDivider = 100;
|
||||||
const int Unit::maxDeadCount = 800; //time in until the corpse disapears - should be about 40 seconds
|
const int Unit::maxDeadCount = 800; //time in until the corpse disapears - should be about 40 seconds
|
||||||
const int Unit::invalidId = -1;
|
const int Unit::invalidId = -1;
|
||||||
|
bool Unit::defaultActionAttack = true;
|
||||||
|
|
||||||
//set<int> Unit::livingUnits;
|
//set<int> Unit::livingUnits;
|
||||||
//set<Unit*> Unit::livingUnitsp;
|
//set<Unit*> Unit::livingUnitsp;
|
||||||
@@ -648,6 +649,7 @@ namespace Game {
|
|||||||
Unit::Unit(int id, UnitPathInterface * unitpath, const Vec2i & position,
|
Unit::Unit(int id, UnitPathInterface * unitpath, const Vec2i & position,
|
||||||
const UnitType * type, Faction * faction, Map * map,
|
const UnitType * type, Faction * faction, Map * map,
|
||||||
CardinalDir placeFacing) :BaseColorPickEntity(), id(id) {
|
CardinalDir placeFacing) :BaseColorPickEntity(), id(id) {
|
||||||
|
defaultActionAttack = Config::getInstance().getBool("DefaultActionAttack", "true");
|
||||||
#ifdef LEAK_CHECK_UNITS
|
#ifdef LEAK_CHECK_UNITS
|
||||||
Unit::mapMemoryList[this] = true;
|
Unit::mapMemoryList[this] = true;
|
||||||
#endif
|
#endif
|
||||||
@@ -2746,7 +2748,7 @@ namespace Game {
|
|||||||
// or when the unit is selected and right clicked to a position.
|
// or when the unit is selected and right clicked to a position.
|
||||||
if (commandType == NULL) {
|
if (commandType == NULL) {
|
||||||
CommandClass command = ccMove; //default command
|
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;
|
command = ccAttack;
|
||||||
commandType = type->getFirstCtOfClass(command);
|
commandType = type->getFirstCtOfClass(command);
|
||||||
}
|
}
|
||||||
|
@@ -432,6 +432,7 @@ namespace Game {
|
|||||||
static const int speedDivider;
|
static const int speedDivider;
|
||||||
static const int maxDeadCount;
|
static const int maxDeadCount;
|
||||||
static const int invalidId;
|
static const int invalidId;
|
||||||
|
static bool defaultActionAttack;
|
||||||
|
|
||||||
# ifdef LEAK_CHECK_UNITS
|
# ifdef LEAK_CHECK_UNITS
|
||||||
static std::map < UnitPathInterface *, int >mapMemoryList2;
|
static std::map < UnitPathInterface *, int >mapMemoryList2;
|
||||||
|
@@ -34,14 +34,23 @@ using namespace std;
|
|||||||
|
|
||||||
namespace Shared {
|
namespace Shared {
|
||||||
namespace Util {
|
namespace Util {
|
||||||
|
|
||||||
const int strSize = 256;
|
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) {
|
bool strToBool(const string &s) {
|
||||||
if (s == "0" || s == "false") {
|
if (s == "0" || iequals(s, "false")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (s == "1" || s == "true") {
|
if (s == "1" || iequals(s, "true")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw game_runtime_error("Error converting string to bool, expected 0 or 1, found: [" + s + "]");
|
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) {
|
bool strToBool(const string &s, bool *b) {
|
||||||
if (s == "0" || s == "false") {
|
if (s == "0" || iequals(s, "false")) {
|
||||||
*b = false;
|
*b = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (s == "1" || s == "true") {
|
if (s == "1" || iequals(s, "true")) {
|
||||||
*b = true;
|
*b = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user