visibility!

This commit is contained in:
kin fuyuki 2026-02-23 21:13:51 -03:00
commit 38ea792ee7
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
4 changed files with 48 additions and 6 deletions

View file

@ -24,6 +24,35 @@ std::vector<std::vector<char>> map{
{11,N,N,15},{N,N,14,16},{13,N,15,N}
};
#undef N
std::vector<std::vector<std::vector<char>>> visibilitychart{
{{},{7,8,11,14},{},{1,2,8}},//0
{{},{7,8,11},{0,7},{2}},
{{},{3,4},{0,7},{}},//2
{{2},{4,5},{5,6,9,10},{}},
{{2,3},{},{5,6,10},{}},//4
{{3,9,10},{},{6},{4}},
{{9,10},{},{},{5,4,3}},//6
{{0,1},{11,14},{},{1,2,8}},
{{0,1},{13},{7,1},{}},//8
{{},{6,10},{3,4,5,6},{}},
{{},{5,6},{},{3,5,9}},//10
{{0,7},{14},{},{12}},
{{},{},{11},{}},//12
{{0,1,8},{},{16},{}},
{{0,7,11},{},{},{15,16}},//14
{{},{},{14},{16}},
{{13},{},{14,15},{}}//16
};
bool cansee(char dest,char pos, char dir) {
std::vector<char> check=visibilitychart[pos][dir];
for (char i: check) {
if (dest==i)return true;
}
return false;
}
char moveentity(char pos,char dir,bool backwards) {