Find a valid, usable ID of the specified type
| 1472 | |
| 1473 | // Find a valid, usable ID of the specified type |
| 1474 | int FindValidID(int type) { |
| 1475 | int id = -1; |
| 1476 | |
| 1477 | switch (type) { |
| 1478 | case OBJ_ROBOT: |
| 1479 | case OBJ_POWERUP: |
| 1480 | case OBJ_BUILDING: |
| 1481 | case OBJ_CLUTTER: |
| 1482 | id = GetObjectID(type); |
| 1483 | break; |
| 1484 | |
| 1485 | case OBJ_DOOR: { |
| 1486 | int i; |
| 1487 | |
| 1488 | for (i = 0; i < MAX_DOORS; i++) |
| 1489 | if (Doors[i].used) { |
| 1490 | id = i; |
| 1491 | break; |
| 1492 | } |
| 1493 | ASSERT(i < MAX_DOORS); |
| 1494 | break; |
| 1495 | } |
| 1496 | |
| 1497 | default: |
| 1498 | Int3(); |
| 1499 | } |
| 1500 | |
| 1501 | return id; |
| 1502 | } |
| 1503 | |
| 1504 | // bash/converts generics, from those not allowed, to something that is allowed |
| 1505 | void ConvertObject(int *type, int *id) { |
no test coverage detected