ScreenSquare(fromX, fromY, &start);\r
ScreenSquare(toX, toY, &finish);\r
\r
- /* All pieces except knights move in straight line */\r
- if (piece != WhiteKnight && piece != BlackKnight) {\r
+ /* All moves except knight jumps move in straight line */\r
+ if (!(abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
} else {\r
- /* Knight: make diagonal movement then straight */\r
+ /* Knight: make straight movement then diagonal */\r
if (abs(toY - fromY) < abs(toX - fromX)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
- mid.y = finish.y;\r
+ mid.y = start.y;\r
} else {\r
- mid.x = finish.x;\r
+ mid.x = start.x;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
}\r
}\r
#if DONT_HOP
hop = FALSE;
#else
- hop = (piece == WhiteKnight || piece == BlackKnight);
+ hop = abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1;
#endif
if (appData.debugMode) {
ScreenSquare(toX, toY, &finish, &endColor);
if (hop) {
- /* Knight: make diagonal movement then straight */
+ /* Knight: make straight movement then diagonal */
if (abs(toY - fromY) < abs(toX - fromX)) {
mid.x = start.x + (finish.x - start.x) / 2;
- mid.y = finish.y;
+ mid.y = start.y;
} else {
- mid.x = finish.x;
+ mid.x = start.x;
mid.y = start.y + (finish.y - start.y) / 2;
}
} else {