new way to define the selectionType. No more use of EnableColorPicking and so on!

allowed values are: selectbuf color frustrum

Default is selectbuf again as Colorpicking still makes trouble.
This commit is contained in:
Titus Tscharntke 2013-01-27 22:10:24 +00:00
parent 3f175b8a6a
commit c5dd29f4ff
5 changed files with 22 additions and 33 deletions

View File

@ -4213,18 +4213,7 @@ string Game::getDebugStats(std::map<int,string> &factionDebugInfo) {
str+= "ExploredCellsLookupItemCache: " + world.getExploredCellsLookupItemCacheStats()+"\n";
str+= "FowAlphaCellsLookupItemCache: " + world.getFowAlphaCellsLookupItemCacheStats()+"\n";
const bool selectBufPickingSelection = Config::getInstance().getBool("EnableSelectBufPicking","false");
//const bool colorPickingSelection = Config::getInstance().getBool("EnableColorPicking","true");
const bool frustumPickingSelection = Config::getInstance().getBool("EnableFrustumPicking","false");
if(selectBufPickingSelection) {
str += "Unit selection type: selectBuf\n";
}
else if(frustumPickingSelection) {
str += "Unit selection type: frustrum\n";
}
else {
str += "Unit selection type: color picking\n";
}
str += "Selection type: "+toLower(Config::getInstance().getString("SelectionType",Config::selectBufPicking))+"\n";
//str+= "AllFactionsCacheStats: " + world.getAllFactionsCacheStats()+"\n";
//str+= "AttackWarningCount: " + intToStr(world.getUnitUpdater()->getAttackWarningCount()) + "\n";

View File

@ -73,6 +73,11 @@ const char *Config::glestkeys_ini_filename = "glestkeys.ini";
const char *Config::glestuserkeys_ini_filename = "glestuserkeys.ini";
const char *Config::ACTIVE_MOD_PROPERTY_NAME = "current_mod_name";
const char *Config::colorPicking = "color";
const char *Config::selectBufPicking = "frustrum";
const char *Config::frustrumPicking = "selectbuf";
map<string,string> Config::customRuntimeProperties;
// =====================================================

View File

@ -66,6 +66,10 @@ public:
static const char *ACTIVE_MOD_PROPERTY_NAME;
static const char *colorPicking;
static const char *selectBufPicking;
static const char *frustrumPicking;
protected:
Config();

View File

@ -6691,15 +6691,13 @@ Vec3f Renderer::computeScreenPosition(const Vec3f &worldPos) {
void Renderer::computeSelected( Selection::UnitContainer &units, const Object *&obj,
const bool withObjectSelection,
const Vec2i &posDown, const Vec2i &posUp) {
//const bool selectBufPickingSelection = Config::getInstance().getBool("EnableSelectBufPicking","false");
const bool colorPickingSelection = Config::getInstance().getBool("EnableColorPicking","true");
const bool frustumPickingSelection = Config::getInstance().getBool("EnableFrustumPicking","false");
const string selectionType=toLower(Config::getInstance().getString("SelectionType",Config::selectBufPicking));
if(colorPickingSelection == true) {
if(selectionType==Config::colorPicking) {
selectUsingColorPicking(units,obj, withObjectSelection,posDown, posUp);
}
/// Frustrum approach --> Currently not accurate enough
else if(frustumPickingSelection == true) {
else if(selectionType==Config::frustrumPicking) {
selectUsingFrustumSelection(units,obj, withObjectSelection,posDown, posUp);
}
else {

View File

@ -201,15 +201,14 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
listBoxSelectionType.pushBackItem("SelectBuffer");
listBoxSelectionType.pushBackItem("ColorPicking");
listBoxSelectionType.pushBackItem("FrustumPicking");
bool isColorpicking= config.getBool("EnableColorPicking","false");
bool isFrustumPicking=config.getBool("EnableFrustumPicking","false");
bool isSelectBuf= config.getBool("EnableSelectBufPicking","true");
if( isSelectBuf == true && isColorpicking == false && isFrustumPicking == false )
listBoxSelectionType.setSelectedItemIndex(0);
else if(isColorpicking == false && isFrustumPicking == true)
const string selectionType=toLower(config.getString("SelectionType",Config::selectBufPicking));
if( selectionType==Config::colorPicking)
listBoxSelectionType.setSelectedItemIndex(1);
else if ( selectionType==Config::frustrumPicking )
listBoxSelectionType.setSelectedItemIndex(2);
else
listBoxSelectionType.setSelectedItemIndex(1);
listBoxSelectionType.setSelectedItemIndex(0);
currentLine-=lineOffset;
//shadows
@ -1774,19 +1773,13 @@ void MenuStateOptions::saveConfig(){
int selectionTypeindex= listBoxSelectionType.getSelectedItemIndex();
if(selectionTypeindex==0){
config.setBool("EnableSelectBufPicking", true);
config.setBool("EnableColorPicking", false);
config.setBool("EnableFrustumPicking", false);
config.setString("SelectionType",Config::selectBufPicking);
}
else if (selectionTypeindex==1){
config.setBool("EnableSelectBufPicking", false);
config.setBool("EnableColorPicking", true);
config.setBool("EnableFrustumPicking", false);
config.setString("SelectionType",Config::colorPicking);
}
else if (selectionTypeindex==2){
config.setBool("EnableSelectBufPicking", false);
config.setBool("EnableColorPicking", false);
config.setBool("EnableFrustumPicking", true);
config.setString("SelectionType",Config::frustrumPicking);
}
int index= listBoxShadows.getSelectedItemIndex();