Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions projects/lib/src/chessengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,24 @@ void ChessEngine::addOption(EngineOption* option)

EngineOption* ChessEngine::getOption(const QString& name) const
{
for (EngineOption* option : qAsConst(m_options))
if (hasCaseSensitiveOptions())
{
if (option->alias() == name || option->name() == name)
return option;
for (EngineOption* option : qAsConst(m_options))
{
if (option->alias() == name || option->name() == name)
return option;
}
}
else
{
QString lowerCaseName = name.toLower();
for (EngineOption* option : qAsConst(m_options))
{
if (option->alias().toLower() == lowerCaseName
|| option->name().toLower() == lowerCaseName)
return option;
}
}

return nullptr;
}

Expand Down Expand Up @@ -308,6 +320,11 @@ int ChessEngine::id() const
return m_id;
}

bool ChessEngine::hasCaseSensitiveOptions() const
{
return true;
}

bool ChessEngine::stopThinking()
{
if (state() == Thinking || isPondering())
Expand Down
5 changes: 5 additions & 0 deletions projects/lib/src/chessengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ class LIB_EXPORT ChessEngine : public ChessPlayer
* Gives id number of the engine
*/
int id() const;
/*!
* Returns true if option names are case sensitive else false.
* The default value is true.
*/
virtual bool hasCaseSensitiveOptions() const;

protected slots:
// Inherited from ChessPlayer
Expand Down
5 changes: 5 additions & 0 deletions projects/lib/src/uciengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ QString UciEngine::protocol() const
return "uci";
}

bool UciEngine::hasCaseSensitiveOptions() const
{
return false;
}

bool UciEngine::sendPing()
{
write("isready");
Expand Down
1 change: 1 addition & 0 deletions projects/lib/src/uciengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class LIB_EXPORT UciEngine : public ChessEngine
virtual void parseLine(const QString& line);
virtual void sendOption(const QString& name, const QVariant& value);
virtual bool isPondering() const;
virtual bool hasCaseSensitiveOptions() const override;

private:
enum PonderState
Expand Down