No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
CXXFLAGS = -g -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
ifeq ($(comp),gcc)
- CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra
+ CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra -Wshadow
endif
ifeq ($(comp),mingw)
- CXXFLAGS += -Wno-long-long -Wextra
+ CXXFLAGS += -Wextra -Wshadow
endif
ifeq ($(comp),icc)
void Book::close() {
- if (is_open())
- ifstream::close();
+ if (bookFile.is_open())
+ bookFile.close();
bookName = "";
}
// Close old file before opening the new
close();
- ifstream::open(fileName.c_str(), ifstream::in | ifstream::binary);
+ bookFile.open(fileName.c_str(), ifstream::in | ifstream::binary);
// Silently return when asked to open a non-exsistent file
- if (!is_open())
+ if (!bookFile.is_open())
return;
// Get the book size in number of entries
- seekg(0, ios::end);
- bookSize = long(tellg()) / sizeof(BookEntry);
+ bookFile.seekg(0, ios::end);
+ bookSize = long(bookFile.tellg()) / sizeof(BookEntry);
- if (!good())
+ if (!bookFile.good())
{
cerr << "Failed to open book file " << fileName << endl;
exit(EXIT_FAILURE);
Move Book::get_move(const Position& pos, bool findBestMove) {
- if (!is_open() || bookSize == 0)
+ if (!bookFile.is_open() || bookSize == 0)
return MOVE_NONE;
BookEntry entry;
BookEntry e;
- seekg(idx * sizeof(BookEntry), ios_base::beg);
+ bookFile.seekg(idx * sizeof(BookEntry), ios_base::beg);
*this >> e.key >> e.move >> e.count >> e.learn;
- if (!good())
+ if (!bookFile.good())
{
cerr << "Failed to read book entry at index " << idx << endl;
exit(EXIT_FAILURE);
uint32_t learn;
};
-class Book : private std::ifstream {
- Book(const Book&); // just decleared..
- Book& operator=(const Book&); // ..to avoid a warning
+class Book {
public:
Book();
~Book();
BookEntry read_entry(int idx);
int find_entry(uint64_t key);
+ std::ifstream bookFile;
std::string bookName;
int bookSize;
RKISS RKiss;
};
// Yes, we indulge a bit here ;-)
-template<int n> inline uint64_t Book::get_int() { return 256 * get_int<n-1>() + get(); }
-template<> inline uint64_t Book::get_int<1>() { return get(); }
+template<int n> inline uint64_t Book::get_int() { return 256 * get_int<n-1>() + bookFile.get(); }
+template<> inline uint64_t Book::get_int<1>() { return bookFile.get(); }
#endif // !defined(BOOK_H_INCLUDED)
Value value(Piece p, Square to) const;
void update(Piece p, Square to, Value bonus);
Value gain(Piece p, Square to) const;
- void update_gain(Piece p, Square to, Value gain);
+ void update_gain(Piece p, Square to, Value g);
static const Value MaxValue = Value(1 << 29); // To avoid an overflow
return maxGains[p][to];
}
-inline void History::update_gain(Piece p, Square to, Value gain) {
- maxGains[p][to] = Max(gain, maxGains[p][to] - 1);
+inline void History::update_gain(Piece p, Square to, Value g) {
+ maxGains[p][to] = Max(g, maxGains[p][to] - 1);
}
#endif // !defined(HISTORY_H_INCLUDED)
/// string. This function is not very robust - make sure that input FENs are
/// correct (this is assumed to be the responsibility of the GUI).
-void Position::from_fen(const string& fen, bool c960) {
+void Position::from_fen(const string& fen, bool isChess960) {
/*
A FEN string defines a particular position using only the ASCII character set.
castleRightsMask[make_square(initialQRFile, RANK_1)] ^= WHITE_OOO;
castleRightsMask[make_square(initialQRFile, RANK_8)] ^= BLACK_OOO;
- isChess960 = c960;
+ chess960 = isChess960;
find_checkers();
st->key = compute_key();
if (st->castleRights != CASTLES_NONE)
{
if (can_castle_kingside(WHITE))
- fen += isChess960 ? char(toupper(file_to_char(initialKRFile))) : 'K';
+ fen += chess960 ? char(toupper(file_to_char(initialKRFile))) : 'K';
if (can_castle_queenside(WHITE))
- fen += isChess960 ? char(toupper(file_to_char(initialQRFile))) : 'Q';
+ fen += chess960 ? char(toupper(file_to_char(initialQRFile))) : 'Q';
if (can_castle_kingside(BLACK))
- fen += isChess960 ? file_to_char(initialKRFile) : 'k';
+ fen += chess960 ? file_to_char(initialKRFile) : 'k';
if (can_castle_queenside(BLACK))
- fen += isChess960 ? file_to_char(initialQRFile) : 'q';
+ fen += chess960 ? file_to_char(initialQRFile) : 'q';
} else
fen += '-';
int castleRightsMask[64];
StateInfo startState;
File initialKFile, initialKRFile, initialQRFile;
- bool isChess960;
+ bool chess960;
int startPosPlyCounter;
int threadID;
int64_t nodes;
}
inline bool Position::is_chess960() const {
- return isChess960;
+ return chess960;
}
inline bool Position::move_is_capture(Move m) const {
/// the GUI to check for option's limits, but we could receive the new value
/// directly from the user by teminal window. So let's check the bounds anyway.
-void Option::set_value(const string& value) {
+void Option::set_value(const string& v) {
assert(!type.empty());
- if (value.empty())
+ if (v.empty())
return;
if ( (type == "check" || type == "button")
- != (value == "true" || value == "false"))
+ != (v == "true" || v == "false"))
return;
if (type == "spin")
{
- int v = atoi(value.c_str());
- if (v < minValue || v > maxValue)
+ int val = atoi(v.c_str());
+ if (val < minValue || val > maxValue)
return;
}
- currentValue = value;
+ currentValue = v;
}
Option(bool defaultValue, std::string type = "check");
Option(int defaultValue, int minValue, int maxValue);
- void set_value(const std::string& value);
+ void set_value(const std::string& v);
template<typename T> T value() const;
private: