MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FindValidID

Function FindValidID

Descent3/LoadLevel.cpp:1474–1502  ·  view source on GitHub ↗

Find a valid, usable ID of the specified type

Source from the content-addressed store, hash-verified

1472
1473// Find a valid, usable ID of the specified type
1474int 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
1505void ConvertObject(int *type, int *id) {

Callers 2

ReadObjectFunction · 0.85
ReadRoomFunction · 0.85

Calls 1

GetObjectIDFunction · 0.70

Tested by

no test coverage detected