devolution

Author Topic: Sort girls by...  (Read 3443 times)

0 Members and 1 Guest are viewing this topic.

Offline Uriel

  • Full Member
  • ***
  • Posts: 175
Sort girls by...
« 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.

Offline DocClox

  • Dev Team
  • *****
  • Posts: 1867
  • Messing Around With Python
Re: Sort girls by...
« Reply #1 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.

Offline pnakasone

  • Newbie
  • *
  • Posts: 21
Re: Sort girls by...
« Reply #2 on: April 25, 2010, 06:32:25 PM »
Seconded filters would help

Offline Dagoth

  • Administrator
  • *****
  • Posts: 617
Re: Sort girls by...
« Reply #3 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.
« Last Edit: April 25, 2010, 10:29:12 PM by Dagoth »

Offline DocClox

  • Dev Team
  • *****
  • Posts: 1867
  • Messing Around With Python
Re: Sort girls by...
« Reply #4 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.

Offline Dagoth

  • Administrator
  • *****
  • Posts: 617
Re: Sort girls by...
« Reply #5 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.
« Last Edit: April 26, 2010, 11:24:02 AM by Dagoth »