Gets next object from n of the same type as n
| 247 | |
| 248 | // Gets next object from n of the same type as n |
| 249 | int GetNextObjectID(int n) { |
| 250 | int i; |
| 251 | int type = Object_info[n].type; |
| 252 | |
| 253 | ASSERT(n >= 0 && n < MAX_OBJECT_IDS); |
| 254 | |
| 255 | if (Num_object_ids[type] == 0) |
| 256 | return -1; |
| 257 | |
| 258 | for (i = n + 1; i < MAX_OBJECT_IDS; i++) |
| 259 | if (Object_info[i].type == Object_info[n].type) |
| 260 | return i; |
| 261 | |
| 262 | for (i = 0; i <= n; i++) |
| 263 | if (Object_info[i].type == Object_info[n].type) |
| 264 | return i; |
| 265 | |
| 266 | Int3(); // shouldn't be here |
| 267 | return n; |
| 268 | } |
| 269 | |
| 270 | // Gets previous object from n that has the same type |
| 271 | int GetPrevObjectID(int n) { |
no outgoing calls
no test coverage detected