At the top: #define INVALID_DOOR -1 stock GetNextEmptyDoorSlot() { for(new i=0; i<MAX_DOORS; i++) { if(DoorInfo[i][dTaken] == 0) { return i; } } return INVALID_DOOR; }