core/tempq: Merge TempQueue :: read() with tempq_init()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
2102b1bfc9
commit
9633806c2d
|
@ -12,16 +12,6 @@ static std::list<TempQueue> queue_deck;
|
|||
static struct file deck_file;
|
||||
|
||||
|
||||
void TempQueue :: read(file &file)
|
||||
{
|
||||
unsigned int n, id;
|
||||
file_readf(&file, "%u %u", &q_flags, &n);
|
||||
for (unsigned int i = 0; i < n; i++) {
|
||||
file_readf(&file, "%u", &id);
|
||||
queue_add(this, track_get(id));
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int TempQueue :: add(struct track *track)
|
||||
{
|
||||
unsigned int res = queue_add(this, track);
|
||||
|
@ -59,7 +49,9 @@ static unsigned int __tempq_index(struct queue *queue)
|
|||
|
||||
void tempq_init(struct queue_ops *ops)
|
||||
{
|
||||
unsigned int flags, count, j, id;
|
||||
unsigned int num, i;
|
||||
struct queue *queue;
|
||||
|
||||
file_init(&deck_file, "deck", 1);
|
||||
if (!file_open(&deck_file, OPEN_READ))
|
||||
|
@ -69,7 +61,12 @@ void tempq_init(struct queue_ops *ops)
|
|||
|
||||
file_readf(&deck_file, "%u", &num);
|
||||
for (i = 0; i < num; i++) {
|
||||
((TempQueue *)tempq_alloc(NULL, 0))->read(deck_file);
|
||||
file_readf(&deck_file, "%u %u", &flags, &count);
|
||||
queue = tempq_alloc(NULL, flags);
|
||||
for (j = 0; j < count; j++) {
|
||||
file_readf(&deck_file, "%u", &id);
|
||||
queue_add(queue, track_get(id));
|
||||
}
|
||||
queue_deck.back().q_ops = ops;
|
||||
}
|
||||
file_close(&deck_file);
|
||||
|
|
|
@ -17,8 +17,6 @@ extern "C" {
|
|||
class TempQueue : public queue
|
||||
{
|
||||
public:
|
||||
void read(file &);
|
||||
|
||||
unsigned int add(struct track *);
|
||||
void del(struct track *);
|
||||
void del(unsigned int);
|
||||
|
|
Loading…
Reference in New Issue