#3 TabStats: factorization and add a column for CannonKeep mode

open-accepted
nobody
Interface (2)
1
2011-02-24
2011-02-24
Anonymous
No

This patch was primarily intended to add a "CannonShots" to the statistics in CannonKeep game mode: it counts the number of shots of the cannon when the player is controling it (regardless whether the ball hits the home planet or not).

I thus factorized the code that writes each column and added a column counter (int col).
So, it's now super-easy to add mode-specific columns w/o having to modify the formatting of the other columns.

The locales (apart from english and french) are screwed, however (and the french name could be better ... "Tirs du Cannon", maybe, but that's too long...).
I had to enlarge the columns (the column width could be factorized too, as a macro, btw.)

Oh, and I'm not entirely satisfied with the way how shots and counted (I added "Cannon" to the friends classes of Player...). It may be cleaner with a method call. It's one of the first time I write C++, so ...

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-02-24

    the patch ... what else ?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-02-24
    • labels: --> Interface
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-02-24

    s/how shots and counted/how shots are counted/
    (last line)

     
  • Mars-Core-Team

    Mars-Core-Team - 2011-02-24

    Hey, that's a cool idea! Just applied your patch and pushed it to SVN. Works great.
    Concerning the locales: They were designed, when mars was a really small game with roughly 20 words in the interface, now they are a mess ;) ... but if you want to add a new one, just add it to the end of the list. The number in the translation file describes the position in the enumeration. In the translation file, the numbers do not have to be ordered.
    Concerning the coding style: Well, with the tabstats, there is nothing you can do worse, than we did. They are designed horribly. Once we find the time, we'll have to recode them using an actual window. As you probably realized they simply mimic a "normal" window...

    Thanks a lot for the patch! It's a really cool idea... probably you have other ideas, for example the statistics in SpaceBall are quite useless... counting goals would be much more useful^^

    If you have questions, please post to the forum!
    http://mars-game.sourceforge.net/?page_id=160
    (just e-mail us (marscoreteam(at)googlemail.com) your desired username, so we can create an account for you!)

    Greetings,
    Simon.

     
  • Mars-Core-Team

    Mars-Core-Team - 2011-02-24
    • priority: 5 --> 1
    • status: open --> open-accepted
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks