Cache Namelist length
Brought to you by:
thorstensick
Every time a names is chosen out of a file, the number
of names in this file is counted first. Create a linked
list containing
the number of names per file. In this list, there is:
World, country, file.
If we are looking for a name and no entry is in the
list, the names in the file are counted, the entry in
the list will be added.
Important: Delete list on de-init of library !
Logged In: YES
user_id=43775
Originator: YES
Set it to prio 1, because it is not really needed and is just a "would be nice" feature
Logged In: YES
user_id=1428370
Originator: NO
Not sure I understand.
Are we talking about a struct containing (the gaming) world, (the gaming) country and the path to the file?
How should the list be sorted? I assume by number of posts.
Also, if the file is the path, would you like it as a filepointer or a string (or maybe char* to be precise since string is an actual type those days and probably isn't completely standardized just yet)?
Logged In: YES
user_id=43775
Originator: YES
The problem is: If I want a random name from a file, I open it, count the lines, close it.
The I start a random command resulting in the line I want.
The I open the file, go to this line, output it. Close the file
Normally you want more than one name of a specified coutry. Say, 100 male names, german,
This summs up to reading the whole file about 100 times and reading a large portion of the file 100 times.
= 200 Times file handling.
If we store the number of names in a file the first time we read it in some structure, we could save a lot of disc access.
For the stand-alone tool, it is not needed. But for a library used in games, saving time is very important.
(It is notused yet, so no hurry)
Logged In: YES
user_id=1428370
Originator: NO
Okely dokely, now I get it.
So basically any 2D char* would do (two dimensional string).
I don't see why you should need a struct (or similar) since you already know what you are making.
Then again it's a small job to make a single struct with a pointer to the vector-string,
so why not.