Gets next door from n that has actually been alloced
| 175 | |
| 176 | // Gets next door from n that has actually been alloced |
| 177 | int GetNextDoor(int n) { |
| 178 | int i; |
| 179 | |
| 180 | ASSERT(n >= 0 && n < MAX_DOORS); |
| 181 | |
| 182 | if (Num_doors == 0) |
| 183 | return -1; |
| 184 | |
| 185 | for (i = n + 1; i < MAX_DOORS; i++) |
| 186 | if (Doors[i].used) |
| 187 | return i; |
| 188 | for (i = 0; i < n; i++) |
| 189 | if (Doors[i].used) |
| 190 | return i; |
| 191 | |
| 192 | // this is the only one |
| 193 | |
| 194 | return n; |
| 195 | } |
| 196 | |
| 197 | // Gets previous door from n that has actually been alloced |
| 198 | int GetPrevDoor(int n) { |
no outgoing calls
no test coverage detected