FS#6960 - Add random selection option to database, by Mark Reiche. This satisfies FS#6915.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15957 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2007-12-21 13:31:50 +00:00
parent 88f79becd2
commit de741cd534
2 changed files with 30 additions and 3 deletions

View file

@ -11512,4 +11512,17 @@
ipodvideo: "Treble Cutoff"
</voice>
</phrase>
<phrase>
id: LANG_TAGNAVI_RANDOM
desc: "<Random>" entry in tag browser
user:
<source>
*: "<Random>"
</source>
<dest>
*: "<Random>"
</dest>
<voice>
*: "Random"
</voice>
</phrase>

View file

@ -1136,7 +1136,15 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs,
dptr++;
current_entry_count++;
}
special_entry_count++;
if (offset <= 1)
{
dptr->newtable = navibrowse;
dptr->name = str(LANG_TAGNAVI_RANDOM);
dptr->extraseek = -1;
dptr++;
current_entry_count++;
}
special_entry_count+=2;
}
total_count += special_entry_count;
@ -1374,8 +1382,14 @@ int tagtree_enter(struct tree_context* c)
dptr = tagtree_get_entry(c, c->selected_item);
c->dirfull = false;
seek = dptr->extraseek;
if (seek == -1)
{
srand(current_tick);
dptr = (tagtree_get_entry(c, 2+(rand() % (c->filesindir-2))));
seek = dptr->extraseek;
}
newextra = dptr->newtable;
seek = dptr->extraseek;
if (c->dirlevel >= MAX_DIR_LEVELS)
return 0;