mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
Default command on right-click is now configurable
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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
|
||||
|
@@ -76,6 +76,9 @@ namespace Game {
|
||||
GraphicLabel labelShowDeveloperConsoleOnWindows;
|
||||
GraphicCheckBox checkBoxShowDeveloperConsoleOnWindows;
|
||||
|
||||
GraphicLabel labelDefaultActionOnRightClick;
|
||||
GraphicCheckBox checkBoxDefaultActionOnRightClick;
|
||||
|
||||
map < string, string > languageList;
|
||||
|
||||
GraphicLabel labelCustomTranslation;
|
||||
|
@@ -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<int> Unit::livingUnits;
|
||||
//set<Unit*> 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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user