mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 10:57:43 +00:00
Disallow same option being added twice
Now exits during startup. ``` ./stockfish Stockfish dev-20250202-243c7c6a by the Stockfish developers (see AUTHORS file) x1,5,0,10,0.5,0.0020 Option: "x1" was already added! ``` i.e. prevents and helps debug this case ```cpp int x1 = 5; TUNE(x1); TUNE(x1); ``` closes https://github.com/official-stockfish/Stockfish/pull/5847 No functional change
This commit is contained in:
+5
-3
@@ -54,12 +54,13 @@ class Option {
|
||||
|
||||
friend std::ostream& operator<<(std::ostream&, const OptionsMap&);
|
||||
|
||||
int operator<<(const Option&) = delete;
|
||||
|
||||
private:
|
||||
friend class OptionsMap;
|
||||
friend class Engine;
|
||||
friend class Tune;
|
||||
|
||||
void operator<<(const Option&);
|
||||
|
||||
std::string defaultValue, currentValue, type;
|
||||
int min, max;
|
||||
@@ -82,8 +83,9 @@ class OptionsMap {
|
||||
|
||||
void setoption(std::istringstream&);
|
||||
|
||||
Option operator[](const std::string&) const;
|
||||
Option& operator[](const std::string&);
|
||||
const Option& operator[](const std::string&) const;
|
||||
|
||||
void add(const std::string&, const Option& option);
|
||||
|
||||
std::size_t count(const std::string&) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user