… | |
… | |
92 | * 8 = blocked below |
92 | * 8 = blocked below |
93 | */ |
93 | */ |
94 | |
94 | |
95 | int surround_index = 0; |
95 | int surround_index = 0; |
96 | |
96 | |
|
|
97 | // don't forget to update the mapspace! |
|
|
98 | map->at (i - 1, j).update (); |
|
|
99 | map->at (i + 1, j).update (); |
|
|
100 | map->at (i , j - 1).update (); |
|
|
101 | map->at (i , j + 1).update (); |
|
|
102 | |
97 | if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & ~MOVE_BLOCK_DEFAULT)) |
103 | if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & MOVE_WALK)) |
98 | surround_index |= 1; |
104 | surround_index |= 1; |
99 | if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & ~MOVE_BLOCK_DEFAULT)) |
105 | if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & MOVE_WALK)) |
100 | surround_index |= 2; |
106 | surround_index |= 2; |
101 | if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & ~MOVE_BLOCK_DEFAULT)) |
107 | if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & MOVE_WALK)) |
102 | surround_index |= 4; |
108 | surround_index |= 4; |
103 | if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & ~MOVE_BLOCK_DEFAULT)) |
109 | if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & MOVE_WALK)) |
104 | surround_index |= 8; |
110 | surround_index |= 8; |
105 | |
111 | |
106 | return surround_index; |
112 | return surround_index; |
107 | } |
113 | } |
108 | |
114 | |