|
@@ -25,19 +25,19 @@ union chessy::Index
|
|
|
Index(void) = default;
|
|
|
inline Index(int8_t ind) : index{ ind } {}
|
|
|
inline Index(const std::string& name) :
|
|
|
- Index{name[0] - '1', name[1] - 'a'} {}
|
|
|
+ Index{ '8' - name[0], name[1] - 'a' } {}
|
|
|
inline Index(int row, int column) :
|
|
|
index{int8_t(((row & 0x7) << 3) + (column & 0x7))} {}
|
|
|
|
|
|
|
|
|
- inline operator int8_t (void) const { return index; }
|
|
|
+ inline operator int8_t (void) const { return index; }
|
|
|
|
|
|
inline int getColumn (void) const { return index & 0x7; }
|
|
|
inline int getRow (void) const { return (index >> 3) & 0x7; }
|
|
|
|
|
|
inline std::string getName(void) const
|
|
|
{
|
|
|
- return { char('a' + getColumn()), char('1' + getRow()) };
|
|
|
+ return { char('a' + getColumn()), char('8' - getRow()) };
|
|
|
}
|
|
|
};
|
|
|
|