I've written a TeamResults with plenty of STL bravado that I hope will give all you C++ freaks a warm and fuzzy feeling.

More seriously, this helps factorizing a bit things. What is stored and what can be retrieved is not final: for instance, I'm only storing a pointer to the Character who gets the biggest score in some domain, while I really only need a std::couple<const char*, int> .

Finally, what I really intend through this code is in fact to code some SDL-based renderer that will display the results. This could be invoked at any time by passing a vector of TeamResults. It would look like something:

+-------------------------------------+
|        Scores for: <Team i>         |   <- can also be "all teams"
+-------------------------------------+
+--------------+ +---------+ +--------+
| Most violent | | <Name1> | |<score1>|
+--------------+ +---------+ +--------+
...
+--------------+ +---------+ +--------+
| Most smthing | | <NameN> | |<scoreN>|
+--------------+ +---------+ +--------+

+-------------------------------------+
|<prev. team> [<] [OK] [>] <next team>|   [*] are buttons
+-------------------------------------+

If we note N the number of teams that played and i the current team index, we'd have:
- (i+N-1)%N the previous team index
- (i+N+1)%N the next team index

Rendering could first render all <most ...>/<name>/<score> rectangles into surfaces, check size, and determine the final rectangles sizes so that all are aligned.

Then one could build up on stats, storing per-character data (currently, I only see "survivals" as a value of this kind).

Best regards,
Kurosu

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à