Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I need to somehow make it check all squares between the 'from' square and the destination square, on the same diagonal (for example if the bishop is moving from c8 to h3, it needs to ckeck that the squares d7, e6, f5 and g4 are empty).
This was easy enough for the rooks - essentially "for(k = from_x+1;k < msqx;k ++) if pc[from_x+k,msqy] != 0 exit". With the bishops I've been trying things like "if pc[max(from_x,msqx)-min(from_x,msqx)+k,max(from_y,msqy)-min(from_y,msqy)] != 0 exit" but they always end up able to make illegal moves or unable to make legal ones ):
x += lengthdir_x( dis, dir ); dis is the distance and dir is the direction which you get using point_direction.
By the way you would want to use both x += lengthdir_x and y += lengthdir_y to move diagonal. You can use the the same dir you get from point_direction in both the x and y.