Pink Petal Games

Feedback => New Features => Topic started by: Uriel on February 25, 2010, 02:56:07 AM

Title: Sort girls by...
Post by: Uriel on February 25, 2010, 02:56:07 AM
Like it's done in, for example, Total Commander and even in Explorer when it's set to Table view. So we will be able to arrange them by: happiness, tiredness, preg status, health, day job, night job... maybe something else if it will be useful.
As i understand, the girl's position in the list defines her chance to get some clients now. Don't know if there will be any changes to this in upcoming update(i saw something about assigning an unique identifier to avery girl and item, but dunno if this will be implemented or not), so i don't know if this can be done. But it certainly will help when you need to do a lot of micromanagement, in late game especially.
Title: Re: Sort girls by...
Post by: DocClox on February 26, 2010, 06:40:48 PM
Doable. I wanted to get a table widget working first so you'd be able to click on the headers to sort the column. I guess a simpler alternative might be to have a set of sort buttons at the top.

Probably not going to happen any time soon, though.
Title: Re: Sort girls by...
Post by: pnakasone on April 25, 2010, 06:32:25 PM
Seconded filters would help
Title: Re: Sort girls by...
Post by: Dagoth on April 25, 2010, 10:27:25 PM
I've just started working on switching the Girl Management screen to the XML layout method and in the process I plan to make the girl list display in multi-column format, since I just got that capability in a few days ago. There is the possibility to then sort the list by the headers, but I'm not sure whether I'll get to that just now or not.

That does bring to mind the question of whether the sorting method should be handled by the screen's own code or perhaps actually be implemented into the listbox code itself (basic alphabetical sort, ascending or descending, probably a standard bubble sort algorithm); the latter might actually be the way to go to easily allow sorting on other screens. Hmm. I'll ponder on it.
Title: Re: Sort girls by...
Post by: DocClox on April 26, 2010, 03:35:55 AM
There's a std::sort that works with the stl container classes. You'll probably need a vector of proxy objects so you can re-order the proxies without rearranging the order of the underlying data, which would probably break things in many cases.

You could template the proxy class easily enough, and overload the ponter operation so it returned the pointer to the thing it represents.

The fun starts when the underlying data changes (like when you fire a gang) and the proxy list needs to be updated.
Title: Re: Sort girls by...
Post by: Dagoth on April 26, 2010, 04:29:12 AM
Vectors are a bit beyond me at this point; I'm more likely to just add in a separate bubble-sort function, check based on the appropriate column data for each list item, and then reorder the stack of list items (m_Next pointer for each) based on that. The IDs can be arbitrary from the ordering anyway, so...

Whenever underlying data changes, I can just have it re-run the sorting algorithm again. Hopefully that's all that will be needed.


EDIT: went ahead and did it (http://pinkpetal.org/index.php?topic=257.msg6223#msg6223).